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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4ffa182999d0b42056132dfbd562068e4761d5a1f90b66351a9dc04b280c5c0a
4
- data.tar.gz: 719c2048abb1e1826ab7abb1b389a5373bc7751b3f6ddbb0fad22abc5ab22e62
3
+ metadata.gz: '0931a7e54a726d77f7363254da08b9a8d91664a3b38f5eb7dfd1d267d4ce18ca'
4
+ data.tar.gz: 7a0000a3faf6ff246bde73bca97ea4cc8c5800efc6275b3c6d252da9c216d1a0
5
5
  SHA512:
6
- metadata.gz: c555796aa4b5dd6a116174465ec178be2993e747663db5a7fd339f420e64201c5b2cf2c9d2224d8f32fd910d03bc7e252dfc76ff43e846a746f46106249367b8
7
- data.tar.gz: 1de74e7fb8aab8a626f228250d84c4065608f5b6a422127d54438dfc496ae11f8e79cfc1e86f8feb126f37606f8cc058dcbd2fdc4c078e8159913f56ac93ba5c
6
+ metadata.gz: 71df83c5b53f659bf11180ae767d08bf8d1384fbd7f09a3231b49b36d7653dd9629ad3d09c9dbec5d82c635ead084478ae3511906ff2e85d7f38dd85023fff9d
7
+ data.tar.gz: 71d09b306fa75bba218874de9a783f60560bb445f3c22be91999b639aa9212f06ad8691726a107bedbc8b02fdd7a33d741bfee97d142fc40ac5e151f7d71b7ef
data/README.md CHANGED
@@ -7,6 +7,8 @@
7
7
  [![Ruby Test](https://github.com/XAJX179/Chess/actions/workflows/tests.yml/badge.svg)](https://github.com/XAJX179/Chess/actions/workflows/tests.yml)
8
8
  [![Rubocop](https://github.com/XAJX179/Chess/actions/workflows/rubocop.yml/badge.svg)](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
- pre-requisite: ruby >= 3.2
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
  ![screenshot](https://raw.githubusercontent.com/XAJX179/Chess/refs/heads/main/docs/images/chess_tui_screenshot.png)
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[?9h" # Enable X10 mouse tracking
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[?9l" # Disable X10 mouse tracking
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
- shift = 32
61
- sequence = char + $stdin.read(5) # Read the full ESC [ M SPACE Cx Cy stored in buffer
62
- sequence.bytes[4..].map { |e| e - shift } # shift and return the Cx Cy only
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
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Chess
4
4
  # VERSION following https://semver.org
5
- VERSION = '0.41.4'
5
+ VERSION = '0.42.0'
6
6
  end
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.41.4
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, check out docs: https://xajx179.github.io/Chess \
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