SDLRuby 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/SDLRuby/event.rb +9 -6
- data/lib/SDLRuby/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20bdcc86d9ea3a4670b1f0ac86689d0cae12f51417d9ba92cc710be1ecab8614
|
4
|
+
data.tar.gz: 3869b91b982b18fe37c5dc97a4b7e99b9f42e2266b42957fa31632ce79bb3447
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0c6372d9db1be4ffaa5ff4af4aba575d74d3c36682da3df5423c30fcde44c6986ebcd1b3c8d8e37a909148308922a98436cfba53ad75fcd91d6e84407d275bf
|
7
|
+
data.tar.gz: fa71f7889d06990aed6fd43d8bd09573ca6900a7d7223ce513d0a47830610cc95f49a0883854d5d4670ccd7a67ca2e72576cf026298ad6bc94b08e70aecd2e6e
|
data/CHANGELOG.md
CHANGED
data/lib/SDLRuby/event.rb
CHANGED
@@ -6,9 +6,9 @@ module SDLRuby
|
|
6
6
|
include Accessor, Fiddle, SDL
|
7
7
|
|
8
8
|
class << self
|
9
|
-
include SDL
|
9
|
+
include Fiddle, SDL
|
10
10
|
|
11
|
-
private def __malloc__ =
|
11
|
+
private def __malloc__ = Pointer.malloc(SDL_Event.size, RUBY_FREE)
|
12
12
|
|
13
13
|
def clear = SDL.SDL_FlushEvents(SDL_FIRSTEVENT, SDL_LASTEVENT)
|
14
14
|
|
@@ -43,8 +43,11 @@ module SDLRuby
|
|
43
43
|
end
|
44
44
|
|
45
45
|
e = __malloc__
|
46
|
-
SDL.SDL_WaitEvent(e)
|
47
|
-
|
46
|
+
if SDL.SDL_WaitEvent(e) == 1
|
47
|
+
new(e)
|
48
|
+
else
|
49
|
+
raise SDLError
|
50
|
+
end
|
48
51
|
end
|
49
52
|
|
50
53
|
def length = SDL.SDL_PeepEvents(nil, 0, SDL_PEEKEVENT, 0, -1)
|
@@ -84,15 +87,15 @@ module SDLRuby
|
|
84
87
|
end
|
85
88
|
|
86
89
|
def initialize(ptr)
|
90
|
+
@ptr = ptr
|
87
91
|
st = SDL_Event.new(ptr)
|
88
92
|
sym = Type[st.type]
|
89
93
|
@entity = st.__send__(sym)
|
90
|
-
@entity.to_ptr.free = RUBY_FREE
|
91
94
|
extend(Accessor[sym])
|
92
95
|
end
|
93
96
|
|
94
97
|
private attr_reader :entity
|
95
98
|
|
96
|
-
def to_ptr = @
|
99
|
+
def to_ptr = @ptr
|
97
100
|
end
|
98
101
|
end
|
data/lib/SDLRuby/version.rb
CHANGED