glimmer-dsl-libui 0.10.1 → 0.10.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -1
- data/README.md +2 -3
- data/VERSION +1 -1
- data/examples/snake/model/snake.rb +43 -17
- data/examples/snake.rb +6 -2
- data/glimmer-dsl-libui.gemspec +0 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a37cb8210f604b9307693af84b47ba0e21cf2a2b1059139af1d4ffa2eb727bf8
|
4
|
+
data.tar.gz: 88443d069ff718e8d28c90dbb59fc6ff5e5a05a5f3e9f5be78418d1754868769
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a2e8c3f162744fe2266d66a088bceb7595b04643a141b0dd526309b6155362e24fad6c760cc8eb060030fec35352ab96b9dfad7e601e5a168271e1150aa7789
|
7
|
+
data.tar.gz: 90674bbf9623bcd0e985a94824698c3117a8a70bea79f7ee81d11364054c70d57f260466123717d2f292aa50f113cfb11201580a3f74bc74400a100f9c049d6d
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.10.2
|
4
|
+
|
5
|
+
- In Snake example, change snake direction on key press instead of key release to be more responsive for players who are not used to releasing pressed keys quickly
|
6
|
+
- In Snake example, fix issue with detecting collision too soon if a snake fills the entire space horizontally or vertically
|
7
|
+
- In Snake example, fix issue of hearing beeps on every direction change because of not properly informing LibUI when the area key down event is handled
|
8
|
+
- In Snake example, refactor `Snake::Model::Snake` to be more readable like high-level game domain rules (especially `move` method)
|
9
|
+
|
3
10
|
## 0.10.1
|
4
11
|
|
5
12
|
- Scaffold custom shape
|
@@ -8,7 +15,7 @@
|
|
8
15
|
|
9
16
|
## 0.10.0
|
10
17
|
|
11
|
-
- Support Custom Shapes
|
18
|
+
- Support Custom Shapes by mixing in `Glimmer::LibUI::CustomShape` to abstract composite shapes/text/image concepts inside an `area`
|
12
19
|
- `examples/basic_custom_shape.rb` example
|
13
20
|
- Support nesting listeners under a Custom Shape that will automatically get added to its `body_root` control
|
14
21
|
- Support nesting listeners under a Custom Control that will automatically get added to its `body_root` control
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for LibUI 0.10.
|
1
|
+
# [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for LibUI 0.10.2
|
2
2
|
## Prerequisite-Free Ruby Desktop Development Cross-Platform Native GUI Library ([Fukuoka Award Winning](http://www.digitalfukuoka.jp/topics/187?locale=ja))
|
3
3
|
### The Quickest Way From Zero To GUI
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/glimmer-dsl-libui.svg)](http://badge.fury.io/rb/glimmer-dsl-libui)
|
@@ -431,7 +431,7 @@ gem install glimmer-dsl-libui
|
|
431
431
|
Or install via Bundler `Gemfile`:
|
432
432
|
|
433
433
|
```ruby
|
434
|
-
gem 'glimmer-dsl-libui', '~> 0.10.
|
434
|
+
gem 'glimmer-dsl-libui', '~> 0.10.2'
|
435
435
|
```
|
436
436
|
|
437
437
|
Test that installation worked by running the [Glimmer Meta-Example](#examples):
|
@@ -548,7 +548,6 @@ glimmer
|
|
548
548
|
```
|
549
549
|
|
550
550
|
```
|
551
|
-
% bin/glimmer
|
552
551
|
Glimmer DSL for LibUI (Prerequisite-Free Ruby Desktop Development Cross-Platform Native GUI Library) - Ruby Gem: glimmer-dsl-libui v0.8.0
|
553
552
|
|
554
553
|
Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-ruby-option]...] (application.rb or task[task_args])
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.10.
|
1
|
+
0.10.2
|
@@ -47,10 +47,33 @@ class Snake
|
|
47
47
|
self.joins.clear
|
48
48
|
end
|
49
49
|
|
50
|
+
def turn_right
|
51
|
+
head.orientation = RIGHT_TURN_MAP[head.orientation]
|
52
|
+
end
|
53
|
+
|
54
|
+
def turn_left
|
55
|
+
head.orientation = LEFT_TURN_MAP[head.orientation]
|
56
|
+
end
|
57
|
+
|
50
58
|
def move
|
51
|
-
|
59
|
+
create_new_head
|
60
|
+
remove_old_tail
|
61
|
+
if detect_collision?
|
62
|
+
collide_and_die
|
63
|
+
else
|
64
|
+
append_new_head
|
65
|
+
eat_apple if detect_apple?
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def remove_old_tail
|
70
|
+
@old_tail = tail.dup # save in case of growing and keeping old tail
|
71
|
+
@vertebrae.delete(tail)
|
72
|
+
end
|
73
|
+
|
74
|
+
def create_new_head
|
52
75
|
@new_head = head.dup
|
53
|
-
case
|
76
|
+
case head.orientation
|
54
77
|
when :east
|
55
78
|
@new_head.column = (@new_head.column + 1) % @game.width
|
56
79
|
when :west
|
@@ -60,25 +83,28 @@ class Snake
|
|
60
83
|
when :north
|
61
84
|
@new_head.row = (@new_head.row - 1) % @game.height
|
62
85
|
end
|
63
|
-
if @vertebrae.map {|v| [v.row, v.column]}.include?([@new_head.row, @new_head.column])
|
64
|
-
self.collided = true
|
65
|
-
@game.over = true
|
66
|
-
else
|
67
|
-
@vertebrae.append(@new_head)
|
68
|
-
@vertebrae.delete(tail)
|
69
|
-
if head.row == @game.apple.row && head.column == @game.apple.column
|
70
|
-
grow
|
71
|
-
@game.apple.generate
|
72
|
-
end
|
73
|
-
end
|
74
86
|
end
|
75
87
|
|
76
|
-
def
|
77
|
-
|
88
|
+
def append_new_head
|
89
|
+
@vertebrae.append(@new_head)
|
78
90
|
end
|
79
91
|
|
80
|
-
def
|
81
|
-
|
92
|
+
def detect_collision?
|
93
|
+
@vertebrae.map {|v| [v.row, v.column]}.include?([@new_head.row, @new_head.column])
|
94
|
+
end
|
95
|
+
|
96
|
+
def collide_and_die
|
97
|
+
self.collided = true
|
98
|
+
@game.over = true
|
99
|
+
end
|
100
|
+
|
101
|
+
def detect_apple?
|
102
|
+
head.row == @game.apple.row && head.column == @game.apple.column
|
103
|
+
end
|
104
|
+
|
105
|
+
def eat_apple
|
106
|
+
grow
|
107
|
+
@game.apple.generate
|
82
108
|
end
|
83
109
|
|
84
110
|
def grow
|
data/examples/snake.rb
CHANGED
@@ -72,12 +72,16 @@ class Snake
|
|
72
72
|
fill <= [@grid.cells[row][column], :color] # data-bind square fill to grid cell color
|
73
73
|
}
|
74
74
|
|
75
|
-
|
75
|
+
on_key_down do |area_key_event|
|
76
|
+
handled = true # assume we will handle the event
|
76
77
|
if area_key_event[:key] == ' '
|
77
78
|
@game.toggle_pause
|
78
|
-
|
79
|
+
elsif %i[up right down left].include?(area_key_event[:ext_key])
|
79
80
|
@keypress_queue << area_key_event[:ext_key]
|
81
|
+
else
|
82
|
+
handled = false # we won't handle the event after all
|
80
83
|
end
|
84
|
+
handled
|
81
85
|
end
|
82
86
|
}
|
83
87
|
end
|
data/glimmer-dsl-libui.gemspec
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer-dsl-libui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Maleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-10-
|
11
|
+
date: 2023-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: glimmer
|