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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16c2c389d080bc44625d725196247b84be720a1bb2e39ddfc6b23a1b6d34342b
|
4
|
+
data.tar.gz: ac83f1b8c3cfbdb85160e3f42bc537c245e3125180e489ca6871d532c47f2f27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbf849bf4928972a9bc4170ba1938755582b5812f99f32933b61230ebf2b78580f67634ce20f3e622ede0340075286bc9d0509a39b1d41508f5e554c988af1ca
|
7
|
+
data.tar.gz: 45475496435905e7b7c63e56de45cd0e4b8bc5439bc2d5645dd0210a28c86ccb8e1800ec35cf60f78288c3d65b1c3b6149e0b8ff3568d237adeda546c40ea38a
|
data/.gitignore
CHANGED
@@ -15,3 +15,164 @@ MakeFile
|
|
15
15
|
mkmf.log
|
16
16
|
/.idea/
|
17
17
|
/.vscode/
|
18
|
+
|
19
|
+
|
20
|
+
# Created by https://www.gitignore.io/api/ruby,rubymine+all,visualstudiocode
|
21
|
+
# Edit at https://www.gitignore.io/?templates=ruby,rubymine+all,visualstudiocode
|
22
|
+
|
23
|
+
### Ruby ###
|
24
|
+
*.gem
|
25
|
+
*.rbc
|
26
|
+
/.config
|
27
|
+
/coverage/
|
28
|
+
/InstalledFiles
|
29
|
+
/pkg/
|
30
|
+
/spec/reports/
|
31
|
+
/spec/examples.txt
|
32
|
+
/test/tmp/
|
33
|
+
/test/version_tmp/
|
34
|
+
/tmp/
|
35
|
+
|
36
|
+
# Used by dotenv library to load environment variables.
|
37
|
+
# .env
|
38
|
+
|
39
|
+
# Ignore Byebug command history file.
|
40
|
+
.byebug_history
|
41
|
+
|
42
|
+
## Specific to RubyMotion:
|
43
|
+
.dat*
|
44
|
+
.repl_history
|
45
|
+
build/
|
46
|
+
*.bridgesupport
|
47
|
+
build-iPhoneOS/
|
48
|
+
build-iPhoneSimulator/
|
49
|
+
|
50
|
+
## Specific to RubyMotion (use of CocoaPods):
|
51
|
+
#
|
52
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
53
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
54
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
55
|
+
# vendor/Pods/
|
56
|
+
|
57
|
+
## Documentation cache and generated files:
|
58
|
+
/.yardoc/
|
59
|
+
/_yardoc/
|
60
|
+
/doc/
|
61
|
+
/rdoc/
|
62
|
+
|
63
|
+
## Environment normalization:
|
64
|
+
/.bundle/
|
65
|
+
/vendor/bundle
|
66
|
+
/lib/bundler/man/
|
67
|
+
|
68
|
+
# for a library or gem, you might want to ignore these files since the code is
|
69
|
+
# intended to run in multiple environments; otherwise, check them in:
|
70
|
+
# Gemfile.lock
|
71
|
+
# .ruby-version
|
72
|
+
# .ruby-gemset
|
73
|
+
|
74
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
75
|
+
.rvmrc
|
76
|
+
|
77
|
+
### Ruby Patch ###
|
78
|
+
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
|
79
|
+
# .rubocop-https?--*
|
80
|
+
|
81
|
+
### RubyMine+all ###
|
82
|
+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
|
83
|
+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
84
|
+
|
85
|
+
# User-specific stuff
|
86
|
+
.idea/**/workspace.xml
|
87
|
+
.idea/**/tasks.xml
|
88
|
+
.idea/**/usage.statistics.xml
|
89
|
+
.idea/**/dictionaries
|
90
|
+
.idea/**/shelf
|
91
|
+
|
92
|
+
# Generated files
|
93
|
+
.idea/**/contentModel.xml
|
94
|
+
|
95
|
+
# Sensitive or high-churn files
|
96
|
+
.idea/**/dataSources/
|
97
|
+
.idea/**/dataSources.ids
|
98
|
+
.idea/**/dataSources.local.xml
|
99
|
+
.idea/**/sqlDataSources.xml
|
100
|
+
.idea/**/dynamic.xml
|
101
|
+
.idea/**/uiDesigner.xml
|
102
|
+
.idea/**/dbnavigator.xml
|
103
|
+
|
104
|
+
# Gradle
|
105
|
+
.idea/**/gradle.xml
|
106
|
+
.idea/**/libraries
|
107
|
+
|
108
|
+
# Gradle and Maven with auto-import
|
109
|
+
# When using Gradle or Maven with auto-import, you should exclude module files,
|
110
|
+
# since they will be recreated, and may cause churn. Uncomment if using
|
111
|
+
# auto-import.
|
112
|
+
# .idea/modules.xml
|
113
|
+
# .idea/*.iml
|
114
|
+
# .idea/modules
|
115
|
+
# *.iml
|
116
|
+
# *.ipr
|
117
|
+
|
118
|
+
# CMake
|
119
|
+
cmake-build-*/
|
120
|
+
|
121
|
+
# Mongo Explorer plugin
|
122
|
+
.idea/**/mongoSettings.xml
|
123
|
+
|
124
|
+
# File-based project format
|
125
|
+
*.iws
|
126
|
+
|
127
|
+
# IntelliJ
|
128
|
+
out/
|
129
|
+
|
130
|
+
# mpeltonen/sbt-idea plugin
|
131
|
+
.idea_modules/
|
132
|
+
|
133
|
+
# JIRA plugin
|
134
|
+
atlassian-ide-plugin.xml
|
135
|
+
|
136
|
+
# Cursive Clojure plugin
|
137
|
+
.idea/replstate.xml
|
138
|
+
|
139
|
+
# Crashlytics plugin (for Android Studio and IntelliJ)
|
140
|
+
com_crashlytics_export_strings.xml
|
141
|
+
crashlytics.properties
|
142
|
+
crashlytics-build.properties
|
143
|
+
fabric.properties
|
144
|
+
|
145
|
+
# Editor-based Rest Client
|
146
|
+
.idea/httpRequests
|
147
|
+
|
148
|
+
# Android studio 3.1+ serialized cache file
|
149
|
+
.idea/caches/build_file_checksums.ser
|
150
|
+
|
151
|
+
### RubyMine+all Patch ###
|
152
|
+
# Ignores the whole .idea folder and all .iml files
|
153
|
+
# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360
|
154
|
+
|
155
|
+
.idea/
|
156
|
+
|
157
|
+
# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023
|
158
|
+
|
159
|
+
*.iml
|
160
|
+
modules.xml
|
161
|
+
.idea/misc.xml
|
162
|
+
*.ipr
|
163
|
+
|
164
|
+
# Sonarlint plugin
|
165
|
+
.idea/sonarlint
|
166
|
+
|
167
|
+
### VisualStudioCode ###
|
168
|
+
.vscode/*
|
169
|
+
!.vscode/settings.json
|
170
|
+
!.vscode/tasks.json
|
171
|
+
!.vscode/launch.json
|
172
|
+
!.vscode/extensions.json
|
173
|
+
|
174
|
+
### VisualStudioCode Patch ###
|
175
|
+
# Ignore all local history of files
|
176
|
+
.history
|
177
|
+
|
178
|
+
# End of https://www.gitignore.io/api/ruby,rubymine+all,visualstudiocode
|
data/.yardopts
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# ![icon](./glfw-icon.png) GLFW
|
2
2
|
|
3
|
-
This is a Ruby C-extension
|
3
|
+
This is a Ruby C-extension 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
|
-
For Windows
|
7
|
+
For Windows users, the dependencies will automatically be fetched and installed into Ruby's environment using the built-in functionality of MSYS2.
|
8
8
|
|
9
|
-
For Unix
|
9
|
+
For Unix-like systems, simply have GLFW installed globally, and it will be found and linked against during the build process.
|
10
10
|
|
11
11
|
|
12
12
|
### From [RubyGems.org](https://rubygems.org/gems/glfw)
|
@@ -24,14 +24,14 @@ Open a terminal/command prompt in the base directory:
|
|
24
24
|
|
25
25
|
### Window Creation
|
26
26
|
|
27
|
-
At
|
27
|
+
At its simplest, to create a platform-specific window with an OpenGL context requires very little code.
|
28
28
|
|
29
29
|
```ruby
|
30
30
|
GLFW::Window.new(800, 600, "Hello, World!") do |window|
|
31
31
|
|
32
32
|
until window.closing?
|
33
33
|
GLFW.poll_events
|
34
|
-
|
34
|
+
window.swap_buffers
|
35
35
|
# Your rendering code goes here
|
36
36
|
end
|
37
37
|
end
|
@@ -44,53 +44,49 @@ You will likely want to fine-tune the created context to what your application r
|
|
44
44
|
GLFW.init
|
45
45
|
|
46
46
|
# Load default window hints. This will reset any previous hints given
|
47
|
-
GLFW.default_hints
|
47
|
+
GLFW::Window.default_hints
|
48
48
|
|
49
49
|
# Window will be NOT be decorated (title, border, close widget, etc)
|
50
|
-
GLFW.hint(GLFW::HINT_DECORATED, false)
|
50
|
+
GLFW::Window.hint(GLFW::HINT_DECORATED, false)
|
51
51
|
|
52
|
-
#
|
53
|
-
GLFW.hint(GLFW::HINT_CONTEXT_VERSION_MAJOR, 3)
|
54
|
-
GLFW.hint(GLFW::HINT_CONTEXT_VERSION_MAJOR,
|
52
|
+
# Specify MINIMUM required OpenGL version
|
53
|
+
GLFW::Window.hint(GLFW::HINT_CONTEXT_VERSION_MAJOR, 3)
|
54
|
+
GLFW::Window.hint(GLFW::HINT_CONTEXT_VERSION_MAJOR, 3)
|
55
55
|
```
|
56
56
|
|
57
57
|
All constants for creation hints are prefixed with `HINT`.
|
58
58
|
|
59
59
|
### Callbacks
|
60
60
|
|
61
|
-
GLFW offers a high-level of control of the application window, including callbacks for nearly every relevant system event that effects the window (see documentation for what all callbacks are available).
|
61
|
+
GLFW offers a high-level of control of the application window, including callbacks for nearly every relevant system event that effects the window (see documentation for what all callbacks are available). Callbacks are implemented by using Ruby blocks to create a closure that will be invoked the callback fires.
|
62
62
|
|
63
|
-
|
63
|
+
All callbacks in the libaray follow the same idioms:
|
64
64
|
|
65
65
|
```ruby
|
66
|
-
window.
|
67
|
-
|
68
|
-
|
69
|
-
You then have two options; to either alias the `GLFW::Window` class for the relevant callback, or more commonly is to create your own class the inherits from `GLFW::Window`.
|
70
|
-
|
71
|
-
```ruby
|
72
|
-
class MyGame < GLFW::Window
|
73
|
-
|
74
|
-
def initialize
|
75
|
-
super(800, 600, "My Awesome Game Title", fullscreen: true)
|
76
|
-
enable_callback(GLFW::CB_RESIZED, true)
|
77
|
-
end
|
66
|
+
window.on_framebuffer_resize do |width, height|
|
67
|
+
# Block will be called when framebuffer size changes (change projection matrix, viewport, etc.)
|
68
|
+
end
|
78
69
|
|
79
|
-
|
80
|
-
|
81
|
-
# Your code goes here.
|
82
|
-
# The "width/height" arguments passed are the new size
|
83
|
-
end
|
70
|
+
window.on_key do |key, scancode, action, mods|
|
71
|
+
# Block called when keyboard input changes (process keystroke)
|
84
72
|
end
|
73
|
+
|
74
|
+
# Use method without block to unsubscribe from callback
|
75
|
+
window.on_key
|
85
76
|
```
|
86
77
|
|
87
|
-
|
78
|
+
#### Breaking Changes
|
79
|
+
|
80
|
+
Prior versions of the gem used a method of enabling all callbacks via a single method, which would then invoke a
|
81
|
+
pre-defined method that had to be overridden/aliased. Starting with version 3.3.2, this functiionality has been
|
82
|
+
removed in favor of using Ruby blocks, which is more familiar and Ruby-like, as well as being more flexible.
|
88
83
|
|
89
84
|
## Documentation
|
90
85
|
|
91
|
-
The
|
86
|
+
The gem documention can be found [here](), it covers at least minimal coverage of the entire API surface.
|
92
87
|
|
93
|
-
|
88
|
+
For more in depth explanation of some features, the native GLFW library offers a very in-depth and detailed [documentation](http://www.glfw.org/docs/latest/intro_guide.html) that may be used as to augment it, or even as a stand-alone source of information to understanding the library. While not all features will match up
|
89
|
+
with a 1:1 ratio, the naming conventions and idioms are the same and self-explanatory to use the C documentation for the Ruby gem.
|
94
90
|
|
95
91
|
## Contributing
|
96
92
|
|
@@ -100,7 +96,7 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/Foreve
|
|
100
96
|
|
101
97
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
102
98
|
|
103
|
-
|
99
|
+
[GLFW](http://www.glfw.org) is is licensed under the [zlib/libpng](http://www.glfw.org/license.html) license.
|
104
100
|
|
105
101
|
## Code of Conduct
|
106
102
|
|
data/Rakefile
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rake/extensiontask'
|
2
4
|
|
3
5
|
task :build => :compile
|
4
6
|
|
5
|
-
Rake::ExtensionTask.new(
|
6
|
-
ext.lib_dir =
|
7
|
+
Rake::ExtensionTask.new('glfw') do |ext|
|
8
|
+
ext.lib_dir = 'lib/glfw'
|
7
9
|
end
|
8
10
|
|
9
|
-
task :default => [:clobber, :compile
|
11
|
+
task :default => [:clobber, :compile]
|
data/ext/glfw/common.c
ADDED
@@ -0,0 +1,159 @@
|
|
1
|
+
#include "glfw.h"
|
2
|
+
|
3
|
+
VALUE cPoint;
|
4
|
+
VALUE cSize;
|
5
|
+
VALUE cVec2;
|
6
|
+
|
7
|
+
static VALUE rb_glfw_ivec_alloc(VALUE klass)
|
8
|
+
{
|
9
|
+
RBivec2 *ivec = ALLOC(RBivec2);
|
10
|
+
memset(ivec, 0, sizeof(RBivec2));
|
11
|
+
return Data_Wrap_Struct(klass, NULL, RUBY_DEFAULT_FREE, ivec);
|
12
|
+
}
|
13
|
+
|
14
|
+
static VALUE rb_glfw_vec_alloc(VALUE klass)
|
15
|
+
{
|
16
|
+
RBvec2 *vec = ALLOC(RBvec2);
|
17
|
+
memset(vec, 0, sizeof(RBvec2));
|
18
|
+
return Data_Wrap_Struct(klass, NULL, RUBY_DEFAULT_FREE, vec);
|
19
|
+
}
|
20
|
+
|
21
|
+
static VALUE rb_glfw_ivec_get_x(VALUE self)
|
22
|
+
{
|
23
|
+
return INT2NUM(((RBivec2*) DATA_PTR(self))->x);
|
24
|
+
}
|
25
|
+
|
26
|
+
static VALUE rb_glfw_ivec_get_y(VALUE self)
|
27
|
+
{
|
28
|
+
return INT2NUM(((RBivec2*) DATA_PTR(self))->y);
|
29
|
+
}
|
30
|
+
|
31
|
+
static VALUE rb_glfw_ivec_set_x(VALUE self, VALUE value)
|
32
|
+
{
|
33
|
+
RBivec2 *ivec = DATA_PTR(self);
|
34
|
+
ivec->x = NUM2INT(value);
|
35
|
+
return value;
|
36
|
+
}
|
37
|
+
|
38
|
+
static VALUE rb_glfw_ivec_set_y(VALUE self, VALUE value)
|
39
|
+
{
|
40
|
+
RBivec2 *ivec = DATA_PTR(self);
|
41
|
+
ivec->y = NUM2INT(value);
|
42
|
+
return value;
|
43
|
+
}
|
44
|
+
|
45
|
+
|
46
|
+
static VALUE rb_glfw_vec_get_x(VALUE self)
|
47
|
+
{
|
48
|
+
return DBL2NUM(((RBvec2*) DATA_PTR(self))->x);
|
49
|
+
}
|
50
|
+
|
51
|
+
static VALUE rb_glfw_vec_get_y(VALUE self)
|
52
|
+
{
|
53
|
+
return DBL2NUM(((RBvec2*) DATA_PTR(self))->y);
|
54
|
+
}
|
55
|
+
|
56
|
+
static VALUE rb_glfw_vec_set_x(VALUE self, VALUE value)
|
57
|
+
{
|
58
|
+
RBvec2 *vec = DATA_PTR(self);
|
59
|
+
vec->x = NUM2DBL(value);
|
60
|
+
return value;
|
61
|
+
}
|
62
|
+
|
63
|
+
static VALUE rb_glfw_vec_set_y(VALUE self, VALUE value)
|
64
|
+
{
|
65
|
+
RBvec2 *vec = DATA_PTR(self);
|
66
|
+
vec->y = NUM2DBL(value);
|
67
|
+
return value;
|
68
|
+
}
|
69
|
+
|
70
|
+
static VALUE rb_glfw_vec_initialize(VALUE self, VALUE x, VALUE y)
|
71
|
+
{
|
72
|
+
RBvec2 *vec = DATA_PTR(self);
|
73
|
+
vec->x = NUM2DBL(x);
|
74
|
+
vec->y = NUM2DBL(y);
|
75
|
+
return Qnil;
|
76
|
+
}
|
77
|
+
|
78
|
+
static VALUE rb_glfw_ivec_initialize(VALUE self, VALUE x, VALUE y)
|
79
|
+
{
|
80
|
+
RBivec2 *ivec = DATA_PTR(self);
|
81
|
+
ivec->x = NUM2INT(x);
|
82
|
+
ivec->y = NUM2INT(y);
|
83
|
+
return Qnil;
|
84
|
+
}
|
85
|
+
|
86
|
+
static VALUE rb_glfw_ivec_equal(VALUE self, VALUE other)
|
87
|
+
{
|
88
|
+
if (CLASS_OF(self) != CLASS_OF(other))
|
89
|
+
return Qfalse;
|
90
|
+
|
91
|
+
RBivec2 *v1 = DATA_PTR(self), *v2 = DATA_PTR(other);
|
92
|
+
return RB_BOOL(v1->x == v2->x && v1->y == v2->y);
|
93
|
+
}
|
94
|
+
|
95
|
+
static VALUE rb_glfw_ivec_inspect(VALUE self)
|
96
|
+
{
|
97
|
+
RBivec2 *v = DATA_PTR(self);
|
98
|
+
return rb_sprintf("<%d, %d>", v->x, v->y);
|
99
|
+
}
|
100
|
+
|
101
|
+
static VALUE rb_glfw_vec_inspect(VALUE self)
|
102
|
+
{
|
103
|
+
RBvec2 *v = DATA_PTR(self);
|
104
|
+
return rb_sprintf("<%f, %f>", v->x, v->y);
|
105
|
+
}
|
106
|
+
|
107
|
+
VALUE rb_glfw_ivec2_create(VALUE klass, int x, int y)
|
108
|
+
{
|
109
|
+
RBivec2 *ivec = ALLOC(RBivec2);
|
110
|
+
ivec->x = x;
|
111
|
+
ivec->y = y;
|
112
|
+
return Data_Wrap_Struct(klass, NULL, RUBY_DEFAULT_FREE, ivec);
|
113
|
+
}
|
114
|
+
|
115
|
+
VALUE rb_glfw_vec2_create(VALUE klass, double x, double y)
|
116
|
+
{
|
117
|
+
RBvec2 *vec = ALLOC(RBvec2);
|
118
|
+
vec->x = x;
|
119
|
+
vec->y = y;
|
120
|
+
return Data_Wrap_Struct(klass, NULL, RUBY_DEFAULT_FREE, vec);
|
121
|
+
}
|
122
|
+
|
123
|
+
void rb_glfw_common_init(void)
|
124
|
+
{
|
125
|
+
cPoint = rb_define_class_under(mGLFW, "Point", rb_cObject);
|
126
|
+
cSize = rb_define_class_under(mGLFW, "Size", rb_cObject);
|
127
|
+
cVec2 = rb_define_class_under(mGLFW, "Vec2", rb_cObject);
|
128
|
+
|
129
|
+
rb_define_alloc_func(cPoint, rb_glfw_ivec_alloc);
|
130
|
+
rb_define_alloc_func(cSize, rb_glfw_ivec_alloc);
|
131
|
+
rb_define_alloc_func(cSize, rb_glfw_vec_alloc);
|
132
|
+
|
133
|
+
rb_define_method(cPoint, "x", rb_glfw_ivec_get_x, 0);
|
134
|
+
rb_define_method(cPoint, "y", rb_glfw_ivec_get_y, 0);
|
135
|
+
rb_define_method(cPoint, "x=", rb_glfw_ivec_set_x, 1);
|
136
|
+
rb_define_method(cPoint, "y=", rb_glfw_ivec_set_y, 1);
|
137
|
+
|
138
|
+
rb_define_method(cSize, "width", rb_glfw_ivec_get_x, 0);
|
139
|
+
rb_define_method(cSize, "height", rb_glfw_ivec_get_y, 0);
|
140
|
+
rb_define_method(cSize, "width=", rb_glfw_ivec_set_x, 1);
|
141
|
+
rb_define_method(cSize, "height=", rb_glfw_ivec_set_y, 1);
|
142
|
+
|
143
|
+
rb_define_method(cVec2, "x", rb_glfw_vec_get_x, 0);
|
144
|
+
rb_define_method(cVec2, "y", rb_glfw_vec_get_y, 0);
|
145
|
+
rb_define_method(cVec2, "x=", rb_glfw_vec_set_x, 1);
|
146
|
+
rb_define_method(cVec2, "y=", rb_glfw_vec_set_y, 1);
|
147
|
+
|
148
|
+
rb_define_method(cPoint, "==", rb_glfw_ivec_equal, 1);
|
149
|
+
rb_define_method(cPoint, "eql?", rb_glfw_ivec_equal, 1);
|
150
|
+
rb_define_method(cSize, "==", rb_glfw_ivec_equal, 1);
|
151
|
+
rb_define_method(cSize, "eql?", rb_glfw_ivec_equal, 1);
|
152
|
+
rb_define_method(cPoint, "inspect", rb_glfw_ivec_inspect, 0);
|
153
|
+
rb_define_method(cSize, "inspect", rb_glfw_ivec_inspect, 0);
|
154
|
+
rb_define_method(cVec2, "inspect", rb_glfw_vec_inspect, 0);
|
155
|
+
|
156
|
+
rb_define_method(cPoint, "initialize", rb_glfw_ivec_initialize, 2);
|
157
|
+
rb_define_method(cSize, "initialize", rb_glfw_ivec_initialize, 2);
|
158
|
+
rb_define_method(cVec2, "initialize", rb_glfw_vec_initialize, 2);
|
159
|
+
}
|