glfw 1.0.3 → 3.3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +161 -0
- data/.yardopts +6 -0
- data/Gemfile +2 -4
- data/README.md +29 -33
- data/Rakefile +6 -4
- data/ext/glfw/common.c +159 -0
- data/ext/glfw/cursor.c +34 -30
- data/ext/glfw/extconf.rb +7 -17
- data/ext/glfw/glfw.c +122 -377
- data/ext/glfw/glfw.h +46 -41
- data/ext/glfw/image.c +96 -64
- data/ext/glfw/joystick.c +169 -0
- data/ext/glfw/monitor.c +231 -155
- data/ext/glfw/stb_image.h +7656 -0
- data/ext/glfw/window.c +708 -576
- data/glfw.gemspec +10 -9
- data/lib/glfw.rb +4 -14
- data/lib/glfw/constants.rb +365 -0
- data/lib/glfw/stubs.rb +234 -0
- data/lib/glfw/stubs/cursor.rb +21 -0
- data/lib/glfw/stubs/gamepad_state.rb +30 -0
- data/lib/glfw/stubs/image.rb +39 -0
- data/lib/glfw/stubs/joystick.rb +125 -0
- data/lib/glfw/stubs/monitor.rb +115 -0
- data/lib/glfw/stubs/video_mode.rb +32 -0
- data/lib/glfw/stubs/window.rb +626 -0
- data/lib/glfw/version.rb +8 -1
- metadata +31 -35
- data/.travis.yml +0 -5
- data/Makefile +0 -267
- data/ext/glfw/common.h +0 -46
- data/ext/glfw/cursor.h +0 -14
- data/ext/glfw/glfw3.h +0 -4248
- data/ext/glfw/glfw3native.h +0 -456
- data/ext/glfw/image.h +0 -14
- data/ext/glfw/ming32/WINDOWS USERS PLACE libglf3.a HERE.txt b/data/ext/glfw/ming32/WINDOWS USERS PLACE libglf3.a → HERE.txt +0 -0
- data/ext/glfw/ming64/WINDOWS USERS PLACE libglf3.a HERE.txt b/data/ext/glfw/ming64/WINDOWS USERS PLACE libglf3.a → HERE.txt +0 -0
- data/ext/glfw/monitor.h +0 -29
- data/ext/glfw/video_mode.c +0 -60
- data/ext/glfw/video_mode.h +0 -21
- data/ext/glfw/vulkan.c +0 -48
- data/ext/glfw/vulkan.h +0 -16
- data/ext/glfw/window.h +0 -87
data/ext/glfw/image.h
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
|
2
|
-
#ifndef GLFW_RB_IMAGE_H
|
3
|
-
#define GLFW_RB_IMAGE_H 1
|
4
|
-
|
5
|
-
#include "common.h"
|
6
|
-
|
7
|
-
void Init_glfw_image(VALUE module);
|
8
|
-
static VALUE rb_glfw_image_alloc(VALUE klass);
|
9
|
-
VALUE rb_glfw_image_initialize(int argc, VALUE *argv, VALUE self);
|
10
|
-
VALUE rb_glfw_image_width(VALUE self);
|
11
|
-
VALUE rb_glfw_image_height(VALUE self);
|
12
|
-
VALUE rb_glfw_image_pixels(VALUE self);
|
13
|
-
|
14
|
-
#endif /* GLFW_RB_IMAGE_H */
|
File without changes
|
File without changes
|
data/ext/glfw/monitor.h
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
|
2
|
-
#ifndef GLFW_RB_MONITOR_H
|
3
|
-
#define GLFW_RB_MONITOR_H 1
|
4
|
-
|
5
|
-
#include "common.h"
|
6
|
-
#include "monitor.h"
|
7
|
-
|
8
|
-
#define MONITOR() \
|
9
|
-
GLFWmonitor *m; \
|
10
|
-
Data_Get_Struct(self, GLFWmonitor, m)
|
11
|
-
|
12
|
-
void Init_glfw_monitor(VALUE module);
|
13
|
-
static VALUE rb_glfw_monitor_alloc(VALUE klass);
|
14
|
-
VALUE rb_glfw_monitor_name(VALUE self);
|
15
|
-
VALUE rb_glfw_monitor_pos(VALUE self);
|
16
|
-
VALUE rb_glfw_monitor_size(VALUE self);
|
17
|
-
VALUE rb_glfw_monitor_x(VALUE self);
|
18
|
-
VALUE rb_glfw_monitor_y(VALUE self);
|
19
|
-
VALUE rb_glfw_monitor_width(VALUE self);
|
20
|
-
VALUE rb_glfw_monitor_height(VALUE self);
|
21
|
-
VALUE rb_glfw_monitor_dimensions(VALUE self);
|
22
|
-
VALUE rb_glfw_monitor_get_gamma_ramp(VALUE self);
|
23
|
-
VALUE rb_glfw_monitor_set_gamma_ramp(int argc, VALUE *argv, VALUE self);
|
24
|
-
VALUE rb_glfw_monitor_gamma(VALUE self, VALUE exponent);
|
25
|
-
VALUE rb_glfw_monitor_video_mode(VALUE self);
|
26
|
-
VALUE rb_glfw_monitor_video_modes(VALUE self);
|
27
|
-
VALUE rb_glfw_monitor_primary(VALUE klass);
|
28
|
-
|
29
|
-
#endif /* GLFW_RB_MONITOR_H */
|
data/ext/glfw/video_mode.c
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
|
2
|
-
#include "video_mode.h"
|
3
|
-
|
4
|
-
VALUE rb_cGLFWvidmode;
|
5
|
-
|
6
|
-
void Init_glfw_vidmode(VALUE module) {
|
7
|
-
rb_cGLFWvidmode = rb_define_class_under(module, "VideoMode", rb_cObject);
|
8
|
-
|
9
|
-
rb_define_method(rb_cGLFWvidmode, "width", rb_glfw_vidmode_width, 0);
|
10
|
-
rb_define_method(rb_cGLFWvidmode, "height", rb_glfw_vidmode_height, 0);
|
11
|
-
rb_define_method(rb_cGLFWvidmode, "red_bits", rb_glfw_vidmode_red_bits, 0);
|
12
|
-
rb_define_method(rb_cGLFWvidmode, "green_bits", rb_glfw_vidmode_green_bits, 0);
|
13
|
-
rb_define_method(rb_cGLFWvidmode, "blue_bits", rb_glfw_vidmode_blue_bits, 0);
|
14
|
-
rb_define_method(rb_cGLFWvidmode, "refresh_rate", rb_glfw_vidmode_refresh_rate, 0);
|
15
|
-
|
16
|
-
rb_define_method(rb_cGLFWvidmode, "to_s", rb_glfw_vidmode_to_s, 0);
|
17
|
-
rb_funcall(rb_cGLFWvidmode, rb_intern("private_class_method"), 1, STR2SYM("new"));
|
18
|
-
}
|
19
|
-
|
20
|
-
static VALUE rb_glfw_vidmode_alloc(VALUE klass) {
|
21
|
-
GLFWvidmode *v = ALLOC(GLFWvidmode);
|
22
|
-
memset(v, 0, sizeof(GLFWvidmode));
|
23
|
-
return Data_Wrap_Struct(klass, NULL, RUBY_DEFAULT_FREE, v);
|
24
|
-
}
|
25
|
-
|
26
|
-
VALUE rb_glfw_vidmode_width(VALUE self) {
|
27
|
-
VIDMODE();
|
28
|
-
return INT2NUM(v->width);
|
29
|
-
}
|
30
|
-
|
31
|
-
VALUE rb_glfw_vidmode_height(VALUE self) {
|
32
|
-
VIDMODE();
|
33
|
-
return INT2NUM(v->height);
|
34
|
-
}
|
35
|
-
|
36
|
-
VALUE rb_glfw_vidmode_red_bits(VALUE self) {
|
37
|
-
VIDMODE();
|
38
|
-
return INT2NUM(v->redBits);
|
39
|
-
}
|
40
|
-
|
41
|
-
VALUE rb_glfw_vidmode_green_bits(VALUE self) {
|
42
|
-
VIDMODE();
|
43
|
-
return INT2NUM(v->greenBits);
|
44
|
-
}
|
45
|
-
|
46
|
-
VALUE rb_glfw_vidmode_blue_bits(VALUE self) {
|
47
|
-
VIDMODE();
|
48
|
-
return INT2NUM(v->blueBits);
|
49
|
-
}
|
50
|
-
|
51
|
-
VALUE rb_glfw_vidmode_refresh_rate(VALUE self) {
|
52
|
-
VIDMODE();
|
53
|
-
return INT2NUM(v->refreshRate);
|
54
|
-
}
|
55
|
-
|
56
|
-
VALUE rb_glfw_vidmode_to_s(VALUE self) {
|
57
|
-
VIDMODE();
|
58
|
-
return rb_sprintf("<%s: width:%d, height:%d, r:%d, g:%d, b:%d, rate:%dhz",
|
59
|
-
rb_class2name(CLASS_OF(self)), v->width, v->height, v->redBits, v->greenBits, v->blueBits, v->refreshRate);
|
60
|
-
}
|
data/ext/glfw/video_mode.h
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
#ifndef GLFW_RB_VIDEOMODE_H
|
2
|
-
#define GLFW_RB_VIDEOMODE_H 1
|
3
|
-
|
4
|
-
#include "common.h"
|
5
|
-
|
6
|
-
#define VIDMODE() \
|
7
|
-
GLFWvidmode *v; \
|
8
|
-
Data_Get_Struct(self, GLFWvidmode, v)
|
9
|
-
|
10
|
-
void Init_glfw_vidmode(VALUE module);
|
11
|
-
static VALUE rb_glfw_vidmode_alloc(VALUE klass);
|
12
|
-
|
13
|
-
VALUE rb_glfw_vidmode_width(VALUE self);
|
14
|
-
VALUE rb_glfw_vidmode_height(VALUE self);
|
15
|
-
VALUE rb_glfw_vidmode_red_bits(VALUE self);
|
16
|
-
VALUE rb_glfw_vidmode_green_bits(VALUE self);
|
17
|
-
VALUE rb_glfw_vidmode_blue_bits(VALUE self);
|
18
|
-
VALUE rb_glfw_vidmode_refresh_rate(VALUE self);
|
19
|
-
VALUE rb_glfw_vidmode_to_s(VALUE self);
|
20
|
-
|
21
|
-
#endif /* GLFW_RB_VIDEOMODE_H */
|
data/ext/glfw/vulkan.c
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
|
2
|
-
#include "vulkan.h"
|
3
|
-
|
4
|
-
VALUE rb_cGLFWvulkan;
|
5
|
-
|
6
|
-
void Init_glfw_vulkan(VALUE module) {
|
7
|
-
rb_cGLFWvulkan = rb_define_class_under(module, "Vulkan", rb_cObject);
|
8
|
-
|
9
|
-
rb_define_method(rb_cGLFWvulkan, "create_surface", rb_glfw_vulkan_create_surface, 2);
|
10
|
-
rb_define_method(rb_cGLFWvulkan, "proc_address", rb_glfw_vulkan_proc_address, 1);
|
11
|
-
rb_define_method(rb_cGLFWvulkan, "device_support", rb_glfw_vulkan_device_support, 2);
|
12
|
-
|
13
|
-
rb_define_singleton_method(rb_cGLFWvulkan, "supported?", rb_glfw_vulkan_supported, 0);
|
14
|
-
rb_define_singleton_method(rb_cGLFWvulkan, "required_extensions", rb_glfw_vulkan_required_ext, 0);
|
15
|
-
|
16
|
-
// TODO: Implement once Vulkan support is better in GLFW
|
17
|
-
rb_funcall(rb_cGLFWvulkan, rb_intern("private_class_method"), 1, STR2SYM("new"));
|
18
|
-
}
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
VALUE rb_glfw_vulkan_supported(VALUE klass) {
|
23
|
-
return glfwVulkanSupported() ? Qtrue : Qfalse;
|
24
|
-
}
|
25
|
-
|
26
|
-
VALUE rb_glfw_vulkan_required_ext(VALUE klass) {
|
27
|
-
uint32_t count;
|
28
|
-
const char **exts = glfwGetRequiredInstanceExtensions(&count);
|
29
|
-
VALUE ary = rb_ary_new_capa(count);
|
30
|
-
for (int i = 0; i < count; i++)
|
31
|
-
rb_ary_store(ary, i, rb_str_new_cstr(exts[i]));
|
32
|
-
return ary;
|
33
|
-
}
|
34
|
-
|
35
|
-
VALUE rb_glfw_vulkan_create_surface(VALUE self, VALUE window, VALUE allocator) {
|
36
|
-
// TODO: glfwCreateWindowSurface
|
37
|
-
return Qnil;
|
38
|
-
}
|
39
|
-
|
40
|
-
VALUE rb_glfw_vulkan_proc_address(VALUE self, VALUE name) {
|
41
|
-
// TODO: glfwGetInstanceProcAddress
|
42
|
-
return Qnil;
|
43
|
-
}
|
44
|
-
|
45
|
-
VALUE rb_glfw_vulkan_device_support(VALUE self, VALUE device, VALUE family) {
|
46
|
-
// TODO: glfwGetPhysicalDevicePresentationSupport
|
47
|
-
return Qnil;
|
48
|
-
}
|
data/ext/glfw/vulkan.h
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
|
2
|
-
#ifndef GLFW_RB_VULKAN_H
|
3
|
-
#define GLFW_RB_VULKAN_H 1
|
4
|
-
|
5
|
-
#include "common.h"
|
6
|
-
|
7
|
-
void Init_glfw_vulkan(VALUE module);
|
8
|
-
|
9
|
-
VALUE rb_glfw_vulkan_supported(VALUE klass);
|
10
|
-
VALUE rb_glfw_vulkan_required_ext(VALUE klass);
|
11
|
-
|
12
|
-
VALUE rb_glfw_vulkan_create_surface(VALUE self, VALUE window, VALUE allocator);
|
13
|
-
VALUE rb_glfw_vulkan_proc_address(VALUE self, VALUE name);
|
14
|
-
VALUE rb_glfw_vulkan_device_support(VALUE self, VALUE device, VALUE family);
|
15
|
-
|
16
|
-
#endif /* GLFW_RB_VULKAN_H */
|
data/ext/glfw/window.h
DELETED
@@ -1,87 +0,0 @@
|
|
1
|
-
|
2
|
-
#ifndef GLFW_RB_WINDOW_H
|
3
|
-
#define GLFW_RB_WINDOW_H 1
|
4
|
-
|
5
|
-
#include "common.h"
|
6
|
-
|
7
|
-
void Init_glfw_window(VALUE mmodule);
|
8
|
-
|
9
|
-
static VALUE rb_glfw_window_alloc(VALUE klass);
|
10
|
-
VALUE rb_glfw_window_initialize(int argc, VALUE *argv, VALUE self);
|
11
|
-
VALUE rb_glfw_window_destroy(VALUE self);
|
12
|
-
VALUE rb_glfw_window_show(VALUE self);
|
13
|
-
VALUE rb_glfw_window_hide(VALUE self);
|
14
|
-
VALUE rb_glfw_window_minimize(VALUE self);
|
15
|
-
VALUE rb_glfw_window_maximize(VALUE self);
|
16
|
-
VALUE rb_glfw_window_restore(VALUE self);
|
17
|
-
VALUE rb_glfw_window_focus(VALUE self);
|
18
|
-
VALUE rb_glfw_window_swap_buffers(VALUE self);
|
19
|
-
VALUE rb_glfw_window_make_current(VALUE self);
|
20
|
-
VALUE rb_glfw_window_dimensions(VALUE self);
|
21
|
-
VALUE rb_glfw_window_get_pos(VALUE self);
|
22
|
-
VALUE rb_glfw_window_set_pos(VALUE self, VALUE x, VALUE y);
|
23
|
-
VALUE rb_glfw_window_get_size(VALUE self);
|
24
|
-
VALUE rb_glfw_window_set_size(VALUE self, VALUE width, VALUE height);
|
25
|
-
VALUE rb_glfw_window_get_x(VALUE self);
|
26
|
-
VALUE rb_glfw_window_get_y(VALUE self);
|
27
|
-
VALUE rb_glfw_window_set_x(VALUE self, VALUE x);
|
28
|
-
VALUE rb_glfw_window_set_y(VALUE self, VALUE y);
|
29
|
-
VALUE rb_glfw_window_get_width(VALUE self);
|
30
|
-
VALUE rb_glfw_window_get_height(VALUE self);
|
31
|
-
VALUE rb_glfw_window_set_width(VALUE self, VALUE width);
|
32
|
-
VALUE rb_glfw_window_set_height(VALUE self, VALUE height);
|
33
|
-
VALUE rb_glfw_window_get_framebuffer_size(VALUE self);
|
34
|
-
VALUE rb_glfw_window_closing_p(VALUE self);
|
35
|
-
VALUE rb_glfw_window_close(int argc, VALUE *argv, VALUE self);
|
36
|
-
VALUE rb_glfw_window_get_monitor(VALUE self);
|
37
|
-
VALUE rb_glfw_window_set_monitor(int argc, VALUE *argv, VALUE self);
|
38
|
-
VALUE rb_glfw_window_set_title(VALUE self, volatile VALUE title);
|
39
|
-
VALUE rb_glfw_window_focused_p(VALUE self);
|
40
|
-
VALUE rb_glfw_window_minimized_p(VALUE self);
|
41
|
-
VALUE rb_glfw_window_maximized_p(VALUE self);
|
42
|
-
VALUE rb_glfw_window_visible_p(VALUE self);
|
43
|
-
VALUE rb_glfw_window_resizable_p(VALUE self);
|
44
|
-
VALUE rb_glfw_window_decorated_p(VALUE self);
|
45
|
-
VALUE rb_glfw_window_floating_p(VALUE self);
|
46
|
-
VALUE rb_glfw_window_aspect_ratio(VALUE self, VALUE numerator, VALUE denominator);
|
47
|
-
VALUE rb_glfw_window_limits(VALUE self, VALUE minWidth, VALUE minHeight, VALUE maxWidth, VALUE maxHeight);
|
48
|
-
VALUE rb_glfw_window_frame_size(VALUE self);
|
49
|
-
VALUE rb_glfw_window_get_clipboard(VALUE self);
|
50
|
-
VALUE rb_glfw_window_set_clipboard(VALUE self, VALUE str);
|
51
|
-
VALUE rb_glfw_window_set_icon(VALUE self, VALUE args);
|
52
|
-
VALUE rb_glfw_window_get_input_cursor(VALUE self);
|
53
|
-
VALUE rb_glfw_window_set_input_cursor(VALUE self, VALUE value);
|
54
|
-
VALUE rb_glfw_window_get_input_sticky_keys(VALUE self);
|
55
|
-
VALUE rb_glfw_window_set_input_sticky_keys(VALUE self, VALUE value);
|
56
|
-
VALUE rb_glfw_window_get_input_sticky_mouse(VALUE self);
|
57
|
-
VALUE rb_glfw_window_set_input_sticky_mouse(VALUE self, VALUE value);
|
58
|
-
VALUE rb_glfw_window_cursor_pos(VALUE self);
|
59
|
-
VALUE rb_glfw_window_set_cursor_pos(VALUE self, VALUE x, VALUE y);
|
60
|
-
VALUE rb_glfw_window_set_cursor(VALUE self, VALUE cursor);
|
61
|
-
VALUE rb_glfw_window_get_key(VALUE self, VALUE key);
|
62
|
-
VALUE rb_glfw_window_get_mouse_button(VALUE self, VALUE mbtn);
|
63
|
-
|
64
|
-
/////////////////////////////////////////////////////////////////////////////
|
65
|
-
// Callbacks
|
66
|
-
/////////////////////////////////////////////////////////////////////////////
|
67
|
-
|
68
|
-
VALUE rb_glfw_window_enable_callback(VALUE self, VALUE sym, VALUE enable);
|
69
|
-
VALUE rb_glfw_window_empty_method(int argc, VALUE *argv, VALUE self);
|
70
|
-
|
71
|
-
static void rb_glfw_window_closing(GLFWwindow *window);
|
72
|
-
static void rb_glfw_window_moved(GLFWwindow *window, int x, int y);
|
73
|
-
static void rb_glfw_window_resized(GLFWwindow *window, int width, int height);
|
74
|
-
static void rb_glfw_window_refreshed(GLFWwindow *window);
|
75
|
-
static void rb_glfw_window_focus_changed(GLFWwindow *window, int focus);
|
76
|
-
static void rb_glfw_window_minimize_changed(GLFWwindow *window, int minimized);
|
77
|
-
static void rb_glfw_window_frame_buffer_resized(GLFWwindow *window, int width, int height);
|
78
|
-
static void rb_glfw_window_cursor_mouse_move(GLFWwindow *window, double x, double y);
|
79
|
-
static void rb_glfw_window_cursor_mouse_button(GLFWwindow *window, int button, int action, int mods);
|
80
|
-
static void rb_glfw_window_cursor_mouse_scroll(GLFWwindow *window, double xoffset, double yoffset);
|
81
|
-
static void rb_glfw_window_key(GLFWwindow *window, int key, int scancode, int action, int mods);
|
82
|
-
static void rb_glfw_window_char(GLFWwindow *window, unsigned int codepoint);
|
83
|
-
static void rb_glfw_window_char_mods(GLFWwindow *window, unsigned int codepoint, int mods);
|
84
|
-
static void rb_glfw_window_file_drop(GLFWwindow *window, int count, const char** files);
|
85
|
-
static void rb_glfw_window_mouse_enter(GLFWwindow *window, int entered);
|
86
|
-
|
87
|
-
#endif /* GLFW_RB_WINDOW_H */
|