Add pre-commit config and auto-format files

This commit is contained in:
Leroy Hopson 2024-02-13 09:50:18 +13:00
parent af16cb8653
commit bd817eb0ce
No known key found for this signature in database
GPG key ID: D2747312A6DB51AA
22 changed files with 370 additions and 349 deletions

1
.gitattributes vendored
View file

@ -30,6 +30,7 @@
/.import export-ignore /.import export-ignore
/LICENSE.md export-ignore /LICENSE.md export-ignore
/misc export-ignore /misc export-ignore
/.pre-commit-config.yaml export-ignore
/project.godot export-ignore /project.godot export-ignore
/README.md export-ignore /README.md export-ignore
/requirements.txt export-ignore /requirements.txt export-ignore

View file

@ -1,4 +1,4 @@
name: 'Build and Test' name: "Build and Test"
on: on:
push: push:
@ -14,13 +14,13 @@ env:
jobs: jobs:
build_docker: build_docker:
name: 'Build Docker (linux, ${{ matrix.target }}, ${{ matrix.bits }})' name: "Build Docker (linux, ${{ matrix.target }}, ${{ matrix.bits }})"
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
target: [ release, debug ] target: [release, debug]
bits: [ 64, 32 ] bits: [64, 32]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
@ -59,14 +59,14 @@ jobs:
addons/godot_xterm/native/bin/*.so addons/godot_xterm/native/bin/*.so
build_native: build_native:
name: 'Build Native' name: "Build Native"
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
platform: [ javascript, osx, windows ] platform: [javascript, osx, windows]
target: [ release, debug ] target: [release, debug]
bits: [ 64, 32 ] bits: [64, 32]
include: include:
- platform: javascript - platform: javascript
os: ubuntu-22.04 os: ubuntu-22.04
@ -129,7 +129,7 @@ jobs:
if: steps.cache-submodules.outputs.cache-hit != 'true' if: steps.cache-submodules.outputs.cache-hit != 'true'
uses: jwlawson/actions-setup-cmake@v1 uses: jwlawson/actions-setup-cmake@v1
with: with:
cmake-version: '3.23.2' cmake-version: "3.23.2"
use-32bit: ${{ matrix.bits == 32 && matrix.os == 'windows-2022' }} use-32bit: ${{ matrix.bits == 32 && matrix.os == 'windows-2022' }}
- name: Build libuv - name: Build libuv
if: steps.cache-submodules.outputs.cache-hit != 'true' if: steps.cache-submodules.outputs.cache-hit != 'true'
@ -171,70 +171,70 @@ jobs:
addons/godot_xterm/native/bin/*.dll addons/godot_xterm/native/bin/*.dll
html5_export: html5_export:
name: 'HTML5 Export' name: "HTML5 Export"
needs: [ build_docker, build_native ] needs: [build_docker, build_native]
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Setup Godot - name: Setup Godot
uses: lihop/setup-godot@v2 uses: lihop/setup-godot@v2
with: with:
export-templates: true export-templates: true
- name: Install binary build artifacts - name: Install binary build artifacts
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3
with: with:
name: libgodot-xterm-release name: libgodot-xterm-release
path: addons/godot_xterm/native/bin path: addons/godot_xterm/native/bin
- name: Import assets - name: Import assets
uses: nick-fields/retry@v2 uses: nick-fields/retry@v2
with: with:
command: godot --editor .github/import_assets.tscn command: godot --editor .github/import_assets.tscn
retry_on: error retry_on: error
timeout_minutes: 5 timeout_minutes: 5
max_attempts: 6 max_attempts: 6
- name: Export HTML5 - name: Export HTML5
uses: nick-fields/retry@v2 uses: nick-fields/retry@v2
with: with:
command: godot --no-window --export HTML5 command: godot --no-window --export HTML5
retry_on: error retry_on: error
timeout_minutes: 5 timeout_minutes: 5
max_attempts: 6 max_attempts: 6
- name: NPM cache - name: NPM cache
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
cache: 'npm' cache: "npm"
cache-dependency-path: test/html5/package-lock.json cache-dependency-path: test/html5/package-lock.json
- name: Smoke test HTML5 export - name: Smoke test HTML5 export
shell: bash shell: bash
working-directory: test/html5 working-directory: test/html5
run: | run: |
npm ci npm ci
npx serve ../../docs/demo -p 3000 & npx serve ../../docs/demo -p 3000 &
npx cypress run npx cypress run
- name: Upload cypress artifacts (on failure) - name: Upload cypress artifacts (on failure)
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
if: ${{ failure() }} if: ${{ failure() }}
with: with:
name: cypress-artifacts name: cypress-artifacts
path: |- path: |-
test/html5/cypress/screenshots test/html5/cypress/screenshots
test/html5/cypress/videos test/html5/cypress/videos
- name: Upload export - name: Upload export
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: html5-demo name: html5-demo
path: docs/demo path: docs/demo
test: test:
name: 'Test' name: "Test"
needs: [ build_docker, build_native ] needs: [build_docker, build_native]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ windows-2022, macos-12, ubuntu-22.04 ] os: [windows-2022, macos-12, ubuntu-22.04]
bits: [ 64, 32 ] bits: [64, 32]
godot_version: [ 'v3.4.5-stable', 'v3.5-stable' ] godot_version: ["v3.4.5-stable", "v3.5-stable"]
exclude: exclude:
- os: macos-12 - os: macos-12
bits: 32 bits: 32
@ -267,51 +267,50 @@ jobs:
timeout_minutes: 5 timeout_minutes: 5
max_attempts: 6 max_attempts: 6
# Git archive should only include addons/godot_xterm directory. # Git archive should only include addons/godot_xterm directory.
check-archive: check-archive:
name: 'Check Archive' name: "Check Archive"
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
submodules: recursive submodules: recursive
- name: Create git archive - name: Create git archive
run: git archive -o archive.zip HEAD run: git archive -o archive.zip HEAD
- name: Extract archive - name: Extract archive
run: mkdir -p /tmp/unzipped && unzip archive.zip -d /tmp/unzipped run: mkdir -p /tmp/unzipped && unzip archive.zip -d /tmp/unzipped
- name: Check that archive only contains addons directory - name: Check that archive only contains addons directory
run: | run: |
shopt -s nullglob dotglob shopt -s nullglob dotglob
ls -lR /tmp/unzipped ls -lR /tmp/unzipped
files=(/tmp/unzipped/*) files=(/tmp/unzipped/*)
if [ ${#files[@]} -ne 1 ]; then if [ ${#files[@]} -ne 1 ]; then
echo "Wrong number of files in archive (${#files[@]}) expected 1." echo "Wrong number of files in archive (${#files[@]}) expected 1."
exit 1 exit 1
fi fi
if [ ! -d "/tmp/unzipped/addons" ]; then if [ ! -d "/tmp/unzipped/addons" ]; then
echo "Expected directory (addons) not found." echo "Expected directory (addons) not found."
exit 1 exit 1
fi fi
files=(/tmp/unzipped/addons) files=(/tmp/unzipped/addons)
if [ ${#files[@]} -ne 1 ]; then if [ ${#files[@]} -ne 1 ]; then
echo "Wrong number of files in addons directory (${#files[@]}) expected 1." echo "Wrong number of files in addons directory (${#files[@]}) expected 1."
exit 1 exit 1
fi fi
if [ ! -d "/tmp/unzipped/addons/godot_xterm" ]; then if [ ! -d "/tmp/unzipped/addons/godot_xterm" ]; then
echo "Expected directory (addons/godot_xterm) not found." echo "Expected directory (addons/godot_xterm) not found."
exit 1 exit 1
fi fi
check-code-format: check-code-format:
name: 'Check Code Format' name: "Check Code Format"
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: actions/setup-python@v4 - uses: actions/setup-python@v4
with: with:
python-version: 3.9 python-version: 3.9
- name: GDFormat Check - name: GDFormat Check
run: | run: |
python -m pip install -r requirements.txt python -m pip install -r requirements.txt
gdformat -c . gdformat -c .

15
.pre-commit-config.yaml Normal file
View file

@ -0,0 +1,15 @@
# SPDX-FileCopyrightText: none
# SPDX-License-Identifier: CC0-1.0
ci:
autofix_commit_msg: "fix: auto fixes"
autoupdate_commit_msg: "chore: autoupdate"
exclude: "^addons/gut/"
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-yaml
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0
hooks:
- id: prettier

View file

@ -1,27 +1,32 @@
# Changelog # Changelog
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased](https://github.com/lihop/godot-xterm/compare/v2.2.0...HEAD) ## [Unreleased](https://github.com/lihop/godot-xterm/compare/v2.2.0...HEAD)
### Changed ### Changed
- Custom export templates are no longer required when exporting to HTML5 from Godot v3.5.x. - Custom export templates are no longer required when exporting to HTML5 from Godot v3.5.x.
### Removed ### Removed
- Removed support for deprecated theme item names. - Removed support for deprecated theme item names.
- Removed deprecated get_master() method of PTY. - Removed deprecated get_master() method of PTY.
- Removed deprecated cols/rows properties of Terminal. - Removed deprecated cols/rows properties of Terminal.
## [v2.2.0](https://github.com/lihop/godot-xterm/compare/v2.1.1...v2.2.0) - 2022-08-26 ## [v2.2.0](https://github.com/lihop/godot-xterm/compare/v2.1.1...v2.2.0) - 2022-08-26
### Changed ### Changed
- Changed theme item names to be compatible with Godot version 3.5 (no spaces), - Changed theme item names to be compatible with Godot version 3.5 (no spaces),
consistent with other theme item names (snake_case), and to match the ANSI consistent with other theme item names (snake_case), and to match the ANSI
color names listed on the [ANSI escape code Wikipedia page](https://en.wikipedia.org/wiki/ANSI_escape_code#3-bit_and_4-bit). color names listed on the [ANSI escape code Wikipedia page](https://en.wikipedia.org/wiki/ANSI_escape_code#3-bit_and_4-bit).
### Deprecated ### Deprecated
- Deprecated the `cols` and `rows` properties of Terminal. - Deprecated the `cols` and `rows` properties of Terminal.
These properties will be removed in a future version. These properties will be removed in a future version.
Please use `get_cols()` and `get_rows()` instead. Please use `get_cols()` and `get_rows()` instead.
@ -58,21 +63,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `Bold Italic` -> `bold_italic` - `Bold Italic` -> `bold_italic`
### Removed ### Removed
- Removed support for Godot version 3.3.x. GodotXterm *might* still work with this
- Removed support for Godot version 3.3.x. GodotXterm _might_ still work with this
version of Godot if compiled with the correct version of godot-cpp, but compatibility version of Godot if compiled with the correct version of godot-cpp, but compatibility
is no longer officially supported. is no longer officially supported.
### Fixed ### Fixed
- [#57][i57]: Screen is no longer erased on resize when using a custom theme. - [#57][i57]: Screen is no longer erased on resize when using a custom theme.
- [#58][i58]: Screen is no longer erased when changing themes. - [#58][i58]: Screen is no longer erased when changing themes.
[i57]: https://github.com/lihop/godot-xterm/issues/57 [i57]: https://github.com/lihop/godot-xterm/issues/57
[i58]: https://github.com/lihop/godot-xterm/issues/58 [i58]: https://github.com/lihop/godot-xterm/issues/58
## [v2.1.1](https://github.com/lihop/godot-xterm/compare/v2.1.0...v2.1.1) - 2022-08-15 ## [v2.1.1](https://github.com/lihop/godot-xterm/compare/v2.1.0...v2.1.1) - 2022-08-15
### Fixed ### Fixed
Thanks to [@ConteZero](https://github.com/contezero) for reporting and providing feedback on these issues: Thanks to [@ConteZero](https://github.com/contezero) for reporting and providing feedback on these issues:
- [#51][i51]: Fixed issue where terminal would lose focus on Tab/Arrow key presses - [#51][i51]: Fixed issue where terminal would lose focus on Tab/Arrow key presses
when in a scene with other input nodes. when in a scene with other input nodes.
- [#53][i53]: Fixed issue where terminal was not updating when there was no GUI - [#53][i53]: Fixed issue where terminal was not updating when there was no GUI
@ -85,14 +94,16 @@ Thanks to [@ConteZero](https://github.com/contezero) for reporting and providing
[i55]: https://github.com/lihop/godot-xterm/issues/55 [i55]: https://github.com/lihop/godot-xterm/issues/55
[i56]: https://github.com/lihop/godot-xterm/issues/56 [i56]: https://github.com/lihop/godot-xterm/issues/56
## [v2.1.0](https://github.com/lihop/godot-xterm/compare/v2.0.0...v2.1.0) - 2022-07-11 ## [v2.1.0](https://github.com/lihop/godot-xterm/compare/v2.0.0...v2.1.0) - 2022-07-11
### Added ### Added
- Support for macOS universal (x86_64/arm64) binaries. The macOS binary - Support for macOS universal (x86_64/arm64) binaries. The macOS binary
`libgodot-xterm.osx.64.dylib` is now a universal binary that runs natively `libgodot-xterm.osx.64.dylib` is now a universal binary that runs natively
on both x86_64 and arm64. on both x86_64 and arm64.
### Changed ### Changed
- Linux binaries now support systems with older GLIBC versions. By building the - Linux binaries now support systems with older GLIBC versions. By building the
binaries inside a docker container with an older GLIBC version, the minimum binaries inside a docker container with an older GLIBC version, the minimum
required GLIBC version is now 2.17 which was released in 2012. required GLIBC version is now 2.17 which was released in 2012.
@ -105,11 +116,13 @@ Thanks to [@ConteZero](https://github.com/contezero) for reporting and providing
pressing modifier keys in isolation or when copying text using the shortcut Ctrl+Shift+C. pressing modifier keys in isolation or when copying text using the shortcut Ctrl+Shift+C.
### Removed ### Removed
- Removed custom TerminalSettings Resource type. - Removed custom TerminalSettings Resource type.
This Resource was not being used but would still appear in every resource dropdown. This Resource was not being used but would still appear in every resource dropdown.
(Related issue [godotengine/godot#24643](https://github.com/godotengine/godot/issues/24643)). (Related issue [godotengine/godot#24643](https://github.com/godotengine/godot/issues/24643)).
### Fixed ### Fixed
- The `kill()` method of unix PTY node can now be called without error as the underlying - The `kill()` method of unix PTY node can now be called without error as the underlying
`pipe.close()` method of the gdnative library is now registered. `pipe.close()` method of the gdnative library is now registered.
- Fixed 'Condition "!obj" is true.' error that would often print to console when - Fixed 'Condition "!obj" is true.' error that would often print to console when
@ -120,9 +133,10 @@ Thanks to [@ConteZero](https://github.com/contezero) for reporting and providing
sometimes occur when closing a Terminal after calling `write()` but before VisualServer sometimes occur when closing a Terminal after calling `write()` but before VisualServer
had finished drawing the current frame. had finished drawing the current frame.
## [v2.0.0](https://github.com/lihop/godot-xterm/compare/v1.2.1...v2.0.0) - 2021-07-25 ## [v2.0.0](https://github.com/lihop/godot-xterm/compare/v1.2.1...v2.0.0) - 2021-07-25
### Added ### Added
- Terminal editor plugin. Adds integrated terminal to Godot editor. - Terminal editor plugin. Adds integrated terminal to Godot editor.
- Xresources import plugin. - Xresources import plugin.
- [#39][i39]: Support for the bell "\u0007" character. - [#39][i39]: Support for the bell "\u0007" character.
@ -130,6 +144,7 @@ Thanks to [@ConteZero](https://github.com/contezero) for reporting and providing
- [#24][i24]: Support for Windows 32-bit (Terminal node only). - [#24][i24]: Support for Windows 32-bit (Terminal node only).
### Changed ### Changed
- [#44][i44]: Default theme to match Godot's default theme. - [#44][i44]: Default theme to match Godot's default theme.
- Supported Godot version -> 3.3.2. - Supported Godot version -> 3.3.2.
- Set a default theme if no theme property has been set. - Set a default theme if no theme property has been set.
@ -137,6 +152,7 @@ Thanks to [@ConteZero](https://github.com/contezero) for reporting and providing
- TPut no longer registered as a unique global class (i.e. removed `class_name TPut`). - TPut no longer registered as a unique global class (i.e. removed `class_name TPut`).
### Fixed ### Fixed
- [#40][i40]: Vim related bugs, caused by incorrectly handled control sequences. - [#40][i40]: Vim related bugs, caused by incorrectly handled control sequences.
- Don't swap red and blue channels of theme colors. - Don't swap red and blue channels of theme colors.
- Use "Light Cyan" color from theme. Previously ignored. - Use "Light Cyan" color from theme. Previously ignored.
@ -146,37 +162,44 @@ Thanks to [@ConteZero](https://github.com/contezero) for reporting and providing
[i40]: https://github.com/lihop/godot-xterm/issues/40 [i40]: https://github.com/lihop/godot-xterm/issues/40
[i44]: https://github.com/lihop/godot-xterm/issues/44 [i44]: https://github.com/lihop/godot-xterm/issues/44
## [v1.2.1](https://github.com/lihop/godot-xterm/compare/v1.2.0...v1.2.1) - 2020-11-23 ## [v1.2.1](https://github.com/lihop/godot-xterm/compare/v1.2.0...v1.2.1) - 2020-11-23
### Changed ### Changed
- GitHub Actions workflow now produces both a release and debug zip archive. - GitHub Actions workflow now produces both a release and debug zip archive.
### Fixed ### Fixed
- Release binary for Windows 64-bit export. - Release binary for Windows 64-bit export.
## [v1.2.0](https://github.com/lihop/godot-xterm/compare/v1.0.0...v1.2.0) - 2020-11-21 ## [v1.2.0](https://github.com/lihop/godot-xterm/compare/v1.0.0...v1.2.0) - 2020-11-21
### Added ### Added
- Support for macOS 64-bit including Pseudoterminal. - Support for macOS 64-bit including Pseudoterminal.
- Partial support for Windows 64-bit and compiling on Windows using MSVC. Pseudoterminal not yet supported. 32-bit builds might be possible but not yet built/tested. - Partial support for Windows 64-bit and compiling on Windows using MSVC. Pseudoterminal not yet supported. 32-bit builds might be possible but not yet built/tested.
### Changed ### Changed
- Updated build script. On Linux `./build.sh` will create a debug build of the gdnative library for the current platform. - Updated build script. On Linux `./build.sh` will create a debug build of the gdnative library for the current platform.
- Removed all pre-compiled binaries using BFG [Repo-Cleaner](https://rtyley.github.io/bfg-repo-cleaner/), thus re-writing git history. - Removed all pre-compiled binaries using BFG [Repo-Cleaner](https://rtyley.github.io/bfg-repo-cleaner/), thus re-writing git history.
### Fixed ### Fixed
- Fixed bug where incorrect data would sometimes be written to the terminal when passing a string to the Terminal's `write()` method. - Fixed bug where incorrect data would sometimes be written to the terminal when passing a string to the Terminal's `write()` method.
- Positioned background rect at 0,0 so it is no longer offset if a margin is added when Terminal is a child of a Container node. - Positioned background rect at 0,0 so it is no longer offset if a margin is added when Terminal is a child of a Container node.
- Passed correct argv to the execvp call of Pseudoterminal. Previously argv[0] was not set to the program's name which caused the Pseudoterminal node not to work on macOS with the zsh shell. - Passed correct argv to the execvp call of Pseudoterminal. Previously argv[0] was not set to the program's name which caused the Pseudoterminal node not to work on macOS with the zsh shell.
## [v1.0.0](https://github.com/lihop/godot-xterm/releases/tag/v1.0.0) - 2020-10-05 ## [v1.0.0](https://github.com/lihop/godot-xterm/releases/tag/v1.0.0) - 2020-10-05
### Added ### Added
- Changelog. - Changelog.
- Asciicast importer plugin. Enables the import of .cast ([asciicast files v2](https://github.com/asciinema/asciinema/blob/master/doc/asciicast-v2.md)) that can be made using the [asciinema](https://asciinema.org/) terminal session recorder. See the [asciicast scene](/examples/asciicast) for example usage. - Asciicast importer plugin. Enables the import of .cast ([asciicast files v2](https://github.com/asciinema/asciinema/blob/master/doc/asciicast-v2.md)) that can be made using the [asciinema](https://asciinema.org/) terminal session recorder. See the [asciicast scene](/examples/asciicast) for example usage.
- Pre-built binary for x11 platform. - Pre-built binary for x11 platform.
### Changed ### Changed
- Implementation of Terminal node from GDScript to GDNative using [Aetf's patched version of libtsm](https://github.com/Aetf/libtsm). - Implementation of Terminal node from GDScript to GDNative using [Aetf's patched version of libtsm](https://github.com/Aetf/libtsm).
- Move input handling to the Terminal node itself, rather than handling it in a seperate Control node. - Move input handling to the Terminal node itself, rather than handling it in a seperate Control node.
- The Terminal `write()` method now accepts both String and PoolByteArray. - The Terminal `write()` method now accepts both String and PoolByteArray.

View file

@ -1,6 +1,7 @@
<img align="left" width="64" height="64" src="./media/icon.png"> <img align="left" width="64" height="64" src="./media/icon.png">
# GodotXterm - Terminal Emulator # GodotXterm - Terminal Emulator
<br/> <br/>
[![Godot Version](https://img.shields.io/badge/Godot-3.4.x-blue.svg)](#supported-godot-versions) [![Godot Version](https://img.shields.io/badge/Godot-3.4.x-blue.svg)](#supported-godot-versions)
@ -25,6 +26,7 @@ https://user-images.githubusercontent.com/3696783/126894061-a69eb6ad-9979-4723-a
[![View it on GitHub](./media/view_it_on_github_button.png)](https://github.com/lihop/godot-xterm) [![View it on GitHub](./media/view_it_on_github_button.png)](https://github.com/lihop/godot-xterm)
#### Table of Contents #### Table of Contents
1. [Features](#features) 1. [Features](#features)
2. [Screenshots](#screenshots) 2. [Screenshots](#screenshots)
3. [Demos and Examples](#demos-and-examples) 3. [Demos and Examples](#demos-and-examples)
@ -36,13 +38,15 @@ https://user-images.githubusercontent.com/3696783/126894061-a69eb6ad-9979-4723-a
## Features ## Features
- ### [Terminal](https://lihop.github.io/godot-xterm/api/terminal) - ### [Terminal](https://lihop.github.io/godot-xterm/api/terminal)
A Terminal emulator Control node. A Terminal emulator Control node.
Supports ANSI and (some) XTerm Control Sequences which can be used to do things such as clear the screen, move the cursor, change printed text color, ring a bell, and so on. Supports ANSI and (some) XTerm Control Sequences which can be used to do things such as clear the screen, move the cursor, change printed text color, ring a bell, and so on.
For an exhaustive list of terminal control sequences (not all of which are supported by GodotXterm) see ["XTerm Control Sequences"](https://invisible-island.net/xterm/ctlseqs/ctlseqs.html). For an exhaustive list of terminal control sequences (not all of which are supported by GodotXterm) see ["XTerm Control Sequences"](https://invisible-island.net/xterm/ctlseqs/ctlseqs.html).
- ### [PTY](https://lihop.github.io/godot-xterm/api/pty) - ### [PTY](https://lihop.github.io/godot-xterm/api/pty)
*Linux and macOS only.*
_Linux and macOS only._
Node for forking processes (e.g. bash, nodejs, python) with pseudoterminal file descriptors. Node for forking processes (e.g. bash, nodejs, python) with pseudoterminal file descriptors.
Can be used with the Terminal node to get an actual shell. Can be used with the Terminal node to get an actual shell.
@ -51,12 +55,14 @@ https://user-images.githubusercontent.com/3696783/126894061-a69eb6ad-9979-4723-a
See issue [\#25](https://github.com/lihop/godot-xterm/issues/25). See issue [\#25](https://github.com/lihop/godot-xterm/issues/25).
- ### Terminal Editor Plugin - ### Terminal Editor Plugin
*Linux and macOS only.*
_Linux and macOS only._
Adds a panel to the Editor's bottom panel that can be used to spawn terminals in the editor. Adds a panel to the Editor's bottom panel that can be used to spawn terminals in the editor.
Similar to VSCode's integrated terminal and IntelliJ's embedded terminal. Similar to VSCode's integrated terminal and IntelliJ's embedded terminal.
- ### Asciicast Import Plugin - ### Asciicast Import Plugin
Adds support for importing asciinema v2 `.cast` files as animations that can be played by an AnimationPlayer that is a child of a Terminal node. Adds support for importing asciinema v2 `.cast` files as animations that can be played by an AnimationPlayer that is a child of a Terminal node.
Example `.cast` files can be downloaded from the [asciinema website](https://asciinema.org). Example `.cast` files can be downloaded from the [asciinema website](https://asciinema.org).
@ -67,10 +73,10 @@ https://user-images.githubusercontent.com/3696783/126894061-a69eb6ad-9979-4723-a
## Screenshots ## Screenshots
| | | | | |
|--------------------------------------|--------------------------------------| | -------------------------------------- | -------------------------------------- |
|![](./media/screenshot_editor.png) |![](./media/screenshot_the_guest.png) | | ![](./media/screenshot_editor.png) | ![](./media/screenshot_the_guest.png) |
|![](./media/screenshot_retro_term.jpg)|![](./media/screenshot_xterminate.png)| | ![](./media/screenshot_retro_term.jpg) | ![](./media/screenshot_xterminate.png) |
## Demos and Examples ## Demos and Examples
@ -93,7 +99,7 @@ Are you using GodotXterm in your project and want it listed here? Please [open a
GodotXterm aims to support the current stable release of Godot, but may lag slightly. GodotXterm aims to support the current stable release of Godot, but may lag slightly.
Currently, Godot versions 3.5.x and 3.4.x are supported, but custom export templates Currently, Godot versions 3.5.x and 3.4.x are supported, but custom export templates
are required for HTML5 exports from versions < 3.5. are required for HTML5 exports from versions < 3.5.
Versions 3.3.x are no longer officially supported but *may* work if the GDNative libraries are Versions 3.3.x are no longer officially supported but _may_ work if the GDNative libraries are
compiled using an older version of godot-cpp. compiled using an older version of godot-cpp.
## Installation ## Installation
@ -122,10 +128,9 @@ The GDNative source code incorporates code snippets and source code from many th
- The Hack regular font is bundled with GodotXterm as the default Terminal font. This is also the default monospace font of the Godot editor. See the [full license](https://github.com/lihop/godot-xterm/blob/stable/addons/godot_xterm/themes/fonts/hack/LICENSE.md). - The Hack regular font is bundled with GodotXterm as the default Terminal font. This is also the default monospace font of the Godot editor. See the [full license](https://github.com/lihop/godot-xterm/blob/stable/addons/godot_xterm/themes/fonts/hack/LICENSE.md).
### Nonbundled Resources ### Nonbundled Resources
The following resources are not bundled with GodotXterm (i.e. are not included in the `addons/godot_xterm` directory) but are included in this repository for demo and testing purposes. They are:
The following resources are not bundled with GodotXterm (i.e. are not included in the `addons/godot_xterm` directory) but are included in this repository for demo and testing purposes. They are:
#### Sounds #### Sounds
@ -133,7 +138,7 @@ The following resources are not bundled with GodotXterm (i.e. are not included i
#### Fonts #### Fonts
- The **bold**, *italic*, and ***bold italic*** styles of the Hack font which are covered by the same license as above. - The **bold**, _italic_, and **_bold italic_** styles of the Hack font which are covered by the same license as above.
- Nerd Fonts. Combines symbols from a multitude of other fonts. See [license information](https://github.com/lihop/godot-xterm/blob/stable/themes/fonts/nerd_fonts/README.md). - Nerd Fonts. Combines symbols from a multitude of other fonts. See [license information](https://github.com/lihop/godot-xterm/blob/stable/themes/fonts/nerd_fonts/README.md).
- Noto Color Emoji. Released under the [SIL Open Font License](https://github.com/lihop/godot-xterm/blob/stable/themes/fonts/noto_color_emoji/LICENSE_OFL.txt). - Noto Color Emoji. Released under the [SIL Open Font License](https://github.com/lihop/godot-xterm/blob/stable/themes/fonts/noto_color_emoji/LICENSE_OFL.txt).
- Unifont. Dual-licensed (since version 13.0.04) under the GNU GPL 2+ with the GNU font embedding exception and the SIL Open Font License (OFL) version 1.1. This project uses it under the terms of the [SIL Open Font License](https://github.com/lihop/godot-xterm/blob/stable/themes/fonts/unifont/LICENSE_OFL-1.1.txt). - Unifont. Dual-licensed (since version 13.0.04) under the GNU GPL 2+ with the GNU font embedding exception and the SIL Open Font License (OFL) version 1.1. This project uses it under the terms of the [SIL Open Font License](https://github.com/lihop/godot-xterm/blob/stable/themes/fonts/unifont/LICENSE_OFL-1.1.txt).

View file

@ -1 +1,3 @@
#video-preview { display: none; } #video-preview {
display: none;
}

View file

@ -10,7 +10,7 @@ permalink: /api/pty
**Inherits:** [Node] < [Object] **Inherits:** [Node] < [Object]
*Linux and macOS only.* _Linux and macOS only._
Node for forking processes (e.g. bash, nodejs, python) with pseudoterminal file descriptors. Node for forking processes (e.g. bash, nodejs, python) with pseudoterminal file descriptors.
Can be used with the [Terminal] node to get an actual shell. Can be used with the [Terminal] node to get an actual shell.
@ -18,36 +18,32 @@ Can be used with the [Terminal] node to get an actual shell.
Not currently supported on Windows, but it could be in the future using [ConPTY](https://docs.microsoft.com/en-us/windows/console) or [WinPTY](https://github.com/rprichard/winpty). Not currently supported on Windows, but it could be in the future using [ConPTY](https://docs.microsoft.com/en-us/windows/console) or [WinPTY](https://github.com/rprichard/winpty).
See issue [\#25](https://github.com/lihop/godot-xterm/issues/25). See issue [\#25](https://github.com/lihop/godot-xterm/issues/25).
## Overview ## Overview
![PTY Diagram](../media/pty_diagram.png) ![PTY Diagram](../media/pty_diagram.png)
<sub>"PTY Diagram" is a derivative of [Termios-script-diagram.svg](https://commons.wikimedia.org/wiki/File:Termios-script-diagram.svg) by [Krishnavedala](https://en.wikipedia.org/wiki/User:Krishnavedala?rdfrom=commons:User:Krishnavedala), used under [CC0](https://creativecommons.org/share-your-work/public-domain/cc0/). <sub>"PTY Diagram" is a derivative of [Termios-script-diagram.svg](https://commons.wikimedia.org/wiki/File:Termios-script-diagram.svg) by [Krishnavedala](https://en.wikipedia.org/wiki/User:Krishnavedala?rdfrom=commons:User:Krishnavedala), used under [CC0](https://creativecommons.org/share-your-work/public-domain/cc0/).
## Properties ## Properties
| Type | Name | Default | | Type | Name | Default |
|--------------|--------------------------------------|--------------------------------------------------------| | ------------ | ------------------------------------ | ------------------------------------------------------ |
| [NodePath] | [terminal_path](#prop-terminal_path) | None | | [NodePath] | [terminal_path](#prop-terminal_path) | None |
| [int] | [cols](#prop-cols) | `80` | | [int] | [cols](#prop-cols) | `80` |
| [int] | [rows](#prop-rows) | `24` | | [int] | [rows](#prop-rows) | `24` |
| [Dictionary] | [env](#prop-env) | `{ COLORTERM = "truecolor", TERM = "xterm-256color" }` | | [Dictionary] | [env](#prop-env) | `{ COLORTERM = "truecolor", TERM = "xterm-256color" }` |
| [bool] | [use_os_env](#prop-use_os_env) | `true` | | [bool] | [use_os_env](#prop-use_os_env) | `true` |
## Methods ## Methods
| Returns | Signature | | Returns | Signature |
|---------|-------------------------------------------------------------------------------------------------------------------------------------| | ------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| [Error] | [fork](#mthd-fork) **(** [String] file=`$SHELL`, [PoolStringArray] args=[], [String] cwd=`$PWD`, [int] cols=80, [int] rows=24 **)** | | [Error] | [fork](#mthd-fork) **(** [String] file=`$SHELL`, [PoolStringArray] args=[], [String] cwd=`$PWD`, [int] cols=80, [int] rows=24 **)** |
| void | [kill](#mthd-kill) **(** [int] signum **)** | | void | [kill](#mthd-kill) **(** [int] signum **)** |
| [Error] | [open](#mthd-open) **(** [int] cols=80, [int] rows=24 **)** | | [Error] | [open](#mthd-open) **(** [int] cols=80, [int] rows=24 **)** |
| void | [resize](#mthd-resize) **(** [int] cols, [int] rows **)** | | void | [resize](#mthd-resize) **(** [int] cols, [int] rows **)** |
| void | [resizev](#mthd-resizev) **(** [Vector2] size **)** | | void | [resizev](#mthd-resizev) **(** [Vector2] size **)** |
| void | [write](#mthd-write) **(** [String]\|[PoolByteArray] data **)** | | void | [write](#mthd-write) **(** [String]\|[PoolByteArray] data **)** |
## Signals ## Signals
- <a name="sgnl-data_received" /> **data_received** **(** [PoolByteArray] data **)** - <a name="sgnl-data_received" /> **data_received** **(** [PoolByteArray] data **)**
@ -77,28 +73,27 @@ See issue [\#25](https://github.com/lihop/godot-xterm/issues/25).
- **SIGALRM** = 14 --- Alarm clock. - **SIGALRM** = 14 --- Alarm clock.
- **SIGTERM** = 15 --- Termination signal. - **SIGTERM** = 15 --- Termination signal.
## Property Descriptions ## Property Descriptions
### <a name="prop-terminal_path" /> [NodePath] **terminal_path** ### <a name="prop-terminal_path" /> [NodePath] **terminal_path**
| | | | | |
|-----------|--------------------------| | --------- | ------------------------ |
| *Default* | None | | _Default_ | None |
| *Setter* | set_terminal_path(value) | | _Setter_ | set_terminal_path(value) |
| *Getter* | None | | _Getter_ | None |
[NodePath] to a [Terminal]. Setting this path will automatically connect the appropriate signals of both nodes for standard operation. It will also disconnected the signals of the previously set terminal, if any. [NodePath] to a [Terminal]. Setting this path will automatically connect the appropriate signals of both nodes for standard operation. It will also disconnected the signals of the previously set terminal, if any.
--- ---
- <a name="prop-cols" /> [int] **cols** - <a name="prop-cols" /> [int] **cols**
| | | | | |
|-----------|--------------------------| | --------- | --------------- |
| *Default* | `80` | | _Default_ | `80` |
| *Setter* | set_cols(value) | | _Setter_ | set_cols(value) |
| *Getter* | None | | _Getter_ | None |
The column size in characters. The column size in characters.
@ -106,11 +101,11 @@ See issue [\#25](https://github.com/lihop/godot-xterm/issues/25).
- <a name="prop-rows" /> [int] **rows** - <a name="prop-rows" /> [int] **rows**
| | | | | |
|-----------|--------------------------| | --------- | --------------- |
| *Default* | `24` | | _Default_ | `24` |
| *Setter* | set_rows(value) | | _Setter_ | set_rows(value) |
| *Getter* | None | | _Getter_ | None |
The row size in characters. The row size in characters.
@ -119,10 +114,10 @@ See issue [\#25](https://github.com/lihop/godot-xterm/issues/25).
- <a name="prop-env" /> [Dictionary] **env** - <a name="prop-env" /> [Dictionary] **env**
| | | | | |
|-----------|--------------------------------------------------------| | --------- | ------------------------------------------------------ |
| *Default* | `{ COLORTERM = "truecolor", TERM = "xterm-256color" }` | | _Default_ | `{ COLORTERM = "truecolor", TERM = "xterm-256color" }` |
| *Setter* | None | | _Setter_ | None |
| *Getter* | None | | _Getter_ | None |
Environment variables to be set for the child program. Environment variables to be set for the child program.
@ -131,14 +126,13 @@ See issue [\#25](https://github.com/lihop/godot-xterm/issues/25).
- <a name="prop-use_os_env" /> [bool] **use_os_env** - <a name="prop-use_os_env" /> [bool] **use_os_env**
| | | | | |
|-----------|--------| | --------- | ------ |
| *Default* | `true` | | _Default_ | `true` |
| *Setter* | None | | _Setter_ | None |
| *Getter* | None | | _Getter_ | None |
If `true` the environment variables from `env` will be merged with the environment variables of the current program (i.e. Godot), with the variables from `env` taking precedence over the environment variables of the current program. If `true` the environment variables from `env` will be merged with the environment variables of the current program (i.e. Godot), with the variables from `env` taking precedence over the environment variables of the current program.
## Method Descriptions ## Method Descriptions
- <a name="mthd-fork" /> [Error] **fork** **(** [String] file=`$SHELL`, [PoolStringArray] args=[], [String] cwd=`$PWD`, [int] cols=80, [int] rows=24 **)** - <a name="mthd-fork" /> [Error] **fork** **(** [String] file=`$SHELL`, [PoolStringArray] args=[], [String] cwd=`$PWD`, [int] cols=80, [int] rows=24 **)**
@ -184,7 +178,6 @@ See issue [\#25](https://github.com/lihop/godot-xterm/issues/25).
Writes data to the pseudoterminal master device. Writes data to the pseudoterminal master device.
[Dictionary]: https://docs.godotengine.org/en/stable/classes/class_dictionary.html [Dictionary]: https://docs.godotengine.org/en/stable/classes/class_dictionary.html
[Error]: https://docs.godotengine.org/en/stable/classes/class_%40globalscope.html#enum-globalscope-error [Error]: https://docs.godotengine.org/en/stable/classes/class_%40globalscope.html#enum-globalscope-error
[Node]: https://docs.godotengine.org/en/stable/classes/class_node.html [Node]: https://docs.godotengine.org/en/stable/classes/class_node.html

View file

@ -15,8 +15,8 @@ A Terminal emulator Control node.
Supports ANSI and (some) XTerm Control Sequences which can be used to do things such as clear the screen, move the cursor, change printed text color, ring a bell, and so on. Supports ANSI and (some) XTerm Control Sequences which can be used to do things such as clear the screen, move the cursor, change printed text color, ring a bell, and so on.
For an exhaustive list of terminal control sequences (not all of which are supported by GodotXterm) see ["XTerm Control Sequences"](https://invisible-island.net/xterm/ctlseqs/ctlseqs.html). For an exhaustive list of terminal control sequences (not all of which are supported by GodotXterm) see ["XTerm Control Sequences"](https://invisible-island.net/xterm/ctlseqs/ctlseqs.html).
## Overview ## Overview
![Terminal Flow Diagram](../media/flow_diagram.svg) ![Terminal Flow Diagram](../media/flow_diagram.svg)
<sub>"Terminal Flow Diagram" is a derivative of ["computer keyboard 2"](https://openclipart.org/detail/2396/computer-keyboard-2) and ["monitor"](https://openclipart.org/detail/1637/monitor), from U.S. patent drawings, uploaded by [johnny_automatic](https://openclipart.org/artist/johnny_automatic), used under [CC0](https://creativecommons.org/share-your-work/public-domain/cc0/).<sub/> <sub>"Terminal Flow Diagram" is a derivative of ["computer keyboard 2"](https://openclipart.org/detail/2396/computer-keyboard-2) and ["monitor"](https://openclipart.org/detail/1637/monitor), from U.S. patent drawings, uploaded by [johnny_automatic](https://openclipart.org/artist/johnny_automatic), used under [CC0](https://creativecommons.org/share-your-work/public-domain/cc0/).<sub/>
@ -40,20 +40,18 @@ In the other direction, data can be sent to the terminal. This corresponds to th
The input from (3) is then interpreted by the terminal state machine and drawn to the screen. The input from (3) is then interpreted by the terminal state machine and drawn to the screen.
For example if the string `"\u001b[38;2;0;255;0;mA"` was written to the terminal, then it would draw a green colored capital letter 'A' on the screen. For example if the string `"\u001b[38;2;0;255;0;mA"` was written to the terminal, then it would draw a green colored capital letter 'A' on the screen.
## Properties ## Properties
| Type | Name | Default | | Type | Name | Default |
|--------------|--------------------------------------|---------| | ------------ | ------------------------------------ | ------- |
| [bool] | [bell_muted](#prop-bell_muted) | `false` | | [bool] | [bell_muted](#prop-bell_muted) | `false` |
| [float] | [bell_cooldown](#prop-bell_cooldown) | `0.1` | | [float] | [bell_cooldown](#prop-bell_cooldown) | `0.1` |
| [UpdateMode] | [update_mode](#prop-update_mode) | `AUTO` | | [UpdateMode] | [update_mode](#prop-update_mode) | `AUTO` |
## Methods ## Methods
| Returns | Signature | | Returns | Signature |
|----------|-------------------------------------------------------------------| | -------- | ----------------------------------------------------------------- |
| void | [clear](#mthd-clear) **()** | | void | [clear](#mthd-clear) **()** |
| [String] | [copy_all](#mthd-copy_all) **()** | | [String] | [copy_all](#mthd-copy_all) **()** |
| [String] | [copy_selection](#mthd-copy_selection) **()** | | [String] | [copy_selection](#mthd-copy_selection) **()** |
@ -61,7 +59,6 @@ For example if the string `"\u001b[38;2;0;255;0;mA"` was written to the terminal
| [int] | [get_rows](#mthd-get_rows) **()** | | [int] | [get_rows](#mthd-get_rows) **()** |
| void | [write](#mthd-write) **(** [String] \| [PoolByteArray] data **)** | | void | [write](#mthd-write) **(** [String] \| [PoolByteArray] data **)** |
## Signals ## Signals
- <a name="sgnl-bell" /> **bell** **()** - <a name="sgnl-bell" /> **bell** **()**
@ -92,27 +89,24 @@ For example if the string `"\u001b[38;2;0;255;0;mA"` was written to the terminal
`new_size.x` will be the number of columns and `new_size.y` will be the number of rows. `new_size.x` will be the number of columns and `new_size.y` will be the number of rows.
This information should be forwarded to a pseudoterminal, if it is connected, so that it can update its size accordingly. This information should be forwarded to a pseudoterminal, if it is connected, so that it can update its size accordingly.
## Enumerations ## Enumerations
<a name="enum-update_mode" /> enum **UpdateMode**: <a name="enum-update_mode" /> enum **UpdateMode**:
- **DISABLED** = **0** --- The terminal's `update()` method will never be called. No new cells will be drawn. - **DISABLED** = **0** --- The terminal's `update()` method will never be called. No new cells will be drawn.
- **AUTO** = **1** --- Only changed cells will be drawn after `update()` is called, but will switch to **ALL_NEXT_FRAME** when mass redraws are required. - **AUTO** = **1** --- Only changed cells will be drawn after `update()` is called, but will switch to **ALL_NEXT_FRAME** when mass redraws are required.
- **ALL** = **2** --- Every cell will be drawn on every `update()` call. - **ALL** = **2** --- Every cell will be drawn on every `update()` call.
- **ALL_NEXT_FRAME** = **3** --- Draws every cell afetr the next `update()` call, then returns to **AUTO**. - **ALL_NEXT_FRAME** = **3** --- Draws every cell afetr the next `update()` call, then returns to **AUTO**.
## Property Descriptions ## Property Descriptions
- <a name="prop-bell_muted" /> [bool] **bell_muted** - <a name="prop-bell_muted" /> [bool] **bell_muted**
| | | | | |
|-----------|---------| | --------- | ------- |
| *Default* | `false` | | _Default_ | `false` |
| *Setter* | None | | _Setter_ | None |
| *Getter* | None | | _Getter_ | None |
If muted, no [`bell`](#sgnl-bell) signal will be emitted when the bell character (`"\u0007"`) is written to the terminal. If muted, no [`bell`](#sgnl-bell) signal will be emitted when the bell character (`"\u0007"`) is written to the terminal.
@ -121,10 +115,10 @@ For example if the string `"\u001b[38;2;0;255;0;mA"` was written to the terminal
- <a name="prop-bell_cooldown" /> [float] **bell_cooldown** - <a name="prop-bell_cooldown" /> [float] **bell_cooldown**
| | | | | |
|-----------|-------| | --------- | ----- |
| *Default* | `0.1` | | _Default_ | `0.1` |
| *Setter* | None | | _Setter_ | None |
| *Getter* | None | | _Getter_ | None |
The minimum amount of time to wait before emitting another [`bell`](#sgnl-bell) signal on subsequent writes of the bell character. The minimum amount of time to wait before emitting another [`bell`](#sgnl-bell) signal on subsequent writes of the bell character.
Writing the bell character too frequently, for example by running the command `while true; do echo -e "\a"; done`, Writing the bell character too frequently, for example by running the command `while true; do echo -e "\a"; done`,
@ -136,17 +130,16 @@ For example if the string `"\u001b[38;2;0;255;0;mA"` was written to the terminal
- <a name="prop-update_mode" /> [UpdateMode] **update_mode** - <a name="prop-update_mode" /> [UpdateMode] **update_mode**
| | | | | |
|-----------|------------------------| | --------- | ---------------------- |
| *Default* | `AUTO` | | _Default_ | `AUTO` |
| *Setter* | set_update_mode(value) | | _Setter_ | set_update_mode(value) |
| *Getter* | None | | _Getter_ | None |
Determines which cells of the terminal will be updated when its state changes. Determines which cells of the terminal will be updated when its state changes.
By default `AUTO` will only update cells that changed, but will update all cells (i.e. the entire screen) on major changes, By default `AUTO` will only update cells that changed, but will update all cells (i.e. the entire screen) on major changes,
such as terminal resize. such as terminal resize.
If you are having trouble with the terminal not updating correctly or exhibiting artifacts, you can try remedying this by setting `update_mode` to `ALL`, however, this will have a negative impact on performance. If you are having trouble with the terminal not updating correctly or exhibiting artifacts, you can try remedying this by setting `update_mode` to `ALL`, however, this will have a negative impact on performance.
## Method Descriptions ## Method Descriptions
- <a name="mthd-clear" /> void **clear** **()** - <a name="mthd-clear" /> void **clear** **()**
@ -190,6 +183,7 @@ For example if the string `"\u001b[38;2;0;255;0;mA"` was written to the terminal
Typically it would be connected to the output of a [PTY]'s [`data_received()`](/api/pty#sgnl-data_received) signal. Typically it would be connected to the output of a [PTY]'s [`data_received()`](/api/pty#sgnl-data_received) signal.
Example: Example:
```gdscript ```gdscript
$Terminal.write("Hello World") $Terminal.write("Hello World")
$Terminal.write("Hello World".to_utf8()) $Terminal.write("Hello World".to_utf8())

View file

@ -27,10 +27,12 @@ This plugin follows the same format as the [GDNative C++ Example](https://docs.g
## The Easy Way ## The Easy Way
Run the build script in `addons/godot-xterm/native`: Run the build script in `addons/godot-xterm/native`:
``` ```
cd addons/godot_xterm/native cd addons/godot_xterm/native
./build.sh ./build.sh
``` ```
On Windows you can use `git-bash` to run this script. On Windows you can use `git-bash` to run this script.
Provided the dependencies above are installed then it should "just work™". Provided the dependencies above are installed then it should "just work™".

View file

@ -7,6 +7,7 @@ permalink: /setup/precompiled-binaries
--- ---
# Precompiled Binaries # Precompiled Binaries
{: .no_toc } {: .no_toc }
Installing GodotXterm using precompiled binaries means that you wont be required Installing GodotXterm using precompiled binaries means that you wont be required
@ -15,7 +16,7 @@ of copying files to the correct location in your project. These files can be
installed from several sources: installed from several sources:
1. TOC 1. TOC
{:toc} {:toc}
**Note:** precompiled binaries will only work with certain versions of Godot **Note:** precompiled binaries will only work with certain versions of Godot
(usually the current stable release). If you need binaries for a different or (usually the current stable release). If you need binaries for a different or
@ -23,26 +24,33 @@ custom Godot version, or want to make modifications to the C/C++ code, please
refer to the section on [Building From Source](/setup/building-from-source). refer to the section on [Building From Source](/setup/building-from-source).
## Godot Asset Library ## Godot Asset Library
GodotXterm can be installed from the [Godot Asset Library](https://godotengine.org/asset-library/asset/1007). GodotXterm can be installed from the [Godot Asset Library](https://godotengine.org/asset-library/asset/1007).
See the [Godot Asset Library documentation](https://docs.godotengine.org/en/stable/community/asset_library/using_assetlib.html) for more info on how to use it. See the [Godot Asset Library documentation](https://docs.godotengine.org/en/stable/community/asset_library/using_assetlib.html) for more info on how to use it.
## Gd-plug Plugin Manager ## Gd-plug Plugin Manager
If you are using the gd-plug plugin manager you can add the following line to your `plug.gd` file: If you are using the gd-plug plugin manager you can add the following line to your `plug.gd` file:
``` ```
plug("lihop/godot-xterm-dist", {commit = "a1131a562e8e8f0c57b0ddf61de7fa015d463ba0", include = ["addons/godot_xterm"]}) plug("lihop/godot-xterm-dist", {commit = "a1131a562e8e8f0c57b0ddf61de7fa015d463ba0", include = ["addons/godot_xterm"]})
``` ```
Replace the commit hash with the hash of the GodotXterm version you wish to install. Replace the commit hash with the hash of the GodotXterm version you wish to install.
See [tags](https://github.com/lihop/godot-xterm-dist/tags) for a list of versions and their corresponding commit hashes. See [tags](https://github.com/lihop/godot-xterm-dist/tags) for a list of versions and their corresponding commit hashes.
See the [gd-plug documentation](https://github.com/imjp94/gd-plug/blob/master/README.md) for more info on how to use it. See the [gd-plug documentation](https://github.com/imjp94/gd-plug/blob/master/README.md) for more info on how to use it.
## Manual Installation ## Manual Installation
Alternatively, GodotXterm can be installed manually in two steps: Alternatively, GodotXterm can be installed manually in two steps:
1. Copy the [`addons/godot_xterm`](https://github.com/lihop/godot-xterm/tree/stable/addons/godot_xterm) directory to the `addons` directory of your Godot project. 1. Copy the [`addons/godot_xterm`](https://github.com/lihop/godot-xterm/tree/stable/addons/godot_xterm) directory to the `addons` directory of your Godot project.
2. Copy the GDNative binaries into `addons/godot_xterm/native/bin` directory. 2. Copy the GDNative binaries into `addons/godot_xterm/native/bin` directory.
The easiest way to obtain the GDNative binaries is to download them from [the Releases page](https://github.com/lihop/godot-xterm/releases). The easiest way to obtain the GDNative binaries is to download them from [the Releases page](https://github.com/lihop/godot-xterm/releases).
Download the zip archive named `libgodot-xterm-release.zip` and extract its contents into the `/addons/godot_xterm/native/bin` directory of your project. Download the zip archive named `libgodot-xterm-release.zip` and extract its contents into the `/addons/godot_xterm/native/bin` directory of your project.
After this your `addons/godot_xterm/native/bin` directory should contain the following files: After this your `addons/godot_xterm/native/bin` directory should contain the following files:
- `libgodot-xterm.javascript.32.wasm` - `libgodot-xterm.javascript.32.wasm`
- `libgodot-xterm.linux.32.so` - `libgodot-xterm.linux.32.so`
- `libgodot-xterm.linux.64.so` - `libgodot-xterm.linux.64.so`

View file

@ -1,88 +1,80 @@
{ {
// Use IntelliSense to learn about possible attributes. // Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes. // Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0", "version": "0.2.0",
"configurations": [ "configurations": [
{
"name": "Main (gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "/run/current-system/sw/bin/godot",
"args": ["${workspaceFolder}/examples/menu/menu.tscn"],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{ {
"name": "Main (gdb) Launch", "description": "Enable pretty-printing for gdb",
"type": "cppdbg", "text": "-enable-pretty-printing",
"request": "launch", "ignoreFailures": true
"program": "/run/current-system/sw/bin/godot",
"args": [
"${workspaceFolder}/examples/menu/menu.tscn",
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true,
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true,
},
],
}, },
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
},
{
"name": "Editor (gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "/run/current-system/sw/bin/godot",
"args": ["--editor"],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{ {
"name": "Editor (gdb) Launch", "description": "Enable pretty-printing for gdb",
"type": "cppdbg", "text": "-enable-pretty-printing",
"request": "launch", "ignoreFailures": true
"program": "/run/current-system/sw/bin/godot",
"args": [
"--editor",
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true,
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true,
},
{
"description": "Debug forked child process",
"text": "-gdb-set follow-fork-mode child",
},
],
}, },
{ {
"name": "Test (gdb) Launch", "description": "Set Disassembly Flavor to Intel",
"type": "cppdbg", "text": "-gdb-set disassembly-flavor intel",
"request": "launch", "ignoreFailures": true
"program": "/run/current-system/sw/bin/godot",
"args": [
"--no-window",
"-s",
"addons/gut/gut_cmdln.gd"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true,
},
],
}, },
], {
"description": "Debug forked child process",
"text": "-gdb-set follow-fork-mode child"
}
]
},
{
"name": "Test (gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "/run/current-system/sw/bin/godot",
"args": ["--no-window", "-s", "addons/gut/gut_cmdln.gd"],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
} }

View file

@ -1,23 +1,23 @@
{ {
"editor.formatOnSave": true, "editor.formatOnSave": true,
"clang-format.executable": "/run/current-system/sw/bin/clang-format", "clang-format.executable": "/run/current-system/sw/bin/clang-format",
"gut-extension.additionalOptions": "-d --no-window", "gut-extension.additionalOptions": "-d --no-window",
"nixEnvSelector.nixShellConfig": "NOT_MODIFIED_ENV", "nixEnvSelector.nixShellConfig": "NOT_MODIFIED_ENV",
"files.associations": { "files.associations": {
"array": "cpp", "array": "cpp",
"istream": "cpp", "istream": "cpp",
"limits": "cpp", "limits": "cpp",
"numeric": "cpp", "numeric": "cpp",
"sstream": "cpp", "sstream": "cpp",
"streambuf": "cpp", "streambuf": "cpp",
"utility": "cpp", "utility": "cpp",
"optional": "cpp", "optional": "cpp",
"ostream": "cpp", "ostream": "cpp",
"ratio": "cpp", "ratio": "cpp",
"system_error": "cpp", "system_error": "cpp",
"functional": "cpp", "functional": "cpp",
"tuple": "cpp", "tuple": "cpp",
"type_traits": "cpp", "type_traits": "cpp",
"*.inc": "cpp" "*.inc": "cpp"
} }
} }

View file

@ -1,24 +1,17 @@
{ {
// See https://go.microsoft.com/fwlink/?LinkId=733558 // See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format // for the documentation about the tasks.json format
"version": "2.0.0", "version": "2.0.0",
"tasks": [ "tasks": [
{ {
"label": "build", "label": "build",
"type": "shell", "type": "shell",
"options": { "options": {
"cwd": "${workspaceFolder}/addons/godot_xterm/native", "cwd": "${workspaceFolder}/addons/godot_xterm/native"
}, },
"command": "nix-shell", "command": "nix-shell",
"args": [ "args": ["-I", "nixpkgs=~/nixpkgs", "-p", "scons", "--run", "./build.sh"],
"-I", "problemMatcher": []
"nixpkgs=~/nixpkgs", }
"-p", ]
"scons",
"--run",
"./build.sh"
],
"problemMatcher": []
}
]
} }

View file

@ -1,8 +1,5 @@
{ {
"dirs": [ "dirs": ["res://test/unit", "res://test/integration"],
"res://test/unit",
"res://test/integration"
],
"prefix": "", "prefix": "",
"suffix": ".test.gd", "suffix": ".test.gd",
"include_subdirs": true, "include_subdirs": true,

View file

@ -1,7 +1,5 @@
{ {
"dirs": [ "dirs": ["res://test/platform/unix"],
"res://test/platform/unix"
],
"prefix": "", "prefix": "",
"suffix": ".test.gd", "suffix": ".test.gd",
"include_subdirs": true, "include_subdirs": true,

View file

@ -1,11 +1,8 @@
{ {
"dirs": [ "dirs": ["res://platform/windows"],
"res://platform/windows"
],
"prefix": "", "prefix": "",
"suffix": ".test.gd", "suffix": ".test.gd",
"include_subdirs": true, "include_subdirs": true,
"log_level": 2, "log_level": 2,
"should_exit": true "should_exit": true
} }
}

View file

@ -1,5 +1,5 @@
const { defineConfig } = require("cypress"); const { defineConfig } = require("cypress");
const getCompareSnapshotsPlugin = require('cypress-image-diff-js/dist/plugin'); const getCompareSnapshotsPlugin = require("cypress-image-diff-js/dist/plugin");
module.exports = defineConfig({ module.exports = defineConfig({
e2e: { e2e: {

View file

@ -1,21 +1,23 @@
Cypress.on('window:before:load', win => { Cypress.on("window:before:load", (win) => {
cy.spy(win.console, 'error') cy.spy(win.console, "error");
cy.spy(win.console, 'warn') cy.spy(win.console, "warn");
cy.spy(win.console, 'log') cy.spy(win.console, "log");
}) });
describe('GodotXterm HTML5 export', () => { describe("GodotXterm HTML5 export", () => {
it('Loads and runs without error', () => { it("Loads and runs without error", () => {
cy.visit('http://localhost:3000') cy.visit("http://localhost:3000");
cy.compareSnapshot('menu', 0.9, { cy.compareSnapshot("menu", 0.9, {
limit: 100, delay: 200, timeout: 20000, limit: 100,
}) delay: 200,
cy.get('body').type('{downArrow}{enter}') timeout: 20000,
cy.get('body').type('window.console.log("It works!"){enter}') });
cy.window().then(win => { cy.get("body").type("{downArrow}{enter}");
cy.expect(win.console.error).to.have.callCount(0) cy.get("body").type('window.console.log("It works!"){enter}');
cy.expect(win.console.warn).to.have.callCount(0) cy.window().then((win) => {
cy.expect(win.console.log).to.be.calledWith("It works!") cy.expect(win.console.error).to.have.callCount(0);
}) cy.expect(win.console.warn).to.have.callCount(0);
}) cy.expect(win.console.log).to.be.calledWith("It works!");
}) });
});
});

View file

@ -1,2 +1,2 @@
import compareSnapshotCommand from 'cypress-image-diff-js/dist/command'; import compareSnapshotCommand from "cypress-image-diff-js/dist/command";
compareSnapshotCommand(); compareSnapshotCommand();

View file

@ -1 +1 @@
import './commands' import "./commands";