gametools 0.0.1pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/COPYING +26 -0
- data/README.md +42 -0
- data/lib/gametools.rb +2 -0
- data/lib/gametools/base.rb +331 -0
- data/lib/gametools/transform.rb +74 -0
- data/lib/gametools/version.rb +7 -0
- metadata +66 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f99bcfe5bfa4969e7a8027959e5189d85526da38
|
4
|
+
data.tar.gz: 0fa8d3eda2ac9fc29a7e3b1c77f5c8f08bd34d36
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1776b1e957fff84093c7d0d43c337ffe166845ab5f5485a5525daa8713bc1f47d65acc00d048cd2f63c6bfbddb3ff49947833386af3a70f2615dd65e31796470
|
7
|
+
data.tar.gz: 80b9770d3f3c89cf70de0729d2701ca32240ce96734897fc128f6c86fc96ae9017b5ccc958cb33acd070687daf519fcc50452b330ca90cd671a04544c7aabb22
|
data/COPYING
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
Copyright (c) 2013, Noel Raymond Cower <ncower@gmail.com>.
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
6
|
+
|
7
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
8
|
+
list of conditions and the following disclaimer.
|
9
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
10
|
+
this list of conditions and the following disclaimer in the documentation
|
11
|
+
and/or other materials provided with the distribution.
|
12
|
+
|
13
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
14
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
15
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
16
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
17
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
18
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
19
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
20
|
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
21
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
22
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
23
|
+
|
24
|
+
The views and conclusions contained in the software and documentation are those
|
25
|
+
of the authors and should not be interpreted as representing official policies,
|
26
|
+
either expressed or implied, of the FreeBSD Project.
|
data/README.md
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# GameTools
|
2
|
+
|
3
|
+
# When on rubygems.org
|
4
|
+
$ gem install gametools
|
5
|
+
|
6
|
+
|
7
|
+
# Intro
|
8
|
+
|
9
|
+
GameTools is a gem comprised of various tools for building games, including...
|
10
|
+
|
11
|
+
|
12
|
+
# License
|
13
|
+
|
14
|
+
GameTools is licensed under a simplified BSD license:
|
15
|
+
|
16
|
+
Copyright (c) 2013, Noel Raymond Cower <ncower@gmail.com>.
|
17
|
+
All rights reserved.
|
18
|
+
|
19
|
+
Redistribution and use in source and binary forms, with or without
|
20
|
+
modification, are permitted provided that the following conditions are met:
|
21
|
+
|
22
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
23
|
+
list of conditions and the following disclaimer.
|
24
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
25
|
+
this list of conditions and the following disclaimer in the documentation
|
26
|
+
and/or other materials provided with the distribution.
|
27
|
+
|
28
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
29
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
30
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
31
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
32
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
33
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
34
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
35
|
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
36
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
37
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
38
|
+
|
39
|
+
The views and conclusions contained in the software and documentation are those
|
40
|
+
of the authors and should not be interpreted as representing official policies,
|
41
|
+
either expressed or implied, of the FreeBSD Project.
|
42
|
+
|
data/lib/gametools.rb
ADDED
@@ -0,0 +1,331 @@
|
|
1
|
+
require 'glfw3'
|
2
|
+
|
3
|
+
module GT ; end
|
4
|
+
|
5
|
+
#
|
6
|
+
# Class representation of a base game's initialization and main loop. Includes
|
7
|
+
# overridable methods to handle game / frame logic and rendition, including:
|
8
|
+
#
|
9
|
+
# [init] Called on initialization. By default, sets up GLFW event
|
10
|
+
# callbacks. Any subclass implementation should call its
|
11
|
+
# superclass implementation to ensure callbacks are set up.
|
12
|
+
#
|
13
|
+
# [terminate] Called once the loop ends. By default, this is not
|
14
|
+
# implemented.
|
15
|
+
#
|
16
|
+
# [event] Called when an event is received with named parameters. By
|
17
|
+
# default, this method is not implemented.
|
18
|
+
#
|
19
|
+
# A typical implementation might look like this, if one wanted
|
20
|
+
# to cover most named arguments:
|
21
|
+
#
|
22
|
+
# def event(sender, kind,
|
23
|
+
# x: nil, y: nil, # window_position, window_size, cursor_position,
|
24
|
+
# # framebuffer_size, scroll
|
25
|
+
# focused: nil, # window_focus
|
26
|
+
# iconified: nil, # window_iconify
|
27
|
+
# entered: nil, # cursor_enter
|
28
|
+
# action: nil, # mouse, key
|
29
|
+
# button: nil, # mouse, key
|
30
|
+
# scancode: nil, # key
|
31
|
+
# mods: nil, # mouse, key
|
32
|
+
# char: nil, # char
|
33
|
+
# **args)
|
34
|
+
# # ...
|
35
|
+
# end
|
36
|
+
#
|
37
|
+
# Though, in reality, it is sufficient to only provide the
|
38
|
+
# sender and kind arguments and collect any remaining named
|
39
|
+
# arguments in a Hash.
|
40
|
+
#
|
41
|
+
# [pre_frame] Logic handled before frame updates happen. By default, this
|
42
|
+
# method is unimplemented. It is called after event polling.
|
43
|
+
#
|
44
|
+
# [fixed_frame] Frame logic -- run in a fixed-step loop. Unimplemented by
|
45
|
+
# default.
|
46
|
+
#
|
47
|
+
# [pre_rendition] Anything that must occur before rendition. Similarly, there
|
48
|
+
# is also post_rendition for anything that must happen after
|
49
|
+
# rendition. By default, this is unimplemented.
|
50
|
+
#
|
51
|
+
# [rendition] Rendition. Unimplemented by default.
|
52
|
+
#
|
53
|
+
# [post_rendition] Anything that must occur after rendition. Unimplemented by
|
54
|
+
# default.
|
55
|
+
#
|
56
|
+
# Except for the event method, none of these functions takes any arguments.
|
57
|
+
#
|
58
|
+
#
|
59
|
+
# === Event Kinds
|
60
|
+
#
|
61
|
+
# The event method is always provided with the sender and kind of event being
|
62
|
+
# sent, in addition to any number of named arguments in any order. As a result,
|
63
|
+
# it's a good idea to define those named arguments you would like and accept
|
64
|
+
# any additional arguments via a Hash.
|
65
|
+
#
|
66
|
+
# The events provided by a Glfw window and their arguments are as follows:
|
67
|
+
#
|
68
|
+
# [:refresh] Sent when a window is going to be redrawn. Has no
|
69
|
+
# arguments. Sender is the window whose contents are going
|
70
|
+
# to be redrawn.
|
71
|
+
#
|
72
|
+
# [:window_close] Sent when the user attempts to close a window. Has no
|
73
|
+
# arguments. Sender is the window the user attempted to
|
74
|
+
# close.
|
75
|
+
#
|
76
|
+
# [:window_position] Sent when a window is moved. Has x and y named arguments.
|
77
|
+
# Sender is the moved window.
|
78
|
+
#
|
79
|
+
# [:window_size] Sent when a window is resized. Has x and y named
|
80
|
+
# arguments. Sender is the resized window.
|
81
|
+
#
|
82
|
+
# [:framebuffer_size] Sent when a window's framebuffer is resized. Has x and y
|
83
|
+
# named arguments. Sender is the window whose
|
84
|
+
# framebuffer was resized.
|
85
|
+
#
|
86
|
+
# [:window_iconify] Sent when a window is iconified (e.g., minimized). Has a
|
87
|
+
# named argument, iconify, that is a boolean value for
|
88
|
+
# whether the window was iconified (if false, the window
|
89
|
+
# was de-iconified or restored or whatever term you like).
|
90
|
+
# Sender is the iconified window.
|
91
|
+
#
|
92
|
+
# [:window_focus] Sent when a window's focus is changed. Has a named
|
93
|
+
# argument, focused, for whether the window lost (false) or
|
94
|
+
# gained (true) focus. Sender is the focused window.
|
95
|
+
#
|
96
|
+
# [:cursor_position] Called when the cursor's position changes. Has x and y
|
97
|
+
# named argument. Sender is the currently focused window.
|
98
|
+
#
|
99
|
+
# [:cursor_enter] Sent when a cursor enters a window. Has a named argument,
|
100
|
+
# entered, for whether the cursor entered (true)
|
101
|
+
# or left (false) the window. Sender is the window the
|
102
|
+
# cursor entered or left.
|
103
|
+
#
|
104
|
+
# [:mouse] Sent when a mouse button is pressed or released in a
|
105
|
+
# window. Has named arguments button, action, and mods.
|
106
|
+
# action is either of Glfw::PRESSED or Glfw::RELEASED.
|
107
|
+
# mods is an or'd combination of Glfw modifier key flags.
|
108
|
+
# Sender is the window the mouse button was pressed in.
|
109
|
+
#
|
110
|
+
# [:scroll] Sent for mouse wheel scrolling in a window. Has x and y
|
111
|
+
# named arguments for the scrolling deltas. Sender is the
|
112
|
+
# window the mouse scrolling occurred in.
|
113
|
+
#
|
114
|
+
# [:key] Sent when a keyboard key is pressed, released, or when a
|
115
|
+
# key is repeated. Has button, scancode, action, and mods
|
116
|
+
# named arguments. action is one of Glfw::PRESSED,
|
117
|
+
# Glfw::REPEAT, or Glfw::RELEASED for when a key is pressed,
|
118
|
+
# repeated, or released. scancode is the actual scancode of
|
119
|
+
# the key, whereas button is the button that corresponds to
|
120
|
+
# a Glfw keyboard button constant. mods is an or'd
|
121
|
+
# combination of Glfw modifier key flags. Sender is the
|
122
|
+
# window the keyboard events happened in, typically the
|
123
|
+
# focused window.
|
124
|
+
#
|
125
|
+
# [:char] Sent when a keyboard key is pressed. Has a named argument,
|
126
|
+
# char, which is the integer character for the key pressed.
|
127
|
+
# The value of this depends on the OS. The sender is the
|
128
|
+
# window the event happened in, typically the focused
|
129
|
+
# window.
|
130
|
+
#
|
131
|
+
# === Frames Per Second & Rendition
|
132
|
+
#
|
133
|
+
# The default frames_per_second is 60, though can be changed by setting any
|
134
|
+
# other value appropriate for the game (depending on the game, it may not be
|
135
|
+
# necessary to run at 60 FPS).
|
136
|
+
#
|
137
|
+
# frames_per_second refers to the logic updates, not rendition, which is done
|
138
|
+
# as often as possible depending on the GLFW swap interval. Nothing in the loop
|
139
|
+
# works to limit rendition.
|
140
|
+
#
|
141
|
+
class GT::Base
|
142
|
+
|
143
|
+
# The main window assigned to the loop. Must be set before calling #run.
|
144
|
+
# Additional windows can be hooked up to receive events by passing them to
|
145
|
+
# the #hook_window method.
|
146
|
+
attr_accessor :window
|
147
|
+
|
148
|
+
# Whether the loop is running. To exit the loop, set this to false -- this is
|
149
|
+
# the only way to exit the loop.
|
150
|
+
attr_accessor :running
|
151
|
+
# The frames per second of the loop. This can only be modified when the loop
|
152
|
+
# isn't running.
|
153
|
+
attr_accessor :frames_per_second
|
154
|
+
# Read-only attribute for getting the frame hertz for the loop's frames per
|
155
|
+
# second. This is simply 1000.0 / frames_per_second.
|
156
|
+
attr_reader :frame_hertz
|
157
|
+
# Gets the current simulation time. This increments in frame_hertz steps and
|
158
|
+
# is used for the fixed-step frameloop.
|
159
|
+
attr_reader :simulation_time
|
160
|
+
# The current frame time. This is the beginning time for the current frameloop
|
161
|
+
# and does not change during the frameloop. It is not typically very useful.
|
162
|
+
# If you need a frame time to use, it's better to call Glfw::time and subtract
|
163
|
+
# the base_time from it.
|
164
|
+
attr_reader :frame_time
|
165
|
+
# The base time of the game loop. This is set when #run is called and is used
|
166
|
+
# as the base time for the game loop. To determine an accurate time in
|
167
|
+
# relation to either the simulation_time or frame_time, take the difference
|
168
|
+
# of Glfw::time and base_time. For example:
|
169
|
+
#
|
170
|
+
# current_time = Glfw.time - gameloop.base_time
|
171
|
+
#
|
172
|
+
attr_reader :base_time
|
173
|
+
|
174
|
+
|
175
|
+
#
|
176
|
+
# Allocates a new GameLoop object. Must be given a Glfw window before #run
|
177
|
+
# can be called.
|
178
|
+
#
|
179
|
+
def initialize
|
180
|
+
self.frames_per_second = 60.0
|
181
|
+
@__running = self.running = false
|
182
|
+
@simulation_time = 0.0
|
183
|
+
@frame_time = 0.0
|
184
|
+
end
|
185
|
+
|
186
|
+
#
|
187
|
+
# call-seq:
|
188
|
+
# frames_per_second = new_fps => new_fps
|
189
|
+
#
|
190
|
+
# Sets the loop's frames per second and updates the frame_hertz for the loop.
|
191
|
+
#
|
192
|
+
def frames_per_second=(new_fps)
|
193
|
+
raise "Cannot change FPS while running" if @__running
|
194
|
+
@fps = new_fps
|
195
|
+
@frame_hertz = 1000.0 / @fps.to_f
|
196
|
+
new_fps
|
197
|
+
end
|
198
|
+
|
199
|
+
#
|
200
|
+
# Called before the loop is run to initialize anything. By default, this calls
|
201
|
+
# hook_window with the loop's window. Subclasses should call the superclass
|
202
|
+
# method if implementing it as well.
|
203
|
+
#
|
204
|
+
def init
|
205
|
+
raise "No window provided" unless @window
|
206
|
+
hook_window @window
|
207
|
+
end
|
208
|
+
|
209
|
+
#
|
210
|
+
# Hooks a window up to the GameLoop so that the window's events will be sent
|
211
|
+
# to the GameLoop via event(..) if implemented.
|
212
|
+
#
|
213
|
+
def hook_window(window)
|
214
|
+
loop_self = self
|
215
|
+
window.refresh_callback = ->(window) {
|
216
|
+
if loop_self.respond_to? :event
|
217
|
+
forward = event window, :refresh
|
218
|
+
end
|
219
|
+
}
|
220
|
+
window.close_callback = ->(window) {
|
221
|
+
if loop_self.respond_to? :event
|
222
|
+
forward = event window, :window_close
|
223
|
+
end
|
224
|
+
}
|
225
|
+
|
226
|
+
window.position_callback = ->(window, x, y) {
|
227
|
+
if loop_self.respond_to? :event
|
228
|
+
forward = event window, :window_position, x: x, y: y
|
229
|
+
end
|
230
|
+
}
|
231
|
+
|
232
|
+
window.size_callback = ->(window, x, y) {
|
233
|
+
if loop_self.respond_to? :event
|
234
|
+
forward = event window, :window_size, x: x, y: y
|
235
|
+
end
|
236
|
+
}
|
237
|
+
|
238
|
+
window.framebuffer_size_callback = ->(window, x, y) {
|
239
|
+
if loop_self.respond_to? :event
|
240
|
+
forward = event window, :framebuffer_size, x: x, y: y
|
241
|
+
end
|
242
|
+
}
|
243
|
+
|
244
|
+
window.iconify_callback = ->(window, iconified) {
|
245
|
+
if loop_self.respond_to? :event
|
246
|
+
forward = event window, :window_iconify, iconified: iconified
|
247
|
+
end
|
248
|
+
}
|
249
|
+
|
250
|
+
window.focus_callback = ->(window, focused) {
|
251
|
+
if loop_self.respond_to? :event
|
252
|
+
forward = event window, :window_focus, focused: focused
|
253
|
+
end
|
254
|
+
}
|
255
|
+
|
256
|
+
window.cursor_position_callback = ->(window, x, y) {
|
257
|
+
if loop_self.respond_to? :event
|
258
|
+
forward = event window, :cursor_position, x: x, y: y
|
259
|
+
end
|
260
|
+
}
|
261
|
+
|
262
|
+
window.cursor_enter_callback = ->(window, entered) {
|
263
|
+
if loop_self.respond_to? :event
|
264
|
+
forward = event window, :cursor_enter, entered: entered
|
265
|
+
end
|
266
|
+
}
|
267
|
+
|
268
|
+
window.mouse_button_callback = ->(window, button, action, mods) {
|
269
|
+
if loop_self.respond_to? :event
|
270
|
+
forward = event window, :mouse, button: button, action: action, mods: mods
|
271
|
+
end
|
272
|
+
}
|
273
|
+
|
274
|
+
window.scroll_callback = ->(window, x, y) {
|
275
|
+
if loop_self.respond_to? :event
|
276
|
+
forward = event window, :scroll, x: x, y: y
|
277
|
+
end
|
278
|
+
}
|
279
|
+
|
280
|
+
window.key_callback = ->(window, button, scancode, action, mods) {
|
281
|
+
if loop_self.respond_to? :event
|
282
|
+
event window, :key, button: button, scancode: scancode, action: action,
|
283
|
+
mods: mods
|
284
|
+
end
|
285
|
+
}
|
286
|
+
|
287
|
+
window.char_callback = ->(window, char) {
|
288
|
+
if loop_self.respond_to? :event
|
289
|
+
forward = event window, :char, char: char
|
290
|
+
end
|
291
|
+
}
|
292
|
+
end
|
293
|
+
|
294
|
+
#
|
295
|
+
# Runs the frameloop. Requires a window be assigned to the loop before this
|
296
|
+
# will work, otherwise an exception will be raised.
|
297
|
+
#
|
298
|
+
def run
|
299
|
+
init
|
300
|
+
|
301
|
+
@simulation_time = 0.0
|
302
|
+
self.running = true
|
303
|
+
@base_time = ::Glfw::time
|
304
|
+
hertz = @frame_hertz
|
305
|
+
|
306
|
+
@window.make_context_current
|
307
|
+
|
308
|
+
while (@__running = self.running)
|
309
|
+
|
310
|
+
@actual_time = ::Glfw::time - base_time
|
311
|
+
|
312
|
+
# Pre-logic loop and poll for events
|
313
|
+
::Glfw::poll_events
|
314
|
+
pre_frame if respond_to? :pre_frame
|
315
|
+
|
316
|
+
# Logic loop
|
317
|
+
until @simulation_time > @actual_time
|
318
|
+
fixed_frame if respond_to? :fixed_frame
|
319
|
+
@simulation_time += @frame_hertz
|
320
|
+
end
|
321
|
+
|
322
|
+
# Rendition
|
323
|
+
pre_rendition if respond_to? :pre_rendition
|
324
|
+
rendition if respond_to? :rendition
|
325
|
+
post_rendition if respond_to? :post_rendition
|
326
|
+
end
|
327
|
+
|
328
|
+
terminate if respond_to? :terminate
|
329
|
+
end
|
330
|
+
|
331
|
+
end # class Base
|
@@ -0,0 +1,74 @@
|
|
1
|
+
module GT ; end
|
2
|
+
|
3
|
+
class GT::Transform
|
4
|
+
|
5
|
+
# Applies movement relative to the transform's rotation
|
6
|
+
def move_relative(movement)
|
7
|
+
@translation.add!(@rotation.rotate_vec3(movement))
|
8
|
+
end
|
9
|
+
|
10
|
+
# Applies translation
|
11
|
+
def translate(translation)
|
12
|
+
@translation.add!(translation)
|
13
|
+
end
|
14
|
+
|
15
|
+
# Applies scaling
|
16
|
+
def scale_by(scaling)
|
17
|
+
@scale.multiply!(scaling)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Applies a rotation
|
21
|
+
def rotate(rotation)
|
22
|
+
case rotation
|
23
|
+
when Mat3 then rotate_mat3(rotation)
|
24
|
+
when Quat then rotate_quat(rotation)
|
25
|
+
when Vec3 then rotate_euler(rotation)
|
26
|
+
else raise TypeError, "Invalid type of rotation"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# Sets current translation to the Vec3 translation
|
31
|
+
def translation=(translation)
|
32
|
+
@translation.copy(translation)
|
33
|
+
end
|
34
|
+
|
35
|
+
def translation(out = nil)
|
36
|
+
@translation.copy(out)
|
37
|
+
end
|
38
|
+
|
39
|
+
# Sets current scale to the Vec3 scaling
|
40
|
+
def scale=(scaling)
|
41
|
+
@scale.copy(scaling)
|
42
|
+
end
|
43
|
+
|
44
|
+
# Returns a Vec3
|
45
|
+
def scale(out = nil)
|
46
|
+
@scale.copy(out)
|
47
|
+
end
|
48
|
+
|
49
|
+
def rotation=(rotation)
|
50
|
+
case rotation
|
51
|
+
when Mat3 then self.rotation_mat3 = rotation
|
52
|
+
when Quat then self.rotation_quat = rotation
|
53
|
+
when Vec3 then self.rotation_euler = rotation
|
54
|
+
else raise TypeError, "Invalid type of rotation"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def rotation_mat3=(rotation)
|
59
|
+
@rotation.set(rotation)
|
60
|
+
end
|
61
|
+
|
62
|
+
def rotation_quat=(rotation)
|
63
|
+
@rotation.set(rotation)
|
64
|
+
end
|
65
|
+
|
66
|
+
def rotation_euler=(rotation)
|
67
|
+
end
|
68
|
+
|
69
|
+
# Returns a Mat3
|
70
|
+
def rotation(out = nil)
|
71
|
+
@rotation.copy(out)
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
module GT
|
2
|
+
GAMETOOLS_VERSION = '0.0.1pre1'
|
3
|
+
GAMETOOLS_DATE = '2013-07-28'
|
4
|
+
GAMETOOLS_LICENSE_BRIEF = 'Simplified BSD'
|
5
|
+
GAMETOOLS_PATH = File.expand_path("../../../", __FILE__)
|
6
|
+
GAMETOOLS_LICENSE_FULL = File.open("#{GAMETOOLS_PATH}/COPYING") { |io| io.read }
|
7
|
+
end
|
metadata
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gametools
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1pre1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Noel Raymond Cower
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-07-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: glfw3
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.4.4
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.4.4
|
27
|
+
description: A gem of tools for Ruby game development using GLFW 3 and OpenGL.
|
28
|
+
email: ncower@gmail.com
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files:
|
32
|
+
- README.md
|
33
|
+
- COPYING
|
34
|
+
files:
|
35
|
+
- lib/gametools/base.rb
|
36
|
+
- lib/gametools/transform.rb
|
37
|
+
- lib/gametools/version.rb
|
38
|
+
- lib/gametools.rb
|
39
|
+
- COPYING
|
40
|
+
- README.md
|
41
|
+
homepage: https://github.com/nilium/ruby-gametools
|
42
|
+
licenses:
|
43
|
+
- Simplified BSD
|
44
|
+
metadata: {}
|
45
|
+
post_install_message:
|
46
|
+
rdoc_options: []
|
47
|
+
require_paths:
|
48
|
+
- lib
|
49
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - '>'
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: 1.3.1
|
59
|
+
requirements: []
|
60
|
+
rubyforge_project:
|
61
|
+
rubygems_version: 2.0.5
|
62
|
+
signing_key:
|
63
|
+
specification_version: 4
|
64
|
+
summary: Tools for Ruby game development
|
65
|
+
test_files: []
|
66
|
+
has_rdoc: true
|