chess_tui 0.41.4 → 0.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +5 -5
- data/lib/chess/mouse/mouse_input.rb +12 -5
- data/lib/chess/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '0931a7e54a726d77f7363254da08b9a8d91664a3b38f5eb7dfd1d267d4ce18ca'
|
|
4
|
+
data.tar.gz: 7a0000a3faf6ff246bde73bca97ea4cc8c5800efc6275b3c6d252da9c216d1a0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 71df83c5b53f659bf11180ae767d08bf8d1384fbd7f09a3231b49b36d7653dd9629ad3d09c9dbec5d82c635ead084478ae3511906ff2e85d7f38dd85023fff9d
|
|
7
|
+
data.tar.gz: 71d09b306fa75bba218874de9a783f60560bb445f3c22be91999b639aa9212f06ad8691726a107bedbc8b02fdd7a33d741bfee97d142fc40ac5e151f7d71b7ef
|
data/README.md
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
[](https://github.com/XAJX179/Chess/actions/workflows/tests.yml)
|
|
8
8
|
[](https://github.com/XAJX179/Chess/actions/workflows/rubocop.yml)
|
|
9
9
|
|
|
10
|
+
<https://github.com/user-attachments/assets/180d563f-16d9-4f26-9b3a-c16bb66271a2>
|
|
11
|
+
|
|
10
12
|
## About
|
|
11
13
|
|
|
12
14
|
Chess game with terminal ui and mouse click support,
|
|
@@ -14,7 +16,9 @@
|
|
|
14
16
|
|
|
15
17
|
## Install
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
> [!IMPORTANT]
|
|
20
|
+
> pre-requisite: ruby >= 3.2
|
|
21
|
+
> a terminal which supports xterm ctrl sequences (tested on xfce terminal)
|
|
18
22
|
|
|
19
23
|
```bash
|
|
20
24
|
gem install chess_tui
|
|
@@ -33,7 +37,3 @@ gem uninstall chess_tui
|
|
|
33
37
|
## 🫣 Peek
|
|
34
38
|
|
|
35
39
|

|
|
36
|
-
|
|
37
|
-
showcase video -
|
|
38
|
-
|
|
39
|
-
<https://github.com/user-attachments/assets/180d563f-16d9-4f26-9b3a-c16bb66271a2>
|
|
@@ -27,13 +27,15 @@ module Chess
|
|
|
27
27
|
# enable the mouse tracking using xterm control sequences -
|
|
28
28
|
# https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking
|
|
29
29
|
def enable_mouse_tracking
|
|
30
|
-
print "\e[?
|
|
30
|
+
print "\e[?1000h" # Enable normal mouse tracking
|
|
31
|
+
print "\e[?1006h" # Enable SGR mouse tracking
|
|
31
32
|
end
|
|
32
33
|
|
|
33
34
|
# disable the mouse tracking using xterm control sequences -
|
|
34
35
|
# https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking
|
|
35
36
|
def disable_mouse_tracking
|
|
36
|
-
print "\e[?
|
|
37
|
+
print "\e[?1006l" # Disable SGR mouse tracking
|
|
38
|
+
print "\e[?1000l" # Disable normal mouse tracking
|
|
37
39
|
end
|
|
38
40
|
|
|
39
41
|
# runs loop for mouse input
|
|
@@ -57,9 +59,14 @@ module Chess
|
|
|
57
59
|
# @param char [Char]
|
|
58
60
|
# @return [Array(x,y)]
|
|
59
61
|
def read_input(char)
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
sequence
|
|
62
|
+
sequence = char + $stdin.read(17)
|
|
63
|
+
# storing anything left out here
|
|
64
|
+
sequence += $stdin.getc while $stdin.ready?
|
|
65
|
+
input = sequence.split(';')
|
|
66
|
+
x = input[1].to_i
|
|
67
|
+
# for y the to_i will only take the first number from e.g "34M[0;12;0" ignoring everything after the first non Integer
|
|
68
|
+
y = input[2].to_i
|
|
69
|
+
[x, y]
|
|
63
70
|
end
|
|
64
71
|
|
|
65
72
|
# read what was clicked
|
data/lib/chess/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: chess_tui
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.42.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- X_AJ_X
|
|
@@ -24,7 +24,9 @@ dependencies:
|
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
25
|
version: 0.23.1
|
|
26
26
|
description: |-
|
|
27
|
-
Chess game with terminal UI written in ruby,
|
|
27
|
+
Chess game with terminal UI written in ruby,
|
|
28
|
+
prerequisite: a terminal which supports xterm ctrl sequences. (tested on xfce terminal)
|
|
29
|
+
check out docs: https://xajx179.github.io/Chess
|
|
28
30
|
& source: https://github.com/XAJX179/Chess
|
|
29
31
|
email:
|
|
30
32
|
- xajx179@gmail.com
|