ray 0.0.1 → 0.1.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemtest +0 -0
- data/.yardopts +4 -0
- data/README.md +17 -21
- data/Rakefile +18 -139
- data/VERSION +1 -1
- data/ext/audio.cpp +723 -0
- data/ext/{color.c → color.cpp} +25 -13
- data/ext/drawable.cpp +91 -0
- data/ext/event.cpp +460 -0
- data/ext/extconf.rb +5 -104
- data/ext/font.cpp +190 -0
- data/ext/image.cpp +733 -0
- data/ext/input.cpp +74 -0
- data/ext/ray.cpp +168 -0
- data/ext/ray.hpp +356 -0
- data/ext/{rect.c → rect.cpp} +51 -37
- data/ext/shader.cpp +169 -0
- data/ext/shape.cpp +409 -0
- data/ext/sprite.cpp +306 -0
- data/ext/text.cpp +181 -0
- data/ext/vector.cpp +215 -0
- data/guide.md +619 -0
- data/lib/ray/audio.rb +0 -41
- data/lib/ray/color.rb +32 -10
- data/lib/ray/drawable.rb +16 -0
- data/lib/ray/dsl/event_listener.rb +25 -2
- data/lib/ray/dsl/event_runner.rb +33 -5
- data/lib/ray/dsl/event_translator.rb +66 -30
- data/lib/ray/dsl/handler.rb +3 -2
- data/lib/ray/dsl/matcher.rb +58 -14
- data/lib/ray/font.rb +38 -96
- data/lib/ray/font_set.rb +8 -8
- data/lib/ray/game.rb +87 -66
- data/lib/ray/helper.rb +105 -10
- data/lib/ray/image.rb +150 -24
- data/lib/ray/image_set.rb +3 -1
- data/lib/ray/input.rb +10 -0
- data/lib/ray/music_set.rb +5 -3
- data/lib/ray/ray.rb +21 -9
- data/lib/ray/rect.rb +48 -7
- data/lib/ray/rmagick.rb +41 -0
- data/lib/ray/scene.rb +99 -43
- data/lib/ray/scene_list.rb +67 -0
- data/lib/ray/shape.rb +132 -0
- data/lib/ray/sound_set.rb +4 -2
- data/lib/ray/sprite.rb +49 -111
- data/lib/ray/text.rb +101 -0
- data/lib/ray/text_helper.rb +37 -0
- data/lib/ray/turtle.rb +215 -0
- data/lib/ray/vector.rb +226 -0
- data/samples/audio/spacial.rb +44 -0
- data/samples/hello_world/hello.rb +9 -13
- data/samples/hello_world/hello_dsl.rb +8 -12
- data/samples/hello_world/text.rb +15 -0
- data/samples/opengl/binding.rb +38 -0
- data/samples/opengl/image.rb +32 -0
- data/samples/opengl/opengl.rb +34 -0
- data/samples/opengl/shader.rb +42 -0
- data/samples/pong/pong.rb +14 -10
- data/samples/run_scene.rb +53 -0
- data/samples/shaders/scene.rb +40 -0
- data/samples/shaders/shaders.rb +42 -0
- data/samples/shaders/shape.rb +34 -0
- data/samples/sokoban/sokoban.rb +18 -18
- data/samples/test/actual_scene.rb +41 -0
- data/samples/test/scene_riot.rb +39 -0
- data/samples/test/scene_spec.rb +32 -0
- data/samples/test/scene_test_unit.rb +25 -0
- data/samples/turtle/byzantium.rb +45 -0
- data/samples/turtle/hilbert.rb +48 -0
- data/samples/turtle/koch.rb +55 -0
- data/samples/turtle/mandala.rb +61 -0
- data/samples/turtle/tree.rb +57 -0
- data/test/audio_test.rb +69 -0
- data/test/color_test.rb +77 -0
- data/test/drawable_test.rb +19 -0
- data/test/dsl_test.rb +93 -0
- data/test/font_test.rb +57 -0
- data/test/helpers.rb +94 -0
- data/test/image_test.rb +82 -0
- data/test/ray_test.rb +25 -0
- data/test/rect_test.rb +121 -0
- data/{spec → test}/res/VeraMono.ttf +0 -0
- data/{spec → test}/res/aqua.bmp +0 -0
- data/{spec → test}/res/aqua.png +0 -0
- data/{spec → test}/res/aqua2.bmp +0 -0
- data/{spec → test}/res/not_a_jpeg.jpeg +0 -0
- data/{spec → test}/res/pop.wav +0 -0
- data/test/resource_set_test.rb +99 -0
- data/test/run_all.rb +7 -0
- data/test/shape_test.rb +101 -0
- data/test/sprite_test.rb +89 -0
- data/test/text_test.rb +78 -0
- data/test/turtle_test.rb +176 -0
- data/test/vector_test.rb +111 -0
- data/yard_ext.rb +0 -28
- metadata +95 -139
- data/.gitignore +0 -23
- data/.gitmodules +0 -3
- data/.rspec +0 -3
- data/ext/audio.c +0 -473
- data/ext/event.c +0 -557
- data/ext/font.c +0 -287
- data/ext/image.c +0 -933
- data/ext/joystick.c +0 -145
- data/ext/ray.c +0 -489
- data/ext/ray.h +0 -245
- data/ext/ray_osx.m +0 -161
- data/lib/ray/joystick.rb +0 -30
- data/psp/SDL_psp_main.c +0 -84
- data/psp/bigdecimal/README +0 -60
- data/psp/bigdecimal/bigdecimal.c +0 -4697
- data/psp/bigdecimal/bigdecimal.h +0 -216
- data/psp/bigdecimal/lib/bigdecimal/jacobian.rb +0 -85
- data/psp/bigdecimal/lib/bigdecimal/ludcmp.rb +0 -84
- data/psp/bigdecimal/lib/bigdecimal/math.rb +0 -235
- data/psp/bigdecimal/lib/bigdecimal/newton.rb +0 -77
- data/psp/bigdecimal/lib/bigdecimal/util.rb +0 -65
- data/psp/digest/bubblebabble/bubblebabble.c +0 -142
- data/psp/digest/defs.h +0 -20
- data/psp/digest/digest.c +0 -643
- data/psp/digest/digest.h +0 -32
- data/psp/digest/lib/digest.rb +0 -50
- data/psp/digest/lib/md5.rb +0 -27
- data/psp/digest/lib/sha1.rb +0 -27
- data/psp/digest/md5/md5.c +0 -420
- data/psp/digest/md5/md5.h +0 -80
- data/psp/digest/md5/md5init.c +0 -40
- data/psp/digest/rmd160/rmd160.c +0 -457
- data/psp/digest/rmd160/rmd160.h +0 -56
- data/psp/digest/rmd160/rmd160init.c +0 -40
- data/psp/digest/sha1/sha1.c +0 -269
- data/psp/digest/sha1/sha1.h +0 -39
- data/psp/digest/sha1/sha1init.c +0 -40
- data/psp/digest/sha2/lib/sha2.rb +0 -73
- data/psp/digest/sha2/sha2.c +0 -919
- data/psp/digest/sha2/sha2.h +0 -109
- data/psp/digest/sha2/sha2init.c +0 -52
- data/psp/enumerator/enumerator.c +0 -298
- data/psp/etc/etc.c +0 -559
- data/psp/ext.c +0 -289
- data/psp/fcntl/fcntl.c +0 -187
- data/psp/lib/rbconfig.rb +0 -178
- data/psp/nkf/lib/kconv.rb +0 -367
- data/psp/nkf/nkf-utf8/config.h +0 -88
- data/psp/nkf/nkf-utf8/nkf.c +0 -6040
- data/psp/nkf/nkf-utf8/utf8tbl.c +0 -8500
- data/psp/nkf/nkf-utf8/utf8tbl.h +0 -34
- data/psp/nkf/nkf.c +0 -654
- data/psp/socket/addrinfo.h +0 -173
- data/psp/socket/getaddrinfo.c +0 -676
- data/psp/socket/getnameinfo.c +0 -270
- data/psp/socket/pspsocket.c +0 -71
- data/psp/socket/pspsocket.h +0 -28
- data/psp/socket/socket.c +0 -4662
- data/psp/socket/sockport.h +0 -76
- data/psp/stringio/stringio.c +0 -1306
- data/psp/strscan/strscan.c +0 -1320
- data/psp/syck/bytecode.c +0 -1166
- data/psp/syck/emitter.c +0 -1242
- data/psp/syck/gram.c +0 -1894
- data/psp/syck/gram.h +0 -79
- data/psp/syck/handler.c +0 -174
- data/psp/syck/implicit.c +0 -2990
- data/psp/syck/node.c +0 -408
- data/psp/syck/rubyext.c +0 -2367
- data/psp/syck/syck.c +0 -504
- data/psp/syck/syck.h +0 -456
- data/psp/syck/token.c +0 -2725
- data/psp/syck/yaml2byte.c +0 -257
- data/psp/syck/yamlbyte.h +0 -170
- data/psp/thread/thread.c +0 -1175
- data/psp/zlib/zlib.c +0 -3547
- data/script.rb +0 -10
- data/spec/ray/audio_spec.rb +0 -146
- data/spec/ray/color_spec.rb +0 -57
- data/spec/ray/event_spec.rb +0 -80
- data/spec/ray/font_spec.rb +0 -93
- data/spec/ray/image_set_spec.rb +0 -48
- data/spec/ray/image_spec.rb +0 -162
- data/spec/ray/joystick_spec.rb +0 -21
- data/spec/ray/matcher_spec.rb +0 -50
- data/spec/ray/ray_spec.rb +0 -88
- data/spec/ray/rect_spec.rb +0 -154
- data/spec/ray/resource_set_spec.rb +0 -105
- data/spec/ray/sprite_spec.rb +0 -163
- data/spec/spec.opts +0 -4
- data/spec/spec_helper.rb +0 -8
data/ext/{color.c → color.cpp}
RENAMED
@@ -1,4 +1,4 @@
|
|
1
|
-
#include "ray.
|
1
|
+
#include "ray.hpp"
|
2
2
|
|
3
3
|
VALUE ray_cColor = Qnil;
|
4
4
|
|
@@ -14,21 +14,21 @@ ray_color ray_rb2col(VALUE object) {
|
|
14
14
|
return *ret;
|
15
15
|
}
|
16
16
|
|
17
|
-
VALUE ray_col2rb(ray_color color) {
|
17
|
+
VALUE ray_col2rb(const ray_color &color) {
|
18
18
|
VALUE ret = rb_funcall(ray_cColor, RAY_METH("new"), 4,
|
19
19
|
INT2FIX(color.r),
|
20
20
|
INT2FIX(color.g),
|
21
21
|
INT2FIX(color.b),
|
22
|
-
INT2FIX(color.a));
|
22
|
+
INT2FIX(color.a));
|
23
23
|
return ret;
|
24
24
|
}
|
25
25
|
|
26
26
|
void ray_free_color(ray_color *color) {
|
27
|
-
|
27
|
+
delete color;
|
28
28
|
}
|
29
29
|
|
30
30
|
VALUE ray_alloc_color(VALUE self) {
|
31
|
-
ray_color *ptr =
|
31
|
+
ray_color *ptr = new ray_color;
|
32
32
|
VALUE ret = Data_Wrap_Struct(self, 0, ray_free_color, ptr);
|
33
33
|
|
34
34
|
return ret;
|
@@ -55,6 +55,15 @@ VALUE ray_init_color(int argc, VALUE *argv, VALUE self) {
|
|
55
55
|
return Qnil;
|
56
56
|
}
|
57
57
|
|
58
|
+
VALUE ray_init_color_copy(VALUE self, VALUE other) {
|
59
|
+
ray_color *color = NULL, *source = NULL;
|
60
|
+
Data_Get_Struct(self, ray_color, color);
|
61
|
+
Data_Get_Struct(other, ray_color, source);
|
62
|
+
|
63
|
+
*color = *source;
|
64
|
+
return self;
|
65
|
+
}
|
66
|
+
|
58
67
|
/* @return [Integer] red intensity */
|
59
68
|
VALUE ray_color_r(VALUE self) {
|
60
69
|
ray_color *ret;
|
@@ -89,6 +98,8 @@ VALUE ray_color_a(VALUE self) {
|
|
89
98
|
|
90
99
|
/* Sets the red intensity */
|
91
100
|
VALUE ray_color_set_r(VALUE self, VALUE val) {
|
101
|
+
rb_check_frozen(self);
|
102
|
+
|
92
103
|
ray_color *ret;
|
93
104
|
Data_Get_Struct(self, ray_color, ret);
|
94
105
|
|
@@ -98,6 +109,8 @@ VALUE ray_color_set_r(VALUE self, VALUE val) {
|
|
98
109
|
|
99
110
|
/* Sets the green intensity */
|
100
111
|
VALUE ray_color_set_g(VALUE self, VALUE val) {
|
112
|
+
rb_check_frozen(self);
|
113
|
+
|
101
114
|
ray_color *ret;
|
102
115
|
Data_Get_Struct(self, ray_color, ret);
|
103
116
|
|
@@ -107,6 +120,8 @@ VALUE ray_color_set_g(VALUE self, VALUE val) {
|
|
107
120
|
|
108
121
|
/* Sets the blue intensity */
|
109
122
|
VALUE ray_color_set_b(VALUE self, VALUE val) {
|
123
|
+
rb_check_frozen(self);
|
124
|
+
|
110
125
|
ray_color *ret;
|
111
126
|
Data_Get_Struct(self, ray_color, ret);
|
112
127
|
|
@@ -116,6 +131,8 @@ VALUE ray_color_set_b(VALUE self, VALUE val) {
|
|
116
131
|
|
117
132
|
/* Sets the alpha intensity */
|
118
133
|
VALUE ray_color_set_a(VALUE self, VALUE val) {
|
134
|
+
rb_check_frozen(self);
|
135
|
+
|
119
136
|
ray_color *ret;
|
120
137
|
Data_Get_Struct(self, ray_color, ret);
|
121
138
|
|
@@ -123,18 +140,13 @@ VALUE ray_color_set_a(VALUE self, VALUE val) {
|
|
123
140
|
return val;
|
124
141
|
}
|
125
142
|
|
126
|
-
/*
|
127
|
-
Document-class: Ray::Color
|
128
|
-
|
129
|
-
Represents a color, which does not rely on the pixel format of any
|
130
|
-
surfaces.
|
131
|
-
*/
|
132
143
|
void Init_ray_color() {
|
133
144
|
ray_cColor = rb_define_class_under(ray_mRay, "Color", rb_cObject);
|
134
|
-
|
145
|
+
|
135
146
|
rb_define_alloc_func(ray_cColor, ray_alloc_color);
|
136
147
|
rb_define_method(ray_cColor, "initialize", ray_init_color, -1);
|
137
|
-
|
148
|
+
rb_define_method(ray_cColor, "initialize_copy", ray_init_color_copy, 1);
|
149
|
+
|
138
150
|
rb_define_method(ray_cColor, "r", ray_color_r, 0);
|
139
151
|
rb_define_method(ray_cColor, "g", ray_color_g, 0);
|
140
152
|
rb_define_method(ray_cColor, "b", ray_color_b, 0);
|
data/ext/drawable.cpp
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
#include "ray.hpp"
|
2
|
+
|
3
|
+
VALUE ray_cDrawable = Qnil;
|
4
|
+
|
5
|
+
ray_drawable::~ray_drawable() {
|
6
|
+
if (!NIL_P(block))
|
7
|
+
rb_gc_unregister_address(&block);
|
8
|
+
}
|
9
|
+
|
10
|
+
void ray_drawable::set_block(VALUE val) {
|
11
|
+
block = val;
|
12
|
+
rb_gc_register_address(&block);
|
13
|
+
}
|
14
|
+
|
15
|
+
void ray_drawable::render(VALUE image) {
|
16
|
+
ray_image *c_image = ray_rb2image(image);
|
17
|
+
c_image->activate();
|
18
|
+
|
19
|
+
glMatrixMode(GL_PROJECTION);
|
20
|
+
glLoadIdentity();
|
21
|
+
glOrtho(0, c_image->width(), c_image->height(), 0, -1, 1);
|
22
|
+
|
23
|
+
glMatrixMode(GL_MODELVIEW);
|
24
|
+
|
25
|
+
glPushMatrix();
|
26
|
+
rb_funcall(block, RAY_METH("call"), 1, image);
|
27
|
+
glPopMatrix();
|
28
|
+
}
|
29
|
+
|
30
|
+
ray_drawable *ray_rb2drawable(VALUE obj) {
|
31
|
+
if (!RAY_IS_A(obj, ray_cDrawable)) {
|
32
|
+
rb_raise(rb_eTypeError, "Can't convert %s into Ray::Drawable",
|
33
|
+
RAY_OBJ_CLASSNAME(obj));
|
34
|
+
}
|
35
|
+
|
36
|
+
ray_drawable *drawable;
|
37
|
+
Data_Get_Struct(obj, ray_drawable, drawable);
|
38
|
+
|
39
|
+
return drawable;
|
40
|
+
}
|
41
|
+
|
42
|
+
void ray_free_drawable(ray_drawable *drawable) {
|
43
|
+
delete drawable;
|
44
|
+
}
|
45
|
+
|
46
|
+
VALUE ray_alloc_drawable(VALUE self) {
|
47
|
+
ray_drawable *ptr = new ray_drawable;
|
48
|
+
|
49
|
+
VALUE obj = Data_Wrap_Struct(ray_cDrawable, NULL, ray_free_drawable, ptr);
|
50
|
+
return obj;
|
51
|
+
}
|
52
|
+
|
53
|
+
/*
|
54
|
+
Creates a new Drawables.
|
55
|
+
Requires a block to be passed. This block will be run when this object
|
56
|
+
will be drawn.
|
57
|
+
*/
|
58
|
+
VALUE ray_init_drawable(VALUE self) {
|
59
|
+
rb_need_block();
|
60
|
+
ray_rb2drawable(self)->set_block(rb_block_proc());
|
61
|
+
return self;
|
62
|
+
}
|
63
|
+
|
64
|
+
/*
|
65
|
+
Document-class: Ray::Drawable
|
66
|
+
|
67
|
+
Drawables allow to use plain OpenGL to draw stuff. The projection matrix is
|
68
|
+
automatically set so (0, 0) is the upper left corner and (width, height) the
|
69
|
+
bottom right one.
|
70
|
+
|
71
|
+
@see Ray::Image#activate
|
72
|
+
|
73
|
+
@example
|
74
|
+
drawable = Ray::Drawable.new do |img|
|
75
|
+
# img is the image you are drawing on
|
76
|
+
|
77
|
+
# Draw using some OpenGL binding.
|
78
|
+
GL.begin GL::Triangles do
|
79
|
+
GL.color(1, 0, 0); GL.vertex(300, 300)
|
80
|
+
GL.color(1, 1, 0); GL.vertex(300, 100)
|
81
|
+
GL.color(1, 1, 1); GL.vertex(100, 300)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
drawable.draw_on image
|
86
|
+
*/
|
87
|
+
void Init_ray_drawable() {
|
88
|
+
ray_cDrawable = rb_define_class_under(ray_mRay, "Drawable", rb_cObject);
|
89
|
+
rb_define_alloc_func(ray_cDrawable, ray_alloc_drawable);
|
90
|
+
rb_define_method(ray_cDrawable, "initialize", ray_init_drawable, 0);
|
91
|
+
}
|
data/ext/event.cpp
ADDED
@@ -0,0 +1,460 @@
|
|
1
|
+
#include "ray.hpp"
|
2
|
+
|
3
|
+
VALUE ray_cEvent = Qnil;
|
4
|
+
|
5
|
+
typedef enum {
|
6
|
+
RAY_MOD_NONE = 0,
|
7
|
+
RAY_MOD_CTRL = 1 << 0,
|
8
|
+
RAY_MOD_ALT = 1 << 1,
|
9
|
+
RAY_MOD_SHIFT = 1 << 2
|
10
|
+
} ray_mod_keys;
|
11
|
+
|
12
|
+
ray_event *ray_rb2event(VALUE obj) {
|
13
|
+
if (!RAY_IS_A(obj, ray_cEvent)) {
|
14
|
+
rb_raise(rb_eTypeError, "Can't convert %s into Ray::Event",
|
15
|
+
RAY_OBJ_CLASSNAME(obj));
|
16
|
+
}
|
17
|
+
|
18
|
+
ray_event *ptr;
|
19
|
+
Data_Get_Struct(obj, ray_event, ptr);
|
20
|
+
|
21
|
+
return ptr;
|
22
|
+
}
|
23
|
+
|
24
|
+
void ray_free_event(ray_event *ptr) {
|
25
|
+
delete ptr;
|
26
|
+
}
|
27
|
+
|
28
|
+
VALUE ray_alloc_event(VALUE self) {
|
29
|
+
ray_event *ptr = new ray_event;
|
30
|
+
VALUE ret = Data_Wrap_Struct(self, 0L, ray_free_event, ptr);
|
31
|
+
|
32
|
+
return ret;
|
33
|
+
}
|
34
|
+
|
35
|
+
/*
|
36
|
+
Creates the event according to the next event of the stack.
|
37
|
+
*/
|
38
|
+
VALUE ray_init_event(VALUE self) {
|
39
|
+
ray_event *event = ray_rb2event(self);
|
40
|
+
if (!ray_screen.GetEvent(*event))
|
41
|
+
event->Type = sf::Event::Count;
|
42
|
+
|
43
|
+
return Qnil;
|
44
|
+
}
|
45
|
+
|
46
|
+
/*
|
47
|
+
Waits for an event and returns it.
|
48
|
+
@return [Ray::Event] The event that has just happened.
|
49
|
+
*/
|
50
|
+
VALUE ray_wait_event(VALUE self) {
|
51
|
+
ray_event *event = new ray_event;
|
52
|
+
if (!ray_screen.WaitEvent(*event))
|
53
|
+
event->Type = sf::Event::Count;
|
54
|
+
|
55
|
+
return Data_Wrap_Struct(self, 0, ray_free_event, event);
|
56
|
+
}
|
57
|
+
|
58
|
+
/*
|
59
|
+
Updates the object according to what's happening now.
|
60
|
+
*/
|
61
|
+
VALUE ray_event_poll(VALUE self) {
|
62
|
+
if (!ray_screen.GetEvent(*ray_rb2event(self)))
|
63
|
+
ray_rb2event(self)->Type = sf::Event::Count;
|
64
|
+
|
65
|
+
return self;
|
66
|
+
}
|
67
|
+
|
68
|
+
/*
|
69
|
+
Waits for an event and updates this object.
|
70
|
+
*/
|
71
|
+
VALUE ray_event_wait(VALUE self) {
|
72
|
+
if (!ray_screen.GetEvent(*ray_rb2event(self)))
|
73
|
+
ray_rb2event(self)->Type = sf::Event::Count;
|
74
|
+
return self;
|
75
|
+
}
|
76
|
+
|
77
|
+
/*
|
78
|
+
Returns the type of the event. See the TYPE_* constants.
|
79
|
+
*/
|
80
|
+
VALUE ray_event_type(VALUE self) {
|
81
|
+
return INT2FIX(ray_rb2event(self)->Type);
|
82
|
+
}
|
83
|
+
|
84
|
+
/*
|
85
|
+
@return [true, false, nil] true if the key is pressed.
|
86
|
+
*/
|
87
|
+
VALUE ray_event_key_pressed(VALUE self) {
|
88
|
+
ray_event *ev = ray_rb2event(self);
|
89
|
+
|
90
|
+
if (ev->Type == sf::Event::KeyReleased)
|
91
|
+
return Qfalse;
|
92
|
+
else if (ev->Type == sf::Event::KeyPressed)
|
93
|
+
return Qtrue;
|
94
|
+
return Qnil;
|
95
|
+
}
|
96
|
+
|
97
|
+
/*
|
98
|
+
@return [Integer, nil] An integer representing the key, if any.
|
99
|
+
*/
|
100
|
+
VALUE ray_event_key(VALUE self) {
|
101
|
+
ray_event *ev = ray_rb2event(self);
|
102
|
+
if (ev->Type != sf::Event::KeyReleased && ev->Type != sf::Event::KeyPressed)
|
103
|
+
return Qnil;
|
104
|
+
|
105
|
+
return INT2FIX(ev->Key.Code);
|
106
|
+
}
|
107
|
+
|
108
|
+
/*
|
109
|
+
@return [Integer, nil] OR'd combination of the mod keys
|
110
|
+
(control, alt, and shift) pressed
|
111
|
+
at the same time.
|
112
|
+
*/
|
113
|
+
VALUE ray_event_mod_keys(VALUE self) {
|
114
|
+
ray_event *ev = ray_rb2event(self);
|
115
|
+
if (ev->Type != sf::Event::KeyReleased && ev->Type != sf::Event::KeyPressed)
|
116
|
+
return Qnil;
|
117
|
+
|
118
|
+
int ret = RAY_MOD_NONE;
|
119
|
+
if (ev->Key.Alt) ret |= RAY_MOD_ALT;
|
120
|
+
if (ev->Key.Control) ret |= RAY_MOD_CTRL;
|
121
|
+
if (ev->Key.Shift) ret |= RAY_MOD_SHIFT;
|
122
|
+
|
123
|
+
return INT2FIX(ret);
|
124
|
+
}
|
125
|
+
|
126
|
+
/*
|
127
|
+
@return [true, false] True if this event means we gained
|
128
|
+
focus.
|
129
|
+
*/
|
130
|
+
VALUE ray_event_is_gain(VALUE self) {
|
131
|
+
ray_event *ev = ray_rb2event(self);
|
132
|
+
return ev->Type == sf::Event::GainedFocus ? Qtrue : Qfalse;
|
133
|
+
}
|
134
|
+
|
135
|
+
/*
|
136
|
+
@return [Integer, nil] The position of the mouse
|
137
|
+
*/
|
138
|
+
VALUE ray_event_mouse_x(VALUE self) {
|
139
|
+
ray_event *ev = ray_rb2event(self);
|
140
|
+
|
141
|
+
if (ev->Type == sf::Event::MouseButtonPressed ||
|
142
|
+
ev->Type == sf::Event::MouseButtonReleased)
|
143
|
+
return INT2FIX(ev->MouseButton.X);
|
144
|
+
else if (ev->Type == sf::Event::MouseMoved)
|
145
|
+
return INT2FIX(ev->MouseMove.X);
|
146
|
+
else if (ev->Type == sf::Event::MouseWheelMoved)
|
147
|
+
return INT2FIX(ev->MouseWheel.X);
|
148
|
+
|
149
|
+
return Qnil;
|
150
|
+
}
|
151
|
+
|
152
|
+
/*
|
153
|
+
@return [Integer, nil] The position of the mouse
|
154
|
+
*/
|
155
|
+
VALUE ray_event_mouse_y(VALUE self) {
|
156
|
+
ray_event *ev = ray_rb2event(self);
|
157
|
+
|
158
|
+
if (ev->Type == sf::Event::MouseButtonPressed ||
|
159
|
+
ev->Type == sf::Event::MouseButtonReleased)
|
160
|
+
return INT2FIX(ev->MouseButton.Y);
|
161
|
+
else if (ev->Type == sf::Event::MouseMoved)
|
162
|
+
return INT2FIX(ev->MouseMove.Y);
|
163
|
+
else if (ev->Type == sf::Event::MouseWheelMoved)
|
164
|
+
return INT2FIX(ev->MouseWheel.Y);
|
165
|
+
|
166
|
+
return Qnil;
|
167
|
+
}
|
168
|
+
|
169
|
+
/*
|
170
|
+
@return [Integer, nil] the button that has been pressed
|
171
|
+
*/
|
172
|
+
VALUE ray_event_mouse_button(VALUE self) {
|
173
|
+
ray_event *ev = ray_rb2event(self);
|
174
|
+
if (ev->Type != sf::Event::MouseButtonPressed &&
|
175
|
+
ev->Type != sf::Event::MouseButtonReleased)
|
176
|
+
return Qnil;
|
177
|
+
|
178
|
+
return INT2FIX(ev->MouseButton.Button);
|
179
|
+
}
|
180
|
+
|
181
|
+
/*
|
182
|
+
@return [Integer, nil] Ammount of ticks the wheel has moved
|
183
|
+
*/
|
184
|
+
VALUE ray_event_wheel_delta(VALUE self) {
|
185
|
+
ray_event *ev = ray_rb2event(self);
|
186
|
+
if (ev->Type != sf::Event::MouseWheelMoved)
|
187
|
+
return Qnil;
|
188
|
+
return INT2FIX(ev->MouseWheel.Delta);
|
189
|
+
}
|
190
|
+
|
191
|
+
/* @return [Integer, nil] The joystick device index */
|
192
|
+
VALUE ray_event_joystick_id(VALUE self) {
|
193
|
+
ray_event *ev = ray_rb2event(self);
|
194
|
+
|
195
|
+
if (ev->Type == sf::Event::JoyMoved)
|
196
|
+
return INT2FIX(ev->JoyMove.JoystickId);
|
197
|
+
else if (ev->Type == sf::Event::JoyButtonPressed ||
|
198
|
+
ev->Type == sf::Event::JoyButtonReleased)
|
199
|
+
return INT2FIX(ev->JoyButton.JoystickId);
|
200
|
+
|
201
|
+
return Qnil;
|
202
|
+
}
|
203
|
+
|
204
|
+
/* @return [Integer, nil] The joystick axis index */
|
205
|
+
VALUE ray_event_axis_id(VALUE self) {
|
206
|
+
ray_event *ev = ray_rb2event(self);
|
207
|
+
if (ev->Type == sf::Event::JoyMoved)
|
208
|
+
return INT2FIX(ev->JoyMove.Axis);
|
209
|
+
|
210
|
+
return Qnil;
|
211
|
+
}
|
212
|
+
|
213
|
+
/* @return [Float, nil] The axis value, from -100 upto 100 */
|
214
|
+
VALUE ray_event_axis_value(VALUE self) {
|
215
|
+
ray_event *ev = ray_rb2event(self);
|
216
|
+
if (ev->Type == sf::Event::JoyMoved) {
|
217
|
+
return rb_float_new(ev->JoyMove.Position);
|
218
|
+
}
|
219
|
+
|
220
|
+
return Qnil;
|
221
|
+
}
|
222
|
+
|
223
|
+
/* @return [Integer, nil] The button which was pressed or released */
|
224
|
+
VALUE ray_event_joystick_button(VALUE self) {
|
225
|
+
ray_event *ev = ray_rb2event(self);
|
226
|
+
if (ev->Type == sf::Event::JoyButtonPressed ||
|
227
|
+
ev->Type == sf::Event::JoyButtonReleased)
|
228
|
+
return INT2FIX(ev->JoyButton.Button);
|
229
|
+
|
230
|
+
return Qnil;
|
231
|
+
}
|
232
|
+
|
233
|
+
/* @return [Integer, nil] The new width of the window */
|
234
|
+
VALUE ray_event_window_w(VALUE self) {
|
235
|
+
ray_event *ev = ray_rb2event(self);
|
236
|
+
if (ev->Type == sf::Event::Resized)
|
237
|
+
return INT2FIX(ev->Size.Width);
|
238
|
+
|
239
|
+
return Qnil;
|
240
|
+
}
|
241
|
+
|
242
|
+
/* @return [Integer, nil] The new height of the window */
|
243
|
+
VALUE ray_event_window_h(VALUE self) {
|
244
|
+
ray_event *ev = ray_rb2event(self);
|
245
|
+
if (ev->Type == sf::Event::Resized)
|
246
|
+
return INT2FIX(ev->Size.Height);
|
247
|
+
|
248
|
+
return Qnil;
|
249
|
+
}
|
250
|
+
|
251
|
+
/*
|
252
|
+
@return [String, nil] Text entered by the user. A single UTF-32 character,
|
253
|
+
using native endianness.
|
254
|
+
*/
|
255
|
+
VALUE ray_event_entered_text(VALUE self) {
|
256
|
+
ray_event *ev = ray_rb2event(self);
|
257
|
+
if (ev->Type != sf::Event::TextEntered)
|
258
|
+
return Qnil;
|
259
|
+
|
260
|
+
uint32_t character = ev->Text.Unicode;
|
261
|
+
char *ptr = (char*)&character;
|
262
|
+
return rb_str_new(ptr, 4);
|
263
|
+
}
|
264
|
+
|
265
|
+
void Init_ray_event() {
|
266
|
+
ray_cEvent = rb_define_class_under(ray_mRay, "Event", rb_cObject);
|
267
|
+
rb_define_alloc_func(ray_cEvent, ray_alloc_event);
|
268
|
+
rb_define_method(ray_cEvent, "initialize", ray_init_event, 0);
|
269
|
+
|
270
|
+
rb_define_module_function(ray_cEvent, "wait", ray_wait_event, 0);
|
271
|
+
|
272
|
+
rb_define_method(ray_cEvent, "poll!", ray_event_poll, 0);
|
273
|
+
rb_define_method(ray_cEvent, "wait!", ray_event_wait, 0);
|
274
|
+
|
275
|
+
rb_define_method(ray_cEvent, "type", ray_event_type, 0);
|
276
|
+
|
277
|
+
rb_define_method(ray_cEvent, "key_pressed?", ray_event_key_pressed, 0);
|
278
|
+
rb_define_method(ray_cEvent, "key", ray_event_key, 0);
|
279
|
+
rb_define_method(ray_cEvent, "mod_keys", ray_event_mod_keys, 0);
|
280
|
+
|
281
|
+
rb_define_method(ray_cEvent, "is_gain?", ray_event_is_gain, 0);
|
282
|
+
|
283
|
+
rb_define_method(ray_cEvent, "mouse_x", ray_event_mouse_x, 0);
|
284
|
+
rb_define_method(ray_cEvent, "mouse_y", ray_event_mouse_y, 0);
|
285
|
+
rb_define_method(ray_cEvent, "mouse_button", ray_event_mouse_button, 0);
|
286
|
+
rb_define_method(ray_cEvent, "wheel_delta", ray_event_wheel_delta, 0);
|
287
|
+
|
288
|
+
rb_define_method(ray_cEvent, "joystick_id", ray_event_joystick_id, 0);
|
289
|
+
rb_define_method(ray_cEvent, "axis_id", ray_event_axis_id, 0);
|
290
|
+
rb_define_method(ray_cEvent, "axis_value", ray_event_axis_value, 0);
|
291
|
+
rb_define_method(ray_cEvent, "joystick_button", ray_event_joystick_button, 0);
|
292
|
+
|
293
|
+
rb_define_method(ray_cEvent, "window_w", ray_event_window_w, 0);
|
294
|
+
rb_define_method(ray_cEvent, "window_h", ray_event_window_h, 0);
|
295
|
+
|
296
|
+
rb_define_method(ray_cEvent, "entered_text", ray_event_entered_text, 0);
|
297
|
+
|
298
|
+
rb_define_const(ray_cEvent, "TYPE_NOEVENT", INT2FIX(sf::Event::Count));
|
299
|
+
|
300
|
+
rb_define_const(ray_cEvent, "TYPE_FOCUS_GAIN", INT2FIX(sf::Event::GainedFocus));
|
301
|
+
rb_define_const(ray_cEvent, "TYPE_FOCUS_LOSS", INT2FIX(sf::Event::LostFocus));
|
302
|
+
|
303
|
+
rb_define_const(ray_cEvent, "TYPE_MOUSE_ENTERED", INT2FIX(sf::Event::MouseEntered));
|
304
|
+
rb_define_const(ray_cEvent, "TYPE_MOUSE_LEFT", INT2FIX(sf::Event::MouseLeft));
|
305
|
+
|
306
|
+
rb_define_const(ray_cEvent, "TYPE_KEYDOWN", INT2FIX(sf::Event::KeyPressed));
|
307
|
+
rb_define_const(ray_cEvent, "TYPE_KEYUP", INT2FIX(sf::Event::KeyReleased));
|
308
|
+
|
309
|
+
rb_define_const(ray_cEvent, "TYPE_MOUSEMOTION", INT2FIX(sf::Event::MouseMoved));
|
310
|
+
rb_define_const(ray_cEvent, "TYPE_MOUSEWHEELMOVED",
|
311
|
+
INT2FIX(sf::Event::MouseWheelMoved));
|
312
|
+
rb_define_const(ray_cEvent, "TYPE_MOUSEBUTTONDOWN",
|
313
|
+
INT2FIX(sf::Event::MouseButtonPressed));
|
314
|
+
rb_define_const(ray_cEvent, "TYPE_MOUSEBUTTONUP",
|
315
|
+
INT2FIX(sf::Event::MouseButtonReleased));
|
316
|
+
|
317
|
+
rb_define_const(ray_cEvent, "TYPE_JOYAXISMOTION",
|
318
|
+
INT2FIX(sf::Event::JoyMoved));
|
319
|
+
rb_define_const(ray_cEvent, "TYPE_JOYBUTTONDOWN",
|
320
|
+
INT2FIX(sf::Event::JoyButtonPressed));
|
321
|
+
rb_define_const(ray_cEvent, "TYPE_JOYBUTTONUP",
|
322
|
+
INT2FIX(sf::Event::JoyButtonReleased));
|
323
|
+
rb_define_const(ray_cEvent, "TYPE_QUIT", INT2FIX(sf::Event::Closed));
|
324
|
+
rb_define_const(ray_cEvent, "TYPE_VIDEORESIZE", INT2FIX(sf::Event::Resized));
|
325
|
+
|
326
|
+
rb_define_const(ray_cEvent, "TYPE_TEXT_ENTERED", INT2FIX(sf::Event::TextEntered));
|
327
|
+
|
328
|
+
rb_define_const(ray_cEvent, "AXIS_X", INT2FIX(sf::Joy::AxisX));
|
329
|
+
rb_define_const(ray_cEvent, "AXIS_Y", INT2FIX(sf::Joy::AxisY));
|
330
|
+
rb_define_const(ray_cEvent, "AXIS_Z", INT2FIX(sf::Joy::AxisZ));
|
331
|
+
rb_define_const(ray_cEvent, "AXIS_R", INT2FIX(sf::Joy::AxisR));
|
332
|
+
rb_define_const(ray_cEvent, "AXIS_U", INT2FIX(sf::Joy::AxisU));
|
333
|
+
rb_define_const(ray_cEvent, "AXIS_V", INT2FIX(sf::Joy::AxisV));
|
334
|
+
|
335
|
+
/* Point of view axis. Its value is an angle, therefore in the 0..360 range. */
|
336
|
+
rb_define_const(ray_cEvent, "AXIS_POV", INT2FIX(sf::Joy::AxisPOV));
|
337
|
+
|
338
|
+
rb_define_const(ray_cEvent, "KEY_BACKSPACE", INT2FIX(sf::Key::Back));
|
339
|
+
rb_define_const(ray_cEvent, "KEY_TAB", INT2FIX(sf::Key::Tab));
|
340
|
+
rb_define_const(ray_cEvent, "KEY_RETURN", INT2FIX(sf::Key::Return));
|
341
|
+
rb_define_const(ray_cEvent, "KEY_PAUSE", INT2FIX(sf::Key::Pause));
|
342
|
+
rb_define_const(ray_cEvent, "KEY_ESCAPE", INT2FIX(sf::Key::Escape));
|
343
|
+
rb_define_const(ray_cEvent, "KEY_SPACE", INT2FIX(sf::Key::Space));
|
344
|
+
rb_define_const(ray_cEvent, "KEY_QUOTE", INT2FIX(sf::Key::Quote));
|
345
|
+
rb_define_const(ray_cEvent, "KEY_ASTERISK", INT2FIX(sf::Key::Multiply));
|
346
|
+
rb_define_const(ray_cEvent, "KEY_PLUS", INT2FIX(sf::Key::Add));
|
347
|
+
rb_define_const(ray_cEvent, "KEY_COMMA", INT2FIX(sf::Key::Comma));
|
348
|
+
rb_define_const(ray_cEvent, "KEY_MINUS", INT2FIX(sf::Key::Subtract));
|
349
|
+
rb_define_const(ray_cEvent, "KEY_PERIOD", INT2FIX(sf::Key::Period));
|
350
|
+
rb_define_const(ray_cEvent, "KEY_SLASH", INT2FIX(sf::Key::Divide));
|
351
|
+
|
352
|
+
rb_define_const(ray_cEvent, "KEY_0", INT2FIX(sf::Key::Num0));
|
353
|
+
rb_define_const(ray_cEvent, "KEY_1", INT2FIX(sf::Key::Num1));
|
354
|
+
rb_define_const(ray_cEvent, "KEY_2", INT2FIX(sf::Key::Num2));
|
355
|
+
rb_define_const(ray_cEvent, "KEY_3", INT2FIX(sf::Key::Num3));
|
356
|
+
rb_define_const(ray_cEvent, "KEY_4", INT2FIX(sf::Key::Num4));
|
357
|
+
rb_define_const(ray_cEvent, "KEY_5", INT2FIX(sf::Key::Num5));
|
358
|
+
rb_define_const(ray_cEvent, "KEY_6", INT2FIX(sf::Key::Num6));
|
359
|
+
rb_define_const(ray_cEvent, "KEY_7", INT2FIX(sf::Key::Num7));
|
360
|
+
rb_define_const(ray_cEvent, "KEY_8", INT2FIX(sf::Key::Num8));
|
361
|
+
rb_define_const(ray_cEvent, "KEY_9", INT2FIX(sf::Key::Num9));
|
362
|
+
|
363
|
+
rb_define_const(ray_cEvent, "KEY_SEMICOLON", INT2FIX(sf::Key::SemiColon));
|
364
|
+
rb_define_const(ray_cEvent, "KEY_EQUALS", INT2FIX(sf::Key::Equal));
|
365
|
+
rb_define_const(ray_cEvent, "KEY_LEFTBRACKET", INT2FIX(sf::Key::LBracket));
|
366
|
+
rb_define_const(ray_cEvent, "KEY_BACKSLASH", INT2FIX(sf::Key::BackSlash));
|
367
|
+
rb_define_const(ray_cEvent, "KEY_RIGHTBRACKET", INT2FIX(sf::Key::RBracket));
|
368
|
+
|
369
|
+
rb_define_const(ray_cEvent, "KEY_a", INT2FIX(sf::Key::A));
|
370
|
+
rb_define_const(ray_cEvent, "KEY_b", INT2FIX(sf::Key::B));
|
371
|
+
rb_define_const(ray_cEvent, "KEY_c", INT2FIX(sf::Key::C));
|
372
|
+
rb_define_const(ray_cEvent, "KEY_d", INT2FIX(sf::Key::D));
|
373
|
+
rb_define_const(ray_cEvent, "KEY_e", INT2FIX(sf::Key::E));
|
374
|
+
rb_define_const(ray_cEvent, "KEY_f", INT2FIX(sf::Key::F));
|
375
|
+
rb_define_const(ray_cEvent, "KEY_g", INT2FIX(sf::Key::G));
|
376
|
+
rb_define_const(ray_cEvent, "KEY_h", INT2FIX(sf::Key::H));
|
377
|
+
rb_define_const(ray_cEvent, "KEY_i", INT2FIX(sf::Key::I));
|
378
|
+
rb_define_const(ray_cEvent, "KEY_j", INT2FIX(sf::Key::J));
|
379
|
+
rb_define_const(ray_cEvent, "KEY_k", INT2FIX(sf::Key::K));
|
380
|
+
rb_define_const(ray_cEvent, "KEY_l", INT2FIX(sf::Key::L));
|
381
|
+
rb_define_const(ray_cEvent, "KEY_m", INT2FIX(sf::Key::M));
|
382
|
+
rb_define_const(ray_cEvent, "KEY_n", INT2FIX(sf::Key::N));
|
383
|
+
rb_define_const(ray_cEvent, "KEY_o", INT2FIX(sf::Key::O));
|
384
|
+
rb_define_const(ray_cEvent, "KEY_p", INT2FIX(sf::Key::P));
|
385
|
+
rb_define_const(ray_cEvent, "KEY_q", INT2FIX(sf::Key::Q));
|
386
|
+
rb_define_const(ray_cEvent, "KEY_r", INT2FIX(sf::Key::R));
|
387
|
+
rb_define_const(ray_cEvent, "KEY_s", INT2FIX(sf::Key::S));
|
388
|
+
rb_define_const(ray_cEvent, "KEY_t", INT2FIX(sf::Key::T));
|
389
|
+
rb_define_const(ray_cEvent, "KEY_u", INT2FIX(sf::Key::U));
|
390
|
+
rb_define_const(ray_cEvent, "KEY_v", INT2FIX(sf::Key::V));
|
391
|
+
rb_define_const(ray_cEvent, "KEY_w", INT2FIX(sf::Key::W));
|
392
|
+
rb_define_const(ray_cEvent, "KEY_x", INT2FIX(sf::Key::X));
|
393
|
+
rb_define_const(ray_cEvent, "KEY_y", INT2FIX(sf::Key::Y));
|
394
|
+
rb_define_const(ray_cEvent, "KEY_z", INT2FIX(sf::Key::Z));
|
395
|
+
|
396
|
+
rb_define_const(ray_cEvent, "KEY_DELETE", INT2FIX(sf::Key::Delete));
|
397
|
+
|
398
|
+
rb_define_const(ray_cEvent, "KEY_KP0", INT2FIX(sf::Key::Numpad0));
|
399
|
+
rb_define_const(ray_cEvent, "KEY_KP1", INT2FIX(sf::Key::Numpad1));
|
400
|
+
rb_define_const(ray_cEvent, "KEY_KP2", INT2FIX(sf::Key::Numpad2));
|
401
|
+
rb_define_const(ray_cEvent, "KEY_KP3", INT2FIX(sf::Key::Numpad3));
|
402
|
+
rb_define_const(ray_cEvent, "KEY_KP4", INT2FIX(sf::Key::Numpad4));
|
403
|
+
rb_define_const(ray_cEvent, "KEY_KP5", INT2FIX(sf::Key::Numpad5));
|
404
|
+
rb_define_const(ray_cEvent, "KEY_KP6", INT2FIX(sf::Key::Numpad6));
|
405
|
+
rb_define_const(ray_cEvent, "KEY_KP7", INT2FIX(sf::Key::Numpad7));
|
406
|
+
rb_define_const(ray_cEvent, "KEY_KP8", INT2FIX(sf::Key::Numpad8));
|
407
|
+
rb_define_const(ray_cEvent, "KEY_KP9", INT2FIX(sf::Key::Numpad9));
|
408
|
+
|
409
|
+
rb_define_const(ray_cEvent, "KEY_UP", INT2FIX(sf::Key::Up));
|
410
|
+
rb_define_const(ray_cEvent, "KEY_DOWN", INT2FIX(sf::Key::Down));
|
411
|
+
rb_define_const(ray_cEvent, "KEY_RIGHT", INT2FIX(sf::Key::Right));
|
412
|
+
rb_define_const(ray_cEvent, "KEY_LEFT", INT2FIX(sf::Key::Left));
|
413
|
+
|
414
|
+
rb_define_const(ray_cEvent, "KEY_INSERT", INT2FIX(sf::Key::Insert));
|
415
|
+
rb_define_const(ray_cEvent, "KEY_HOME", INT2FIX(sf::Key::Home));
|
416
|
+
rb_define_const(ray_cEvent, "KEY_END", INT2FIX(sf::Key::End));
|
417
|
+
rb_define_const(ray_cEvent, "KEY_PAGEUP", INT2FIX(sf::Key::PageUp));
|
418
|
+
rb_define_const(ray_cEvent, "KEY_PAGEDOWN", INT2FIX(sf::Key::PageDown));
|
419
|
+
|
420
|
+
rb_define_const(ray_cEvent, "KEY_F1", INT2FIX(sf::Key::F1));
|
421
|
+
rb_define_const(ray_cEvent, "KEY_F2", INT2FIX(sf::Key::F2));
|
422
|
+
rb_define_const(ray_cEvent, "KEY_F3", INT2FIX(sf::Key::F3));
|
423
|
+
rb_define_const(ray_cEvent, "KEY_F4", INT2FIX(sf::Key::F4));
|
424
|
+
rb_define_const(ray_cEvent, "KEY_F5", INT2FIX(sf::Key::F5));
|
425
|
+
rb_define_const(ray_cEvent, "KEY_F6", INT2FIX(sf::Key::F6));
|
426
|
+
rb_define_const(ray_cEvent, "KEY_F7", INT2FIX(sf::Key::F7));
|
427
|
+
rb_define_const(ray_cEvent, "KEY_F8", INT2FIX(sf::Key::F8));
|
428
|
+
rb_define_const(ray_cEvent, "KEY_F9", INT2FIX(sf::Key::F9));
|
429
|
+
rb_define_const(ray_cEvent, "KEY_F10", INT2FIX(sf::Key::F10));
|
430
|
+
rb_define_const(ray_cEvent, "KEY_F11", INT2FIX(sf::Key::F11));
|
431
|
+
rb_define_const(ray_cEvent, "KEY_F12", INT2FIX(sf::Key::F12));
|
432
|
+
rb_define_const(ray_cEvent, "KEY_F13", INT2FIX(sf::Key::F13));
|
433
|
+
rb_define_const(ray_cEvent, "KEY_F14", INT2FIX(sf::Key::F14));
|
434
|
+
rb_define_const(ray_cEvent, "KEY_F15", INT2FIX(sf::Key::F15));
|
435
|
+
|
436
|
+
rb_define_const(ray_cEvent, "KEY_RSHIFT", INT2FIX(sf::Key::RShift));
|
437
|
+
rb_define_const(ray_cEvent, "KEY_LSHIFT", INT2FIX(sf::Key::LShift));
|
438
|
+
|
439
|
+
rb_define_const(ray_cEvent, "KEY_RCTRL", INT2FIX(sf::Key::RControl));
|
440
|
+
rb_define_const(ray_cEvent, "KEY_LCTRL", INT2FIX(sf::Key::LControl));
|
441
|
+
|
442
|
+
rb_define_const(ray_cEvent, "KEY_RALT", INT2FIX(sf::Key::RAlt));
|
443
|
+
rb_define_const(ray_cEvent, "KEY_LALT", INT2FIX(sf::Key::LAlt));
|
444
|
+
|
445
|
+
rb_define_const(ray_cEvent, "KEY_LSUPER", INT2FIX(sf::Key::LSystem));
|
446
|
+
rb_define_const(ray_cEvent, "KEY_RSUPER", INT2FIX(sf::Key::RSystem));
|
447
|
+
|
448
|
+
rb_define_const(ray_cEvent, "KEY_MENU", INT2FIX(sf::Key::Menu));
|
449
|
+
|
450
|
+
rb_define_const(ray_cEvent, "KMOD_NONE", INT2FIX(RAY_MOD_NONE));
|
451
|
+
rb_define_const(ray_cEvent, "KMOD_ALT", INT2FIX(RAY_MOD_ALT));
|
452
|
+
rb_define_const(ray_cEvent, "KMOD_CTRL", INT2FIX(RAY_MOD_CTRL));
|
453
|
+
rb_define_const(ray_cEvent, "KMOD_SHIFT", INT2FIX(RAY_MOD_SHIFT));
|
454
|
+
|
455
|
+
rb_define_const(ray_cEvent, "BUTTON_LEFT", INT2FIX(sf::Mouse::Left));
|
456
|
+
rb_define_const(ray_cEvent, "BUTTON_MIDDLE", INT2FIX(sf::Mouse::Middle));
|
457
|
+
rb_define_const(ray_cEvent, "BUTTON_RIGHT", INT2FIX(sf::Mouse::Right));
|
458
|
+
rb_define_const(ray_cEvent, "BUTTON_EXTRA1", INT2FIX(sf::Mouse::XButton1));
|
459
|
+
rb_define_const(ray_cEvent, "BUTTON_EXTRA2", INT2FIX(sf::Mouse::XButton2));
|
460
|
+
}
|