glfw 0.1.0 → 0.9.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,87 @@
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 */
Binary file
@@ -6,25 +6,24 @@ require "glfw/version"
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "glfw"
8
8
  spec.version = GLFW::VERSION
9
- spec.authors = ['Eric "ForeverZer0" Freed']
10
- spec.email = ['efreed09@gmail.com']
11
- spec.summary = %q{Ruby wrapper for the latest GLFW library, allowing for creating cross-platform windows with an OpenGL/Vulkan context.}
12
- spec.description = %q{Ruby wrapper for the latest GLFW library, allowing for creating cross-platform windows with an OpenGL/Vulkan context.}
13
- spec.homepage = 'https://github.com/ForeverZer0/glfw'
14
- spec.license = "MIT"
9
+ spec.authors = ["Eric Freed"]
10
+ spec.email = ["efreed09@gmail.com"]
15
11
 
12
+ spec.summary = %q{GLFW is an Open Source, multi-platform library for OpenGL, OpenGL ES and Vulkan development on the desktop. It provides a simple API for creating windows, contexts and surfaces, receiving input and events.}
13
+ spec.description = %q{This is a Ruby C-extension that for the excellent 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}
14
+ spec.homepage = "https://github.com/ForeverZer0/glfw"
15
+ spec.license = "MIT"
16
16
 
17
- # Specify which files should be added to the gem when it is released.
18
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
17
  spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
20
18
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
19
  end
22
- spec.requirements << 'Native GLFW3 binaries.'
23
-
24
20
  spec.bindir = "exe"
25
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
22
  spec.require_paths = ["lib"]
23
+ spec.extensions = ["ext/glfw/extconf.rb"]
27
24
 
28
25
  spec.add_development_dependency "bundler", "~> 1.16"
29
26
  spec.add_development_dependency "rake", "~> 10.0"
27
+ spec.add_development_dependency "rake-compiler", '~> 0'
28
+ spec.add_development_dependency "minitest", "~> 5.0"
30
29
  end
@@ -1,138 +1,32 @@
1
- require_relative 'glfw/version'
2
-
3
- require 'fiddle'
4
- require 'fiddle/import'
1
+ require_relative "glfw/version"
2
+ require_relative "glfw/glfw"
5
3
 
6
4
  module GLFW
7
5
 
8
- extend Fiddle::Importer
9
-
10
- dlload File.expand_path('./glfw3.dll')
11
6
 
12
- typealias 'window', 'void*'
13
- typealias 'monitor', 'void*'
14
- typealias 'string', 'const char*'
15
- typealias 'bool', 'int'
16
7
 
17
- extern 'bool glfwInit(void)'
18
- extern 'window glfwCreateWindow(int, int, string, monitor, window)'
19
- extern 'void glfwShowWindow(window)'
20
- extern 'bool glfwWindowShouldClose(window)'
21
- extern 'void glfwWaitEvents(window)'
8
+ p self.init
22
9
 
23
- puts glfwInit != 0
10
+ p Vulkan.supported?
11
+
24
12
 
25
- window = self.glfwCreateWindow(640, 480, "HOWDY".encode('utf-8'), nil, nil)
13
+ Window.new(800, 600, "Hello, World!") do |window|
26
14
 
27
15
 
16
+ window.make_current
17
+ self.swap_interval(1)
18
+ pixels32 = [0, 0, 255, 255].pack('C*') * (32 * 32)
19
+ pixels16 = [0, 255, 255, 255].pack('C*') * (16 * 16)
28
20
 
29
- glfwShowWindow(window)
21
+ window.set_icon(Image.new(32, 32, pixels32), Image.new(16, 16, pixels16))
30
22
 
31
- while glfwWindowShouldClose(window) == 0
32
-
33
- glfwWaitEvents(window)
23
+ until window.closing?
24
+ self.poll_events
25
+ window.swap_buffers
26
+ end
34
27
 
35
28
  end
36
29
 
37
- p window
38
-
39
-
40
- # glfwCreateCursor
41
- # glfwCreateStandardCursor
42
- # glfwCreateWindowSurface
43
- # glfwDefaultWindowHints
44
- # glfwDestroyCursor
45
- # glfwDestroyWindow
46
- # glfwExtensionSupported
47
- # glfwFocusWindow
48
- # glfwGetClipboardString
49
- # glfwGetCurrentContext
50
- # glfwGetCursorPos
51
- # glfwGetEGLContext
52
- # glfwGetEGLDisplay
53
- # glfwGetEGLSurface
54
- # glfwGetFramebufferSize
55
- # glfwGetGammaRamp
56
- # glfwGetInputMode
57
- # glfwGetInstanceProcAddress
58
- # glfwGetJoystickAxes
59
- # glfwGetJoystickButtons
60
- # glfwGetJoystickName
61
- # glfwGetKey
62
- # glfwGetKeyName
63
- # glfwGetMonitorName
64
- # glfwGetMonitorPhysicalSize
65
- # glfwGetMonitorPos
66
- # glfwGetMonitors
67
- # glfwGetMouseButton
68
- # glfwGetPhysicalDevicePresentationSupport
69
- # glfwGetPrimaryMonitor
70
- # glfwGetProcAddress
71
- # glfwGetRequiredInstanceExtensions
72
- # glfwGetTime
73
- # glfwGetTimerFrequency
74
- # glfwGetTimerValue
75
- # glfwGetVersion
76
- # glfwGetVersionString
77
- # glfwGetVideoMode
78
- # glfwGetVideoModes
79
- # glfwGetWGLContext
80
- # glfwGetWin32Adapter
81
- # glfwGetWin32Monitor
82
- # glfwGetWin32Window
83
- # glfwGetWindowAttrib
84
- # glfwGetWindowFrameSize
85
- # glfwGetWindowMonitor
86
- # glfwGetWindowPos
87
- # glfwGetWindowSize
88
- # glfwGetWindowUserPointer
89
- # glfwHideWindow
90
- # glfwIconifyWindow
91
- # glfwJoystickPresent
92
- # glfwMakeContextCurrent
93
- # glfwMaximizeWindow
94
- # glfwPollEvents
95
- # glfwPostEmptyEvent
96
- # glfwRestoreWindow
97
- # glfwSetCharCallback
98
- # glfwSetCharModsCallback
99
- # glfwSetClipboardString
100
- # glfwSetCursor
101
- # glfwSetCursorEnterCallback
102
- # glfwSetCursorPos
103
- # glfwSetCursorPosCallback
104
- # glfwSetDropCallback
105
- # glfwSetErrorCallback
106
- # glfwSetFramebufferSizeCallback
107
- # glfwSetGamma
108
- # glfwSetGammaRamp
109
- # glfwSetInputMode
110
- # glfwSetJoystickCallback
111
- # glfwSetKeyCallback
112
- # glfwSetMonitorCallback
113
- # glfwSetMouseButtonCallback
114
- # glfwSetScrollCallback
115
- # glfwSetTime
116
- # glfwSetWindowAspectRatio
117
- # glfwSetWindowCloseCallback
118
- # glfwSetWindowFocusCallback
119
- # glfwSetWindowIcon
120
- # glfwSetWindowIconifyCallback
121
- # glfwSetWindowMonitor
122
- # glfwSetWindowPos
123
- # glfwSetWindowPosCallback
124
- # glfwSetWindowRefreshCallback
125
- # glfwSetWindowShouldClose
126
- # glfwSetWindowSize
127
- # glfwSetWindowSizeCallback
128
- # glfwSetWindowSizeLimits
129
- # glfwSetWindowTitle
130
- # glfwSetWindowUserPointer
131
- # glfwSwapBuffers
132
- # glfwSwapInterval
133
- # glfwTerminate
134
- # glfwVulkanSupported
135
- # glfwWaitEventsTimeout
136
- # glfwWindowHint
137
-
30
+ self.terminate
138
31
  end
32
+
@@ -1,3 +1,3 @@
1
1
  module GLFW
2
- VERSION = "0.1.0"
2
+ VERSION = "0.9.8"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glfw
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.9.8
5
5
  platform: ruby
6
6
  authors:
7
- - Eric "ForeverZer0" Freed
7
+ - Eric Freed
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-07-15 00:00:00.000000000 Z
11
+ date: 2018-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,12 +38,44 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
- description: Ruby wrapper for the latest GLFW library, allowing for creating cross-platform
42
- windows with an OpenGL/Vulkan context.
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake-compiler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: minitest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '5.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '5.0'
69
+ description: This is a Ruby C-extension that for the excellent GLFW library. Unlike
70
+ other bindings, this gem goes beyond just providing a 1:1 wrapper of the functions,
71
+ and has been organized to be used in a more object-oriented, Ruby way. Being statically
72
+ linked with the included object file during compilation alleviates any headaches
73
+ with regards to versioning or dependencies, as none are required for this gem
43
74
  email:
44
75
  - efreed09@gmail.com
45
76
  executables: []
46
- extensions: []
77
+ extensions:
78
+ - ext/glfw/extconf.rb
47
79
  extra_rdoc_files: []
48
80
  files:
49
81
  - ".gitignore"
@@ -51,19 +83,38 @@ files:
51
83
  - ".idea/misc.xml"
52
84
  - ".idea/modules.xml"
53
85
  - ".idea/workspace.xml"
54
- - ".rspec"
55
86
  - ".travis.yml"
56
87
  - CODE_OF_CONDUCT.md
57
88
  - Gemfile
58
89
  - LICENSE.txt
90
+ - Makefile
59
91
  - README.md
60
92
  - Rakefile
61
93
  - bin/console
62
94
  - bin/setup
95
+ - ext/glfw/common.h
96
+ - ext/glfw/cursor.c
97
+ - ext/glfw/cursor.h
98
+ - ext/glfw/extconf.rb
99
+ - ext/glfw/glfw.c
100
+ - ext/glfw/glfw.h
101
+ - ext/glfw/glfw3.h
102
+ - ext/glfw/glfw3native.h
103
+ - ext/glfw/image.c
104
+ - ext/glfw/image.h
105
+ - ext/glfw/lib/libglfw3.a
106
+ - ext/glfw/monitor.c
107
+ - ext/glfw/monitor.h
108
+ - ext/glfw/video_mode.c
109
+ - ext/glfw/video_mode.h
110
+ - ext/glfw/vulkan.c
111
+ - ext/glfw/vulkan.h
112
+ - ext/glfw/window.c
113
+ - ext/glfw/window.h
114
+ - glfw-icon.png
63
115
  - glfw.gemspec
64
116
  - lib/glfw.rb
65
117
  - lib/glfw/version.rb
66
- - lib/glfw/window.rb
67
118
  homepage: https://github.com/ForeverZer0/glfw
68
119
  licenses:
69
120
  - MIT
@@ -82,12 +133,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
133
  - - ">="
83
134
  - !ruby/object:Gem::Version
84
135
  version: '0'
85
- requirements:
86
- - Native GLFW3 binaries.
136
+ requirements: []
87
137
  rubyforge_project:
88
138
  rubygems_version: 2.6.14.1
89
139
  signing_key:
90
140
  specification_version: 4
91
- summary: Ruby wrapper for the latest GLFW library, allowing for creating cross-platform
92
- windows with an OpenGL/Vulkan context.
141
+ summary: GLFW is an Open Source, multi-platform library for OpenGL, OpenGL ES and
142
+ Vulkan development on the desktop. It provides a simple API for creating windows,
143
+ contexts and surfaces, receiving input and events.
93
144
  test_files: []
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
@@ -1,12 +0,0 @@
1
- module GLFW
2
- class Window < Fiddle::Pointer
3
-
4
- include Fiddle
5
-
6
- def initialize(width, hight, title, **options)
7
-
8
-
9
-
10
- end
11
- end
12
- end