cyberarm_engine 0.23.0 → 0.24.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/assets/shaders/fragment/g_buffer.glsl +8 -8
  3. data/assets/shaders/fragment/lighting.glsl +15 -9
  4. data/assets/shaders/include/material_struct.glsl +16 -0
  5. data/assets/shaders/vertex/g_buffer.glsl +17 -17
  6. data/assets/shaders/vertex/lighting.glsl +16 -9
  7. data/lib/cyberarm_engine/builtin/intro_state.rb +1 -1
  8. data/lib/cyberarm_engine/common.rb +2 -2
  9. data/lib/cyberarm_engine/console.rb +10 -10
  10. data/lib/cyberarm_engine/game_object.rb +1 -1
  11. data/lib/cyberarm_engine/gosu_ext/draw_arc.rb +98 -0
  12. data/lib/cyberarm_engine/gosu_ext/draw_circle.rb +31 -0
  13. data/lib/cyberarm_engine/gosu_ext/draw_path.rb +17 -0
  14. data/lib/cyberarm_engine/model.rb +7 -6
  15. data/lib/cyberarm_engine/notification.rb +83 -0
  16. data/lib/cyberarm_engine/notification_manager.rb +242 -0
  17. data/lib/cyberarm_engine/opengl/renderer/opengl_renderer.rb +16 -10
  18. data/lib/cyberarm_engine/opengl/renderer/renderer.rb +12 -1
  19. data/lib/cyberarm_engine/opengl/shader.rb +2 -2
  20. data/lib/cyberarm_engine/stats.rb +181 -10
  21. data/lib/cyberarm_engine/text.rb +3 -0
  22. data/lib/cyberarm_engine/ui/element.rb +45 -14
  23. data/lib/cyberarm_engine/ui/elements/container.rb +86 -27
  24. data/lib/cyberarm_engine/ui/elements/slider.rb +4 -3
  25. data/lib/cyberarm_engine/ui/elements/text_block.rb +11 -1
  26. data/lib/cyberarm_engine/ui/gui_state.rb +28 -18
  27. data/lib/cyberarm_engine/ui/style.rb +2 -1
  28. data/lib/cyberarm_engine/vector.rb +35 -16
  29. data/lib/cyberarm_engine/version.rb +1 -1
  30. data/lib/cyberarm_engine/window.rb +35 -8
  31. data/lib/cyberarm_engine.rb +8 -2
  32. data/mrbgem.rake +29 -0
  33. metadata +10 -3
@@ -20,7 +20,10 @@ module CyberarmEngine
20
20
  @gui_state = options.delete(:gui_state)
21
21
  super
22
22
 
23
+ @last_scroll_position = Vector.new(0, 0)
23
24
  @scroll_position = Vector.new(0, 0)
25
+ @scroll_target_position = Vector.new(0, 0)
26
+ @scroll_chunk = 120
24
27
  @scroll_speed = 40
25
28
 
26
29
  @text_color = options[:color]
@@ -33,17 +36,17 @@ module CyberarmEngine
33
36
  def build
34
37
  @block.call(self) if @block
35
38
 
36
- root.gui_state.request_recalculate
39
+ root.gui_state.request_recalculate_for(self)
37
40
  end
38
41
 
39
42
  def add(element)
40
43
  @children << element
41
44
 
42
- root.gui_state.request_recalculate
45
+ root.gui_state.request_recalculate_for(self)
43
46
  end
44
47
 
45
48
  def remove(element)
46
- root.gui_state.request_recalculate if @children.delete(element)
49
+ root.gui_state.request_recalculate_for(self) if @children.delete(element)
47
50
  end
48
51
 
49
52
  def clear(&block)
@@ -56,7 +59,7 @@ module CyberarmEngine
56
59
 
57
60
  CyberarmEngine::Element::Container.current_container = old_container
58
61
 
59
- root.gui_state.request_recalculate
62
+ root.gui_state.request_recalculate_for(self)
60
63
  end
61
64
 
62
65
  def append(&block)
@@ -67,7 +70,7 @@ module CyberarmEngine
67
70
 
68
71
  CyberarmEngine::Element::Container.current_container = old_container
69
72
 
70
- root.gui_state.request_recalculate
73
+ root.gui_state.request_recalculate_for(self)
71
74
  end
72
75
 
73
76
  def render
@@ -77,7 +80,9 @@ module CyberarmEngine
77
80
  content_width + 1,
78
81
  content_height + 1
79
82
  ) do
80
- @children.each(&:draw)
83
+ Gosu.translate(@scroll_position.x, @scroll_position.y) do
84
+ @children.each(&:draw)
85
+ end
81
86
  end
82
87
  end
83
88
 
@@ -90,35 +95,74 @@ module CyberarmEngine
90
95
  end
91
96
 
92
97
  def update
98
+ update_scroll
93
99
  @children.each(&:update)
94
100
  end
95
101
 
96
102
  def hit_element?(x, y)
97
103
  return unless hit?(x, y)
98
104
 
105
+ # Offset child hit point by scroll position/offset
106
+ child_x = x - @scroll_position.x
107
+ child_y = y - @scroll_position.y
108
+
99
109
  @children.reverse_each do |child|
100
110
  next unless child.visible?
101
111
 
102
112
  case child
103
113
  when Container
104
- if element = child.hit_element?(x, y)
114
+ if element = child.hit_element?(child_x, child_y)
105
115
  return element
106
116
  end
107
117
  else
108
- return child if child.hit?(x, y)
118
+ return child if child.hit?(child_x, child_y)
109
119
  end
110
120
  end
111
121
 
112
122
  self if hit?(x, y)
113
123
  end
114
124
 
125
+ def update_child_element_visibity(child)
126
+ child.element_visible = child.x >= (@x - @scroll_position.x) - child.width && child.x <= (@x - @scroll_position.x) + width &&
127
+ child.y >= (@y - @scroll_position.y) - child.height && child.y <= (@y - @scroll_position.y) + height
128
+ end
129
+
130
+ def update_scroll
131
+ dt = window.dt > 1 ? 1.0 : window.dt
132
+
133
+ scroll_x_diff = (@scroll_target_position.x - @scroll_position.x)
134
+ scroll_y_diff = (@scroll_target_position.y - @scroll_position.y)
135
+
136
+ @scroll_position.x += (scroll_x_diff * @scroll_speed * 0.25 * dt).round
137
+ @scroll_position.y += (scroll_y_diff * @scroll_speed * 0.25 * dt).round
138
+
139
+ @scroll_position.x = @scroll_target_position.x if scroll_x_diff.abs < 1.0
140
+ @scroll_position.y = @scroll_target_position.y if scroll_y_diff.abs < 1.0
141
+
142
+ # Scrolled PAST top
143
+ if @scroll_position.y > 0
144
+ @scroll_target_position.y = 0
145
+
146
+ # Scrolled PAST bottom
147
+ elsif @scroll_position.y.abs > max_scroll_height
148
+ @scroll_target_position.y = -max_scroll_height
149
+ end
150
+
151
+ if @last_scroll_position != @scroll_position
152
+ @children.each { |child| update_child_element_visibity(child) }
153
+ root.gui_state.request_repaint
154
+ end
155
+
156
+ @last_scroll_position.x = @scroll_position.x
157
+ @last_scroll_position.y = @scroll_position.y
158
+ end
159
+
115
160
  def recalculate
116
161
  @current_position = Vector.new(@style.margin_left + @style.padding_left, @style.margin_top + @style.padding_top)
117
- @current_position += @scroll_position
118
162
 
119
163
  return unless visible?
120
164
 
121
- Stats.increment(:gui_recalculations_last_frame, 1)
165
+ Stats.frame.increment(:gui_recalculations)
122
166
 
123
167
  stylize
124
168
 
@@ -129,6 +173,9 @@ module CyberarmEngine
129
173
  old_width = @width
130
174
  old_height = @height
131
175
 
176
+ @cached_scroll_width = nil
177
+ @cached_scroll_height = nil
178
+
132
179
  if is_root?
133
180
  @width = @style.width = window.width
134
181
  @height = @style.height = window.height
@@ -176,17 +223,30 @@ module CyberarmEngine
176
223
  child.recalculate
177
224
  child.reposition # TODO: Implement top,bottom,left,center, and right positioning
178
225
 
179
- Stats.increment(:gui_recalculations_last_frame, 1)
226
+ Stats.frame.increment(:gui_recalculations)
180
227
 
181
- child.element_visible = child.x >= @x - child.width && child.x <= @x + width &&
182
- child.y >= @y - child.height && child.y <= @y + height
228
+ update_child_element_visibity(child)
183
229
  end
184
230
 
185
231
  # puts "TOOK: #{Gosu.milliseconds - s}ms to recalculate #{self.class}:0x#{self.object_id.to_s(16)}"
186
232
 
187
233
  update_background
188
234
 
235
+ # Fixes resized container scrolled past bottom
236
+ self.scroll_top = -@scroll_position.y
237
+ @scroll_target_position.y = @scroll_position.y
238
+
239
+ # NOTE: Experiment for removing need to explicitly call gui_state#recalculate at least 3 times for layout to layout...
240
+ if old_width != @width || old_height != @height
241
+ if @parent
242
+ root.gui_state.request_recalculate_for(@parent)
243
+ else
244
+ root.gui_state.request_recalculate
245
+ end
246
+ end
247
+
189
248
  root.gui_state.request_repaint if @width != old_width || @height != old_height
249
+ recalculate_if_size_changed
190
250
  end
191
251
 
192
252
  def layout
@@ -246,12 +306,13 @@ module CyberarmEngine
246
306
  def mouse_wheel_up(sender, x, y)
247
307
  return unless @style.scroll
248
308
 
249
- if @scroll_position.y < 0
250
- @scroll_position.y += @scroll_speed
251
- @scroll_position.y = 0 if @scroll_position.y > 0
252
-
253
- root.gui_state.request_recalculate_for(self)
254
- root.gui_state.request_repaint
309
+ # Allow overscrolling UP, only if one can scroll DOWN
310
+ if height < scroll_height
311
+ if @scroll_target_position.y > 0
312
+ @scroll_target_position.y = @scroll_chunk
313
+ else
314
+ @scroll_target_position.y += @scroll_chunk
315
+ end
255
316
 
256
317
  return :handled
257
318
  end
@@ -262,15 +323,13 @@ module CyberarmEngine
262
323
 
263
324
  return unless height < scroll_height
264
325
 
265
- if @scroll_position.y.abs < max_scroll_height
266
- @scroll_position.y -= @scroll_speed
267
- @scroll_position.y = -max_scroll_height if @scroll_position.y.abs > max_scroll_height
268
-
269
- root.gui_state.request_recalculate_for(self)
270
- root.gui_state.request_repaint
271
-
272
- return :handled
326
+ if @scroll_target_position.y > 0
327
+ @scroll_target_position.y = -@scroll_chunk
328
+ else
329
+ @scroll_target_position.y -= @scroll_chunk
273
330
  end
331
+
332
+ return :handled
274
333
  end
275
334
 
276
335
  def scroll_top
@@ -33,7 +33,8 @@ module CyberarmEngine
33
33
  end
34
34
  end
35
35
 
36
- attr_reader :range, :step_size, :value
36
+ attr_reader :step_size, :value
37
+ attr_accessor :range, :step_size
37
38
 
38
39
  def initialize(options = {}, block = nil)
39
40
  super(options, block)
@@ -76,7 +77,7 @@ module CyberarmEngine
76
77
  def update
77
78
  super
78
79
 
79
- @tip = value.to_s
80
+ @tip = format("%.2f", value.to_f)
80
81
  @handle.tip = @tip
81
82
  end
82
83
 
@@ -87,7 +88,7 @@ module CyberarmEngine
87
88
  end
88
89
 
89
90
  def handle_dragged_to(x, _y)
90
- @ratio = ((x - @handle.width / 2) - @x) / (content_width - @handle.outer_width)
91
+ @ratio = ((x - @handle.width / 2.0) - @x) / (content_width - @handle.outer_width.to_f)
91
92
 
92
93
  self.value = @ratio.clamp(0.0, 1.0) * (@range.max - @range.min) + @range.min
93
94
  end
@@ -18,6 +18,15 @@ module CyberarmEngine
18
18
  @raw_text = text
19
19
  end
20
20
 
21
+ def update
22
+ super
23
+
24
+ if @text.textobject.name != safe_style_fetch(:font)
25
+ set_font
26
+ root.gui_state.request_recalculate
27
+ end
28
+ end
29
+
21
30
  def render
22
31
  # Gosu.clip_to is too expensive to always use so check if we actually need it.
23
32
  if @text.width > width || @text.height > height
@@ -84,6 +93,7 @@ module CyberarmEngine
84
93
  update_background
85
94
 
86
95
  root.gui_state.request_repaint if @width != old_width || @height != old_height
96
+ recalculate_if_size_changed
87
97
  end
88
98
 
89
99
  def handle_text_wrapping(max_width)
@@ -156,7 +166,7 @@ module CyberarmEngine
156
166
  end
157
167
 
158
168
  def line_width(text)
159
- (@text.textobject.markup_width(text) + noncontent_width)
169
+ (@text.textobject.markup_width(text.to_s) + noncontent_width)
160
170
  end
161
171
 
162
172
  def value
@@ -63,7 +63,8 @@ module CyberarmEngine
63
63
  @tip.draw
64
64
  end
65
65
 
66
- if defined?(GUI_DEBUG)
66
+ # FIXME
67
+ if false# defined?(GUI_DEBUG)
67
68
  Gosu.flush
68
69
 
69
70
  @root_container.debug_draw
@@ -77,16 +78,23 @@ module CyberarmEngine
77
78
  end
78
79
 
79
80
  def update
81
+ Stats.frame.start_timing(:gui_element_recalculate_requests)
82
+
83
+ # puts "PENDING REQUESTS: #{@pending_element_recalculate_requests.size}" if @pending_element_recalculate_requests.size.positive?
84
+ @pending_element_recalculate_requests.each(&:recalculate)
85
+ @pending_element_recalculate_requests.clear
86
+
87
+ Stats.frame.end_timing(:gui_element_recalculate_requests)
88
+
80
89
  if @pending_recalculate_request
81
- @root_container.recalculate
82
- @root_container.recalculate
90
+ Stats.frame.start_timing(:gui_recalculate)
91
+
83
92
  @root_container.recalculate
84
93
 
85
94
  @pending_recalculate_request = false
86
- end
87
95
 
88
- @pending_element_recalculate_requests.each(&:recalculate)
89
- @pending_element_recalculate_requests.clear
96
+ Stats.frame.end_timing(:gui_recalculate)
97
+ end
90
98
 
91
99
  if @pending_focus_request
92
100
  @pending_focus_request = false
@@ -121,9 +129,9 @@ module CyberarmEngine
121
129
  @mouse_over.publish(:leave) if @mouse_over && new_mouse_over != @mouse_over
122
130
  @mouse_over = new_mouse_over
123
131
 
124
- redirect_holding_mouse_button(:left) if @mouse_over && Gosu.button_down?(Gosu::MsLeft)
125
- redirect_holding_mouse_button(:middle) if @mouse_over && Gosu.button_down?(Gosu::MsMiddle)
126
- redirect_holding_mouse_button(:right) if @mouse_over && Gosu.button_down?(Gosu::MsRight)
132
+ redirect_holding_mouse_button(:left) if @mouse_over && Gosu.button_down?(Gosu::MS_LEFT)
133
+ redirect_holding_mouse_button(:middle) if @mouse_over && Gosu.button_down?(Gosu::MS_MIDDLE)
134
+ redirect_holding_mouse_button(:right) if @mouse_over && Gosu.button_down?(Gosu::MS_RIGHT)
127
135
 
128
136
  if Vector.new(window.mouse_x, window.mouse_y) == @last_mouse_pos
129
137
  if @mouse_over && (Gosu.milliseconds - @mouse_moved_at) > tool_tip_delay
@@ -151,13 +159,13 @@ module CyberarmEngine
151
159
  super
152
160
 
153
161
  case id
154
- when Gosu::MsLeft
162
+ when Gosu::MS_LEFT
155
163
  redirect_mouse_button(:left)
156
- when Gosu::MsMiddle
164
+ when Gosu::MS_MIDDLE
157
165
  redirect_mouse_button(:middle)
158
- when Gosu::MsRight
166
+ when Gosu::MS_RIGHT
159
167
  redirect_mouse_button(:right)
160
- when Gosu::KbF5
168
+ when Gosu::KB_F5
161
169
  request_recalculate
162
170
  end
163
171
 
@@ -168,15 +176,15 @@ module CyberarmEngine
168
176
  super
169
177
 
170
178
  case id
171
- when Gosu::MsLeft
179
+ when Gosu::MS_LEFT
172
180
  redirect_released_mouse_button(:left)
173
- when Gosu::MsMiddle
181
+ when Gosu::MS_MIDDLE
174
182
  redirect_released_mouse_button(:middle)
175
- when Gosu::MsRight
183
+ when Gosu::MS_RIGHT
176
184
  redirect_released_mouse_button(:right)
177
- when Gosu::MsWheelUp
185
+ when Gosu::MS_WHEEL_UP
178
186
  redirect_mouse_wheel(:up)
179
- when Gosu::MsWheelDown
187
+ when Gosu::MS_WHEEL_DOWN
180
188
  redirect_mouse_wheel(:down)
181
189
  end
182
190
 
@@ -276,6 +284,8 @@ module CyberarmEngine
276
284
  def hide_menu
277
285
  return unless @menu
278
286
 
287
+ request_repaint
288
+
279
289
  @hid_menu_for = @menu.parent
280
290
  @menu = nil
281
291
  end
@@ -20,7 +20,8 @@ module CyberarmEngine
20
20
  attr_reader :hash
21
21
 
22
22
  def initialize(hash = {})
23
- h = Marshal.load(Marshal.dump(hash))
23
+ h = hash
24
+ # h = Marshal.load(Marshal.dump(hash))
24
25
 
25
26
  h[:default] = {}
26
27
 
@@ -95,39 +95,58 @@ module CyberarmEngine
95
95
  Vector.new(@x, @y)
96
96
  end
97
97
 
98
- # Performs math operation, excluding {weight}
99
- private def operator(function, other)
98
+ # Adds Vector and Numeric or Vector and Vector, excluding {weight}
99
+ # @return [CyberarmEngine::Vector]
100
+ def +(other)
100
101
  if other.is_a?(Numeric)
101
102
  Vector.new(
102
- @x.send(:"#{function}", other),
103
- @y.send(:"#{function}", other),
104
- @z.send(:"#{function}", other)
103
+ @x + other,
104
+ @y + other,
105
+ @z + other
105
106
  )
106
107
  else
107
108
  Vector.new(
108
- @x.send(:"#{function}", other.x),
109
- @y.send(:"#{function}", other.y),
110
- @z.send(:"#{function}", other.z)
109
+ @x + other.x,
110
+ @y + other.y,
111
+ @z + other.z
111
112
  )
112
113
  end
113
114
  end
114
115
 
115
- # Adds Vector and Numeric or Vector and Vector, excluding {weight}
116
- # @return [CyberarmEngine::Vector]
117
- def +(other)
118
- operator("+", other)
119
- end
120
-
121
116
  # Subtracts Vector and Numeric or Vector and Vector, excluding {weight}
122
117
  # @return [CyberarmEngine::Vector]
123
118
  def -(other)
124
- operator("-", other)
119
+ if other.is_a?(Numeric)
120
+ Vector.new(
121
+ @x - other,
122
+ @y - other,
123
+ @z - other
124
+ )
125
+ else
126
+ Vector.new(
127
+ @x - other.x,
128
+ @y - other.y,
129
+ @z - other.z
130
+ )
131
+ end
125
132
  end
126
133
 
127
134
  # Multiplies Vector and Numeric or Vector and Vector, excluding {weight}
128
135
  # @return [CyberarmEngine::Vector]
129
136
  def *(other)
130
- operator("*", other)
137
+ if other.is_a?(Numeric)
138
+ Vector.new(
139
+ @x * other,
140
+ @y * other,
141
+ @z * other
142
+ )
143
+ else
144
+ Vector.new(
145
+ @x * other.x,
146
+ @y * other.y,
147
+ @z * other.z
148
+ )
149
+ end
131
150
  end
132
151
 
133
152
  def multiply_transform(transform)
@@ -1,4 +1,4 @@
1
1
  module CyberarmEngine
2
2
  NAME = "InDev".freeze
3
- VERSION = "0.23.0".freeze
3
+ VERSION = "0.24.0".freeze
4
4
  end
@@ -6,16 +6,16 @@ module CyberarmEngine
6
6
  SAMPLES = {}
7
7
  SONGS = {}
8
8
 
9
- attr_accessor :show_cursor
9
+ attr_accessor :show_cursor, :show_stats_plotter
10
10
  attr_writer :exit_on_opengl_error
11
- attr_reader :last_frame_time, :states
11
+ attr_reader :last_frame_time, :delta_time, :states
12
12
 
13
13
  def self.now
14
14
  Gosu.milliseconds
15
15
  end
16
16
 
17
17
  def self.dt
18
- instance.last_frame_time / 1000.0
18
+ instance.dt
19
19
  end
20
20
 
21
21
  def self.instance=(window)
@@ -31,32 +31,57 @@ module CyberarmEngine
31
31
  def initialize(width: 800, height: 600, fullscreen: false, update_interval: 1000.0 / 60, resizable: false, borderless: false)
32
32
  @show_cursor = false
33
33
  @has_focus = false
34
+ @show_stats_plotter = false
34
35
 
35
36
  super(width, height, fullscreen: fullscreen, update_interval: update_interval, resizable: resizable, borderless: borderless)
36
37
  Window.instance = self
37
38
 
38
39
  @last_frame_time = Gosu.milliseconds - 1
39
40
  @current_frame_time = Gosu.milliseconds
40
- self.caption = "CyberarmEngine #{CyberarmEngine::VERSION} #{Gosu.language}"
41
+ @delta_time = @last_frame_time
42
+ self.caption = "CyberarmEngine #{CyberarmEngine::VERSION} #{Gosu.user_languages.join(', ')}"
41
43
 
42
44
  @states = []
43
45
  @exit_on_opengl_error = false
44
46
  preload_default_shaders if respond_to?(:preload_default_shaders)
47
+ @stats_plotter = Stats::StatsPlotter.new(2, 28) # FIXME: Make positioning easy
45
48
 
46
- setup if defined?(setup)
49
+ setup
50
+ end
51
+
52
+ def setup
47
53
  end
48
54
 
49
55
  def draw
56
+ Stats.frame.start_timing(:draw)
57
+
50
58
  current_state&.draw
59
+ Stats.frame.start_timing(:engine_stats_renderer)
60
+ @stats_plotter&.draw if @show_stats_plotter
61
+ Stats.frame.end_timing(:engine_stats_renderer)
62
+
63
+ Stats.frame.end_timing(:draw)
64
+ Stats.frame.start_timing(:interframe_sleep)
51
65
  end
52
66
 
53
67
  def update
54
- Stats.clear
68
+ # Gosu calls update() then (optionally) draw(),
69
+ # so always end last frame and start next frame when update() is called.
70
+ Stats.frame&.end_timing(:interframe_sleep)
71
+ Stats.end_frame
55
72
 
56
- current_state&.update
73
+ Stats.new_frame
74
+
75
+ @delta_time = (Gosu.milliseconds - @current_frame_time) * 0.001
57
76
 
58
77
  @last_frame_time = Gosu.milliseconds - @current_frame_time
59
78
  @current_frame_time = Gosu.milliseconds
79
+
80
+ Stats.frame.start_timing(:update)
81
+ current_state&.update
82
+ Stats.frame.end_timing(:update)
83
+
84
+ Stats.frame.start_timing(:interframe_sleep) unless needs_redraw?
60
85
  end
61
86
 
62
87
  def needs_cursor?
@@ -120,7 +145,7 @@ module CyberarmEngine
120
145
  def push_state(klass, options = {})
121
146
  options = { setup: true }.merge(options)
122
147
 
123
- if klass.instance_of?(klass.class) && defined?(klass.options)
148
+ if klass.instance_of?(klass.class) && klass.respond_to?(:options)
124
149
  @states << klass
125
150
  klass.setup if options[:setup]
126
151
  klass.post_setup if options[:setup]
@@ -133,6 +158,8 @@ module CyberarmEngine
133
158
  end
134
159
 
135
160
  private def child_of?(input, klass)
161
+ return false unless input
162
+
136
163
  input.ancestors.detect { |c| c == klass }
137
164
  end
138
165
 
@@ -7,13 +7,19 @@ else
7
7
  end
8
8
  require "json"
9
9
  require "excon"
10
- require "gosu_more_drawables"
11
10
 
12
11
  require_relative "cyberarm_engine/version"
13
12
  require_relative "cyberarm_engine/stats"
14
13
 
15
14
  require_relative "cyberarm_engine/common"
16
15
 
16
+ require_relative "cyberarm_engine/gosu_ext/draw_arc"
17
+ require_relative "cyberarm_engine/gosu_ext/draw_circle"
18
+ require_relative "cyberarm_engine/gosu_ext/draw_path"
19
+
20
+ require_relative "cyberarm_engine/notification"
21
+ require_relative "cyberarm_engine/notification_manager"
22
+
17
23
  require_relative "cyberarm_engine/game_object"
18
24
  require_relative "cyberarm_engine/window"
19
25
 
@@ -66,6 +72,6 @@ require_relative "cyberarm_engine/model/material"
66
72
  require_relative "cyberarm_engine/model/model_object"
67
73
  require_relative "cyberarm_engine/model/parser"
68
74
  require_relative "cyberarm_engine/model/parsers/wavefront_parser"
69
- require_relative "cyberarm_engine/model/parsers/collada_parser" if defined?(Nokogiri)
75
+ require_relative "cyberarm_engine/model/parsers/collada_parser" if RUBY_ENGINE != "mruby" && defined?(Nokogiri)
70
76
 
71
77
  require_relative "cyberarm_engine/builtin/intro_state"
data/mrbgem.rake ADDED
@@ -0,0 +1,29 @@
1
+ MRuby::Gem::Specification.new("mruby-cyberarm_engine") do |spec|
2
+ spec.license = "MIT"
3
+ spec.authors = "cyberarm"
4
+ spec.summary = " Yet another framework for building games with Gosu"
5
+
6
+ lib_rbfiles = []
7
+ # Dir.glob("#{File.expand_path("..", __FILE__)}/lib/**/*.rb").reject do |f|
8
+ # File.basename(f.downcase, ".rb") == "cyberarm_engine" ||
9
+ # File.basename(f.downcase, ".rb") == "opengl" ||
10
+ # f.downcase.include?("/opengl/")
11
+ # end.reverse!
12
+
13
+ local_path = File.expand_path("..", __FILE__)
14
+ File.read("#{local_path}/lib/cyberarm_engine.rb").each_line do |line|
15
+ line = line.strip
16
+
17
+ next unless line.start_with?("require_relative")
18
+
19
+ file = line.split("require_relative").last.strip.gsub("\"", "")
20
+
21
+ next if file.include?(" if ")
22
+
23
+ lib_rbfiles << "#{local_path}/lib/#{file}.rb"
24
+ end
25
+
26
+ pp lib_rbfiles
27
+
28
+ spec.rbfiles = lib_rbfiles
29
+ end