glfw 0.9.8 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 3ca1a58ecdbd6b33d8c6ae549554cff5c9da32fd
4
- data.tar.gz: 5ebe2f5f8650ba1dd778011adee4cb2504f32fc0
2
+ SHA256:
3
+ metadata.gz: e4ede14d21b049d041c7cc4b79463a951731d7af44f9af89aad9124d27b7add9
4
+ data.tar.gz: 90245e05d8b2fabdc2bf78e1792152a45e51fdf9a8f05bd2cfaf4378604d1b61
5
5
  SHA512:
6
- metadata.gz: df2b8b789740aa1809b3d109c25f57eb5b004dbb9cd74f722c76cc2d8d980d3ae71debbed6e27e9b91fec0aa7a4872d4ea03ca4747efebc453f9c548ecc630e0
7
- data.tar.gz: a9eaa3be251a8ab64fa5e77e656a473a082e29bb79e596fbf4b9d49d5d81acc794655853bcf71fef2a66837d7aa26333ca96cdbf02b6136bed518564467ea782
6
+ metadata.gz: b2b4fa2073d1733eba7ddd64215eb3cb3c33c02a64abc6652f249ac724e91e2218be5d365dd0739daec1314a7079585bd8bb132f2226e14bb96e1ce9ec1eaa8b
7
+ data.tar.gz: cb8ba44a0117051eba24e512afe19b7822cb1983d6eb6201a0daeea227aab66457f8229eecaeeea736cf70bc31056ff907b40f6b17f46aaf4344ace2ab9b63b1
data/Makefile CHANGED
@@ -122,8 +122,8 @@ TOUCH = exit >
122
122
  #### End of system configuration section. ####
123
123
 
124
124
  preload =
125
- libpath = . $(libdir) C:/Ruby24/lib c:/Users/Eric/OneDrive/Documents/RubymineProjects/glfw/ext/glfw/lib
126
- LIBPATH = -L. -L$(libdir) -LC:/Ruby24/lib -Lc:/Users/Eric/OneDrive/Documents/RubymineProjects/glfw/ext/glfw/lib
125
+ libpath = . $(libdir) C:/Ruby24/lib c:/Users/Eric/OneDrive/Documents/RubymineProjects/glfw/ext/glfw/ming32
126
+ LIBPATH = -L. -L$(libdir) -LC:/Ruby24/lib -Lc:/Users/Eric/OneDrive/Documents/RubymineProjects/glfw/ext/glfw/ming32
127
127
  DEFFILE = $(TARGET)-$(arch).def
128
128
 
129
129
  CLEANFILES = mkmf.log $(DEFFILE)
@@ -133,7 +133,7 @@ DISTCLEANDIRS =
133
133
  extout =
134
134
  extout_prefix =
135
135
  target_prefix = /glfw
136
- LOCAL_LIBS = -lglfw3 -lgdi32 -lopengl32
136
+ LOCAL_LIBS = -lglfw3 -lgdi32 -lopengl32
137
137
  LIBS = $(LIBRUBYARG_SHARED) -lgmp -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi
138
138
  ORIG_SRCS = cursor.c glfw.c image.c monitor.c video_mode.c vulkan.c window.c
139
139
  SRCS = $(ORIG_SRCS)
data/README.md CHANGED
@@ -1,10 +1,13 @@
1
1
  # ![icon](./glfw-icon.png) GLFW
2
2
 
3
- This is a Ruby C-extension that for the excellent [GLFW](https://github.com/glfw/glfw) library. Unlike other bindings, this gem goes beyond just providing a 1:1 wrapper of the functions, and has been organized to be used in a more object-oriented, Ruby way. Being statically linked with the included object file during compilation alleviates any headaches with regards to versioning or dependencies, as none are required for this gem.
3
+ This is a Ruby C-extension that for the excellent [GLFW](https://github.com/glfw/glfw) library. Unlike other bindings, this gem goes beyond just providing a 1:1 wrapper of the functions, and has been organized to be used in a more object-oriented, Ruby way.
4
4
 
5
5
  ## Installation
6
6
 
7
- One of the other advantages this gem offers is that it does not require external dependencies, not even the GLFW3 API. Instead of linking to an extisting library, the gem includes the headers and `glfw3.a` static library to compile against during installation. This offers a much easier, more consistent installation process, without the end-user required to ensure any pre-existing files are properly installed, or concern over versions. As the API the gem is based quite stable and mature, new realeases are uncommon, though this gem will update as they become available to provide the latest version.
7
+ For Windows user, you can download the pre-built binaries at [here](https://www.glfw.org/download.html) for your target architecture, or both. Place these within the their respective folders withing the `ext/glfw/` directory.
8
+
9
+ For Unix users, simply have GLFW installed globally, and it will be found and linked against during the build process.
10
+
8
11
 
9
12
  ### From [RubyGems.org](https://rubygems.org/gems/glfw)
10
13
 
data/Rakefile CHANGED
@@ -1,12 +1,3 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
3
-
4
- Rake::TestTask.new(:test) do |t|
5
- t.libs << "test"
6
- t.libs << "lib"
7
- t.test_files = FileList["test/**/*_test.rb"]
8
- end
9
-
10
1
  require "rake/extensiontask"
11
2
 
12
3
  task :build => :compile
data/ext/glfw/common.h CHANGED
@@ -1,46 +1,46 @@
1
-
2
-
3
- #ifndef GLFW_RB_COMMON_H
4
- #define GLFW_RB_COMMON_H 1
5
-
6
- #include "glfw3.h"
7
- #include "ruby.h"
8
-
9
- #define STR2SYM(str) ID2SYM(rb_intern(str))
10
-
11
- #define INT2BOOL(i) (i ? Qtrue : Qfalse)
12
-
13
- #define WINDOW() \
14
- GLFWwindow *w; \
15
- Data_Get_Struct(self, GLFWwindow, w)
16
-
17
- enum GLFW_RB_CALLBACK_TYPE {
18
- GLFW_RB_MOVED,
19
- GLFW_RB_RESIZED,
20
- GLFW_RB_FRAMEBUFFER_RESIZED,
21
- GLFW_RB_CLOSING,
22
- GLFW_RB_REFRESHED,
23
- GLFW_RB_FOCUS_CHANGED,
24
- GLFW_RB_MINIMIZE_CHANGED,
25
- GLFW_RB_MOUSE_MOVE,
26
- GLFW_RB_MOUSE_SCROLL,
27
- GLFW_RB_MOUSE_BUTTON,
28
- GLFW_RB_MOUSE_ENTER,
29
- GLFW_RB_KEY,
30
- GLFW_RB_CHAR,
31
- GLFW_RB_CHAR_MODS,
32
- GLFW_RB_FILE_DROP,
33
- GLFW_RB_MONITOR,
34
- GLFW_RB_JOYSTICK
35
- } GLFW_RB_CALLBACK_TYPE;
36
-
37
- extern VALUE rb_mGLFW;
38
- extern VALUE rb_eGLFWError;
39
- extern VALUE rb_cGLFWwindow;
40
- extern VALUE rb_cGLFWmonitor;
41
- extern VALUE rb_cGLFWvidmode;
42
- extern VALUE rb_cGLFWimage;
43
- extern VALUE rb_cGLFWcursor;
44
- extern VALUE rb_cGLFWvulkan;
45
-
1
+
2
+
3
+ #ifndef GLFW_RB_COMMON_H
4
+ #define GLFW_RB_COMMON_H 1
5
+
6
+ #include "glfw3.h"
7
+ #include "ruby.h"
8
+
9
+ #define STR2SYM(str) ID2SYM(rb_intern(str))
10
+
11
+ #define INT2BOOL(i) (i ? Qtrue : Qfalse)
12
+
13
+ #define WINDOW() \
14
+ GLFWwindow *w; \
15
+ Data_Get_Struct(self, GLFWwindow, w)
16
+
17
+ enum GLFW_RB_CALLBACK_TYPE {
18
+ GLFW_RB_MOVED,
19
+ GLFW_RB_RESIZED,
20
+ GLFW_RB_FRAMEBUFFER_RESIZED,
21
+ GLFW_RB_CLOSING,
22
+ GLFW_RB_REFRESHED,
23
+ GLFW_RB_FOCUS_CHANGED,
24
+ GLFW_RB_MINIMIZE_CHANGED,
25
+ GLFW_RB_MOUSE_MOVE,
26
+ GLFW_RB_MOUSE_SCROLL,
27
+ GLFW_RB_MOUSE_BUTTON,
28
+ GLFW_RB_MOUSE_ENTER,
29
+ GLFW_RB_KEY,
30
+ GLFW_RB_CHAR,
31
+ GLFW_RB_CHAR_MODS,
32
+ GLFW_RB_FILE_DROP,
33
+ GLFW_RB_MONITOR,
34
+ GLFW_RB_JOYSTICK
35
+ } GLFW_RB_CALLBACK_TYPE;
36
+
37
+ extern VALUE rb_mGLFW;
38
+ extern VALUE rb_eGLFWError;
39
+ extern VALUE rb_cGLFWwindow;
40
+ extern VALUE rb_cGLFWmonitor;
41
+ extern VALUE rb_cGLFWvidmode;
42
+ extern VALUE rb_cGLFWimage;
43
+ extern VALUE rb_cGLFWcursor;
44
+ extern VALUE rb_cGLFWvulkan;
45
+
46
46
  #endif /* GLFW_RB_COMMON_H */
data/ext/glfw/cursor.c CHANGED
@@ -1,42 +1,42 @@
1
-
2
- #include "cursor.h"
3
-
4
- VALUE rb_cGLFWcursor;
5
-
6
- void Init_glfw_cursor(VALUE module) {
7
- rb_cGLFWcursor = rb_define_class_under(module, "Cursor", rb_cObject);
8
- rb_define_alloc_func(rb_cGLFWcursor, rb_glfw_cursor_alloc);
9
-
10
- rb_define_method(rb_cGLFWcursor, "initialize", rb_glfw_cursor_initialize, 3);
11
- rb_define_method(rb_cGLFWcursor, "destroy", rb_glfw_cursor_destroy, 0);
12
-
13
- rb_define_alias(rb_cGLFWcursor, "dispose", "destroy");
14
-
15
- rb_define_singleton_method(rb_cGLFWcursor, "create", rb_glfw_cursor_standard, 1);
16
- }
17
-
18
- static VALUE rb_glfw_cursor_alloc(VALUE klass) {
19
- GLFWcursor *c = ruby_xmalloc(SIZEOF_INTPTR_T);
20
- memset(c, 0, SIZEOF_INTPTR_T);
21
- return Data_Wrap_Struct(klass, NULL, RUBY_DEFAULT_FREE, c);
22
- }
23
-
24
- VALUE rb_glfw_cursor_initialize(VALUE self, VALUE image, VALUE xhot, VALUE yhot) {
25
- GLFWimage *img;
26
- Data_Get_Struct(image, GLFWimage, img);
27
- RDATA(self)->data = glfwCreateCursor(img, NUM2INT(xhot), NUM2INT(yhot));
28
- return Qnil;
29
- }
30
-
31
- VALUE rb_glfw_cursor_standard(VALUE klass, VALUE shape) {
32
- GLFWcursor *cursor = glfwCreateStandardCursor(NUM2INT(shape));
33
- return Data_Wrap_Struct(klass, NULL, RUBY_DEFAULT_FREE, cursor);
34
- }
35
-
36
- VALUE rb_glfw_cursor_destroy(VALUE self) {
37
- GLFWcursor *cursor;
38
- Data_Get_Struct(self, GLFWcursor, cursor);
39
-
40
- glfwDestroyCursor(cursor);
41
- return Qnil;
42
- }
1
+
2
+ #include "cursor.h"
3
+
4
+ VALUE rb_cGLFWcursor;
5
+
6
+ void Init_glfw_cursor(VALUE module) {
7
+ rb_cGLFWcursor = rb_define_class_under(module, "Cursor", rb_cObject);
8
+ rb_define_alloc_func(rb_cGLFWcursor, rb_glfw_cursor_alloc);
9
+
10
+ rb_define_method(rb_cGLFWcursor, "initialize", rb_glfw_cursor_initialize, 3);
11
+ rb_define_method(rb_cGLFWcursor, "destroy", rb_glfw_cursor_destroy, 0);
12
+
13
+ rb_define_alias(rb_cGLFWcursor, "dispose", "destroy");
14
+
15
+ rb_define_singleton_method(rb_cGLFWcursor, "create", rb_glfw_cursor_standard, 1);
16
+ }
17
+
18
+ static VALUE rb_glfw_cursor_alloc(VALUE klass) {
19
+ GLFWcursor *c = ruby_xmalloc(SIZEOF_INTPTR_T);
20
+ memset(c, 0, SIZEOF_INTPTR_T);
21
+ return Data_Wrap_Struct(klass, NULL, RUBY_DEFAULT_FREE, c);
22
+ }
23
+
24
+ VALUE rb_glfw_cursor_initialize(VALUE self, VALUE image, VALUE xhot, VALUE yhot) {
25
+ GLFWimage *img;
26
+ Data_Get_Struct(image, GLFWimage, img);
27
+ RDATA(self)->data = glfwCreateCursor(img, NUM2INT(xhot), NUM2INT(yhot));
28
+ return Qnil;
29
+ }
30
+
31
+ VALUE rb_glfw_cursor_standard(VALUE klass, VALUE shape) {
32
+ GLFWcursor *cursor = glfwCreateStandardCursor(NUM2INT(shape));
33
+ return Data_Wrap_Struct(klass, NULL, RUBY_DEFAULT_FREE, cursor);
34
+ }
35
+
36
+ VALUE rb_glfw_cursor_destroy(VALUE self) {
37
+ GLFWcursor *cursor;
38
+ Data_Get_Struct(self, GLFWcursor, cursor);
39
+
40
+ glfwDestroyCursor(cursor);
41
+ return Qnil;
42
+ }
data/ext/glfw/cursor.h CHANGED
@@ -1,14 +1,14 @@
1
-
2
- #ifndef GLFW_RB_CURSOR_H
3
- #define GLFW_RB_CURSOR_H 1
4
-
5
- #include "common.h"
6
- #include "image.h"
7
-
8
- void Init_glfw_cursor(VALUE module);
9
- static VALUE rb_glfw_cursor_alloc(VALUE klass);
10
- VALUE rb_glfw_cursor_initialize(VALUE self, VALUE image, VALUE xhot, VALUE yhot);
11
- VALUE rb_glfw_cursor_standard(VALUE klass, VALUE shape);
12
- VALUE rb_glfw_cursor_destroy(VALUE self);
13
-
1
+
2
+ #ifndef GLFW_RB_CURSOR_H
3
+ #define GLFW_RB_CURSOR_H 1
4
+
5
+ #include "common.h"
6
+ #include "image.h"
7
+
8
+ void Init_glfw_cursor(VALUE module);
9
+ static VALUE rb_glfw_cursor_alloc(VALUE klass);
10
+ VALUE rb_glfw_cursor_initialize(VALUE self, VALUE image, VALUE xhot, VALUE yhot);
11
+ VALUE rb_glfw_cursor_standard(VALUE klass, VALUE shape);
12
+ VALUE rb_glfw_cursor_destroy(VALUE self);
13
+
14
14
  #endif /* GLFW_RB_CURSOR_H */
data/ext/glfw/extconf.rb CHANGED
@@ -1,24 +1,21 @@
1
1
  require "mkmf"
2
2
 
3
- LIBDIR = RbConfig::CONFIG['libdir']
4
- INCLUDEDIR = RbConfig::CONFIG['includedir']
5
3
 
6
- HEADER_DIRS = [INCLUDEDIR, File.dirname(__FILE__)]
4
+ headers = [RbConfig::CONFIG['includedir'], File.dirname(__FILE__)]
5
+ libdirs = [RbConfig::CONFIG['libdir']]
7
6
 
8
- # TODO: x86 or x86-64 (ming)
7
+ dir = 0.size == 4 ? 'ming32' : 'ming64'
8
+ libdirs << File.expand_path(File.join(File.dirname(__FILE__), dir))
9
9
 
10
-
11
- # setup constant that is equal to that of the file path that holds that static libraries that will need to be compiled against
12
- LIB_DIRS = [LIBDIR, File.expand_path(File.join(File.dirname(__FILE__), "lib"))]
13
-
14
- # array of all libraries that the C extension should be compiled against
15
- libs = ['-lglfw3 -lgdi32 -lopengl32']
16
-
17
- dir_config('glfw', HEADER_DIRS, LIB_DIRS)
18
-
19
- # iterate though the libs array, and append them to the $LOCAL_LIBS array used for the makefile creation
20
- libs.each do |lib|
21
- $LOCAL_LIBS << "#{lib} "
10
+ case RbConfig::CONFIG['host_os']
11
+ when /mingw/
12
+ $LOCAL_LIBS << '-lglfw3 -lgdi32 -lopengl32'
13
+ when /darwin/
14
+ find_library("glfw", "glfwInit")
15
+ when /linux/
16
+ find_library("glfw", "glfwInit")
22
17
  end
23
18
 
19
+ dir_config('glfw', headers, libdirs)
20
+
24
21
  create_makefile("glfw/glfw")
data/ext/glfw/glfw.c CHANGED
@@ -41,7 +41,7 @@ void Init_glfw(void) {
41
41
 
42
42
  // API Version
43
43
  rb_define_const(rb_mGLFW, "API_VERSION", rb_sprintf("%d.%d.%d",
44
- INT2NUM(GLFW_VERSION_MAJOR), INT2NUM(GLFW_VERSION_MINOR), INT2NUM(GLFW_VERSION_REVISION)));
44
+ GLFW_VERSION_MAJOR, GLFW_VERSION_MINOR, GLFW_VERSION_REVISION));
45
45
  rb_define_const(rb_mGLFW, "API_VERSION_MAJOR", INT2NUM(GLFW_VERSION_MAJOR));
46
46
  rb_define_const(rb_mGLFW, "API_VERSION_MINOR", INT2NUM(GLFW_VERSION_MINOR));
47
47
  rb_define_const(rb_mGLFW, "API_VERSION_REVISION", INT2NUM(GLFW_VERSION_REVISION));
@@ -273,7 +273,7 @@ void Init_glfw(void) {
273
273
  }
274
274
 
275
275
  void rb_glfw_error_callback(int error, const char *message) {
276
- rb_raise(rb_eGLFWError, message);
276
+ rb_raise(rb_eGLFWError, "%s", message);
277
277
  }
278
278
 
279
279
  void rb_glfw_monitor_callback(GLFWmonitor *monitor, int connected) {
data/ext/glfw/image.c CHANGED
@@ -1,77 +1,77 @@
1
-
2
- #include "image.h"
3
-
4
- VALUE rb_cGLFWimage;
5
-
6
- void Init_glfw_image(VALUE module) {
7
- rb_cGLFWimage = rb_define_class_under(module, "Image", rb_cObject);
8
- rb_define_alloc_func(rb_cGLFWimage, rb_glfw_image_alloc);
9
- rb_define_method(rb_cGLFWimage, "initialize", rb_glfw_image_initialize, -1);
10
-
11
- rb_define_method(rb_cGLFWimage, "width", rb_glfw_image_width, 0);
12
- rb_define_method(rb_cGLFWimage, "height", rb_glfw_image_height, 0);
13
- rb_define_method(rb_cGLFWimage, "pixels", rb_glfw_image_pixels, 0);
14
-
15
- rb_define_alias(rb_cGLFWimage, "columns", "width");
16
- rb_define_alias(rb_cGLFWimage, "rows", "height");
17
- rb_define_alias(rb_cGLFWimage, "to_blob", "pixels");
18
- }
19
-
20
- static VALUE rb_glfw_image_alloc(VALUE klass) {
21
- GLFWimage *image = ALLOC(GLFWimage);
22
- memset(image, 0, sizeof(GLFWimage));
23
- return Data_Wrap_Struct(klass, NULL, RUBY_DEFAULT_FREE, image);
24
- }
25
-
26
- VALUE rb_glfw_image_initialize(int argc, VALUE *argv, VALUE self) {
27
- if (argc == 2 || argc == 3)
28
- {
29
- GLFWimage *image = ALLOC(GLFWimage);
30
- image->width = NUM2INT(argv[0]);
31
- image->height = NUM2INT(argv[1]);
32
-
33
- if (argc == 3)
34
- {
35
- if (RB_TYPE_P(argv[2], T_STRING))
36
- {
37
- image->pixels = StringValuePtr(argv[2]);
38
- }
39
- else
40
- {
41
- uint32_t packed = NUM2UINT(argv[2]);
42
- int size = sizeof(uint32_t) * image->width * image->height;
43
- image->pixels = malloc(size);
44
- memset(image->pixels, packed, size);
45
- }
46
- }
47
- else
48
- {
49
- int size = 4 * image->width * image->height;
50
- image->pixels = malloc(size);
51
- memset(image->pixels, 0, size);
52
- }
53
- RDATA(self)->data = image;
54
- return Qnil;
55
- }
56
-
57
- rb_raise(rb_eArgError, "wrong number of arguments (given %d, expected 2, 3)", argc);
58
- }
59
-
60
- VALUE rb_glfw_image_width(VALUE self) {
61
- GLFWimage *image;
62
- Data_Get_Struct(self, GLFWimage, image);
63
- return INT2NUM(image->width);
64
- }
65
-
66
- VALUE rb_glfw_image_height(VALUE self) {
67
- GLFWimage *image;
68
- Data_Get_Struct(self, GLFWimage, image);
69
- return INT2NUM(image->height);
70
- }
71
-
72
- VALUE rb_glfw_image_pixels(VALUE self) {
73
- GLFWimage *image;
74
- Data_Get_Struct(self, GLFWimage, image);
75
- int size = image->width * image->height * 4;
76
- return rb_str_new(image->pixels, size);
1
+
2
+ #include "image.h"
3
+
4
+ VALUE rb_cGLFWimage;
5
+
6
+ void Init_glfw_image(VALUE module) {
7
+ rb_cGLFWimage = rb_define_class_under(module, "Image", rb_cObject);
8
+ rb_define_alloc_func(rb_cGLFWimage, rb_glfw_image_alloc);
9
+ rb_define_method(rb_cGLFWimage, "initialize", rb_glfw_image_initialize, -1);
10
+
11
+ rb_define_method(rb_cGLFWimage, "width", rb_glfw_image_width, 0);
12
+ rb_define_method(rb_cGLFWimage, "height", rb_glfw_image_height, 0);
13
+ rb_define_method(rb_cGLFWimage, "pixels", rb_glfw_image_pixels, 0);
14
+
15
+ rb_define_alias(rb_cGLFWimage, "columns", "width");
16
+ rb_define_alias(rb_cGLFWimage, "rows", "height");
17
+ rb_define_alias(rb_cGLFWimage, "to_blob", "pixels");
18
+ }
19
+
20
+ static VALUE rb_glfw_image_alloc(VALUE klass) {
21
+ GLFWimage *image = ALLOC(GLFWimage);
22
+ memset(image, 0, sizeof(GLFWimage));
23
+ return Data_Wrap_Struct(klass, NULL, RUBY_DEFAULT_FREE, image);
24
+ }
25
+
26
+ VALUE rb_glfw_image_initialize(int argc, VALUE *argv, VALUE self) {
27
+ if (argc == 2 || argc == 3)
28
+ {
29
+ GLFWimage *image = ALLOC(GLFWimage);
30
+ image->width = NUM2INT(argv[0]);
31
+ image->height = NUM2INT(argv[1]);
32
+
33
+ if (argc == 3)
34
+ {
35
+ if (RB_TYPE_P(argv[2], T_STRING))
36
+ {
37
+ image->pixels = StringValuePtr(argv[2]);
38
+ }
39
+ else
40
+ {
41
+ uint32_t packed = NUM2UINT(argv[2]);
42
+ int size = sizeof(uint32_t) * image->width * image->height;
43
+ image->pixels = malloc(size);
44
+ memset(image->pixels, packed, size);
45
+ }
46
+ }
47
+ else
48
+ {
49
+ int size = 4 * image->width * image->height;
50
+ image->pixels = malloc(size);
51
+ memset(image->pixels, 0, size);
52
+ }
53
+ RDATA(self)->data = image;
54
+ return Qnil;
55
+ }
56
+
57
+ rb_raise(rb_eArgError, "wrong number of arguments (given %d, expected 2, 3)", argc);
58
+ }
59
+
60
+ VALUE rb_glfw_image_width(VALUE self) {
61
+ GLFWimage *image;
62
+ Data_Get_Struct(self, GLFWimage, image);
63
+ return INT2NUM(image->width);
64
+ }
65
+
66
+ VALUE rb_glfw_image_height(VALUE self) {
67
+ GLFWimage *image;
68
+ Data_Get_Struct(self, GLFWimage, image);
69
+ return INT2NUM(image->height);
70
+ }
71
+
72
+ VALUE rb_glfw_image_pixels(VALUE self) {
73
+ GLFWimage *image;
74
+ Data_Get_Struct(self, GLFWimage, image);
75
+ int size = image->width * image->height * 4;
76
+ return rb_str_new(image->pixels, size);
77
77
  }