cyberarm_engine 0.19.0 → 0.19.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +8 -8
  3. data/.rubocop.yml +7 -7
  4. data/.travis.yml +5 -5
  5. data/Gemfile +6 -6
  6. data/LICENSE.txt +21 -21
  7. data/README.md +74 -74
  8. data/Rakefile +10 -10
  9. data/bin/console +14 -14
  10. data/bin/setup +8 -8
  11. data/cyberarm_engine.gemspec +39 -39
  12. data/lib/cyberarm_engine/animator.rb +219 -219
  13. data/lib/cyberarm_engine/background.rb +179 -179
  14. data/lib/cyberarm_engine/background_nine_slice.rb +142 -142
  15. data/lib/cyberarm_engine/bounding_box.rb +150 -150
  16. data/lib/cyberarm_engine/builtin/intro_state.rb +130 -130
  17. data/lib/cyberarm_engine/cache/download_manager.rb +121 -121
  18. data/lib/cyberarm_engine/cache.rb +4 -4
  19. data/lib/cyberarm_engine/common.rb +113 -113
  20. data/lib/cyberarm_engine/config_file.rb +46 -46
  21. data/lib/cyberarm_engine/console/command.rb +157 -157
  22. data/lib/cyberarm_engine/console/commands/help_command.rb +43 -43
  23. data/lib/cyberarm_engine/console/subcommand.rb +99 -99
  24. data/lib/cyberarm_engine/console.rb +248 -248
  25. data/lib/cyberarm_engine/game_object.rb +248 -248
  26. data/lib/cyberarm_engine/game_state.rb +97 -97
  27. data/lib/cyberarm_engine/model/material.rb +21 -21
  28. data/lib/cyberarm_engine/model/model_object.rb +131 -131
  29. data/lib/cyberarm_engine/model/parser.rb +74 -74
  30. data/lib/cyberarm_engine/model/parsers/collada_parser.rb +138 -138
  31. data/lib/cyberarm_engine/model/parsers/wavefront_parser.rb +154 -154
  32. data/lib/cyberarm_engine/model.rb +212 -212
  33. data/lib/cyberarm_engine/model_cache.rb +31 -31
  34. data/lib/cyberarm_engine/opengl/light.rb +50 -50
  35. data/lib/cyberarm_engine/opengl/orthographic_camera.rb +46 -46
  36. data/lib/cyberarm_engine/opengl/perspective_camera.rb +38 -38
  37. data/lib/cyberarm_engine/opengl/renderer/bounding_box_renderer.rb +249 -249
  38. data/lib/cyberarm_engine/opengl/renderer/g_buffer.rb +164 -164
  39. data/lib/cyberarm_engine/opengl/renderer/opengl_renderer.rb +298 -298
  40. data/lib/cyberarm_engine/opengl/renderer/renderer.rb +22 -22
  41. data/lib/cyberarm_engine/opengl/shader.rb +406 -406
  42. data/lib/cyberarm_engine/opengl/texture.rb +69 -69
  43. data/lib/cyberarm_engine/opengl.rb +28 -28
  44. data/lib/cyberarm_engine/ray.rb +56 -56
  45. data/lib/cyberarm_engine/stats.rb +21 -21
  46. data/lib/cyberarm_engine/text.rb +197 -197
  47. data/lib/cyberarm_engine/timer.rb +23 -23
  48. data/lib/cyberarm_engine/transform.rb +296 -296
  49. data/lib/cyberarm_engine/ui/border_canvas.rb +102 -102
  50. data/lib/cyberarm_engine/ui/dsl.rb +139 -139
  51. data/lib/cyberarm_engine/ui/element.rb +488 -488
  52. data/lib/cyberarm_engine/ui/elements/button.rb +97 -97
  53. data/lib/cyberarm_engine/ui/elements/check_box.rb +54 -54
  54. data/lib/cyberarm_engine/ui/elements/container.rb +256 -256
  55. data/lib/cyberarm_engine/ui/elements/edit_box.rb +179 -179
  56. data/lib/cyberarm_engine/ui/elements/edit_line.rb +263 -263
  57. data/lib/cyberarm_engine/ui/elements/flow.rb +15 -15
  58. data/lib/cyberarm_engine/ui/elements/image.rb +72 -72
  59. data/lib/cyberarm_engine/ui/elements/list_box.rb +88 -82
  60. data/lib/cyberarm_engine/ui/elements/progress.rb +51 -51
  61. data/lib/cyberarm_engine/ui/elements/radio.rb +6 -6
  62. data/lib/cyberarm_engine/ui/elements/slider.rb +104 -104
  63. data/lib/cyberarm_engine/ui/elements/stack.rb +11 -11
  64. data/lib/cyberarm_engine/ui/elements/text_block.rb +162 -162
  65. data/lib/cyberarm_engine/ui/elements/toggle_button.rb +65 -65
  66. data/lib/cyberarm_engine/ui/event.rb +54 -54
  67. data/lib/cyberarm_engine/ui/gui_state.rb +256 -256
  68. data/lib/cyberarm_engine/ui/style.rb +49 -49
  69. data/lib/cyberarm_engine/ui/theme.rb +207 -207
  70. data/lib/cyberarm_engine/vector.rb +293 -293
  71. data/lib/cyberarm_engine/version.rb +4 -4
  72. data/lib/cyberarm_engine/window.rb +120 -120
  73. data/lib/cyberarm_engine.rb +71 -71
  74. metadata +3 -3
@@ -1,120 +1,120 @@
1
- module CyberarmEngine
2
- class Window < Gosu::Window
3
- include Common
4
-
5
- IMAGES = {}
6
- SAMPLES = {}
7
- SONGS = {}
8
-
9
- attr_accessor :show_cursor
10
- attr_writer :exit_on_opengl_error
11
- attr_reader :last_frame_time
12
-
13
- def self.now
14
- Gosu.milliseconds
15
- end
16
-
17
- def self.dt
18
- $window.last_frame_time / 1000.0
19
- end
20
-
21
- def initialize(width: 800, height: 600, fullscreen: false, update_interval: 1000.0 / 60, resizable: false, borderless: false)
22
- @show_cursor = false
23
-
24
- super(width, height, fullscreen: fullscreen, update_interval: update_interval, resizable: resizable, borderless: borderless)
25
- $window = self
26
- @last_frame_time = Gosu.milliseconds - 1
27
- @current_frame_time = Gosu.milliseconds
28
- self.caption = "CyberarmEngine #{CyberarmEngine::VERSION} #{Gosu.language}"
29
-
30
- @states = []
31
- @exit_on_opengl_error = false
32
-
33
- setup if defined?(setup)
34
- end
35
-
36
- def draw
37
- current_state.draw if current_state
38
- end
39
-
40
- def update
41
- Stats.clear
42
-
43
- current_state.update if current_state
44
- @last_frame_time = Gosu.milliseconds - @current_frame_time
45
- @current_frame_time = Gosu.milliseconds
46
- end
47
-
48
- def needs_cursor?
49
- @show_cursor
50
- end
51
-
52
- def dt
53
- @last_frame_time / 1000.0
54
- end
55
-
56
- def aspect_ratio
57
- width / height.to_f
58
- end
59
-
60
- def exit_on_opengl_error?
61
- @exit_on_opengl_error
62
- end
63
-
64
- def button_down(id)
65
- super
66
- current_state.button_down(id) if current_state
67
- end
68
-
69
- def button_up(id)
70
- super
71
- current_state.button_up(id) if current_state
72
- end
73
-
74
- def push_state(klass, options = {})
75
- options = { setup: true }.merge(options)
76
-
77
- if klass.instance_of?(klass.class) && defined?(klass.options)
78
- @states << klass
79
- klass.setup if options[:setup]
80
- klass.post_setup if options[:setup]
81
- else
82
- @states << klass.new(options) if child_of?(klass, GameState)
83
- @states << klass.new if child_of?(klass, Element::Container)
84
- current_state.setup if current_state.instance_of?(klass) && options[:setup]
85
- current_state.post_setup if current_state.instance_of?(klass) && options[:setup]
86
- end
87
- end
88
-
89
- private def child_of?(input, klass)
90
- input.ancestors.detect { |c| c == klass }
91
- end
92
-
93
- def current_state
94
- @states.last
95
- end
96
-
97
- def previous_state
98
- if @states.size > 1 && (state = @states[@states.size - 2])
99
- state
100
- end
101
- end
102
-
103
- def pop_state
104
- @states.pop
105
- end
106
-
107
- def shift_state
108
- @states.shift
109
- end
110
-
111
- # Sourced from https://gist.github.com/ippa/662583
112
- def draw_circle(cx, cy, r, z = 9999, color = Gosu::Color::GREEN, step = 10)
113
- 0.step(360, step) do |a1|
114
- a2 = a1 + step
115
- draw_line(cx + Gosu.offset_x(a1, r), cy + Gosu.offset_y(a1, r), color, cx + Gosu.offset_x(a2, r),
116
- cy + Gosu.offset_y(a2, r), color, z)
117
- end
118
- end
119
- end
120
- end
1
+ module CyberarmEngine
2
+ class Window < Gosu::Window
3
+ include Common
4
+
5
+ IMAGES = {}
6
+ SAMPLES = {}
7
+ SONGS = {}
8
+
9
+ attr_accessor :show_cursor
10
+ attr_writer :exit_on_opengl_error
11
+ attr_reader :last_frame_time
12
+
13
+ def self.now
14
+ Gosu.milliseconds
15
+ end
16
+
17
+ def self.dt
18
+ $window.last_frame_time / 1000.0
19
+ end
20
+
21
+ def initialize(width: 800, height: 600, fullscreen: false, update_interval: 1000.0 / 60, resizable: false, borderless: false)
22
+ @show_cursor = false
23
+
24
+ super(width, height, fullscreen: fullscreen, update_interval: update_interval, resizable: resizable, borderless: borderless)
25
+ $window = self
26
+ @last_frame_time = Gosu.milliseconds - 1
27
+ @current_frame_time = Gosu.milliseconds
28
+ self.caption = "CyberarmEngine #{CyberarmEngine::VERSION} #{Gosu.language}"
29
+
30
+ @states = []
31
+ @exit_on_opengl_error = false
32
+
33
+ setup if defined?(setup)
34
+ end
35
+
36
+ def draw
37
+ current_state.draw if current_state
38
+ end
39
+
40
+ def update
41
+ Stats.clear
42
+
43
+ current_state.update if current_state
44
+ @last_frame_time = Gosu.milliseconds - @current_frame_time
45
+ @current_frame_time = Gosu.milliseconds
46
+ end
47
+
48
+ def needs_cursor?
49
+ @show_cursor
50
+ end
51
+
52
+ def dt
53
+ @last_frame_time / 1000.0
54
+ end
55
+
56
+ def aspect_ratio
57
+ width / height.to_f
58
+ end
59
+
60
+ def exit_on_opengl_error?
61
+ @exit_on_opengl_error
62
+ end
63
+
64
+ def button_down(id)
65
+ super
66
+ current_state.button_down(id) if current_state
67
+ end
68
+
69
+ def button_up(id)
70
+ super
71
+ current_state.button_up(id) if current_state
72
+ end
73
+
74
+ def push_state(klass, options = {})
75
+ options = { setup: true }.merge(options)
76
+
77
+ if klass.instance_of?(klass.class) && defined?(klass.options)
78
+ @states << klass
79
+ klass.setup if options[:setup]
80
+ klass.post_setup if options[:setup]
81
+ else
82
+ @states << klass.new(options) if child_of?(klass, GameState)
83
+ @states << klass.new if child_of?(klass, Element::Container)
84
+ current_state.setup if current_state.instance_of?(klass) && options[:setup]
85
+ current_state.post_setup if current_state.instance_of?(klass) && options[:setup]
86
+ end
87
+ end
88
+
89
+ private def child_of?(input, klass)
90
+ input.ancestors.detect { |c| c == klass }
91
+ end
92
+
93
+ def current_state
94
+ @states.last
95
+ end
96
+
97
+ def previous_state
98
+ if @states.size > 1 && (state = @states[@states.size - 2])
99
+ state
100
+ end
101
+ end
102
+
103
+ def pop_state
104
+ @states.pop
105
+ end
106
+
107
+ def shift_state
108
+ @states.shift
109
+ end
110
+
111
+ # Sourced from https://gist.github.com/ippa/662583
112
+ def draw_circle(cx, cy, r, z = 9999, color = Gosu::Color::GREEN, step = 10)
113
+ 0.step(360, step) do |a1|
114
+ a2 = a1 + step
115
+ draw_line(cx + Gosu.offset_x(a1, r), cy + Gosu.offset_y(a1, r), color, cx + Gosu.offset_x(a2, r),
116
+ cy + Gosu.offset_y(a2, r), color, z)
117
+ end
118
+ end
119
+ end
120
+ end
@@ -1,71 +1,71 @@
1
- CYBERARM_ENGINE_ROOT_PATH = File.expand_path("..", __dir__)
2
-
3
- if ARGV.join.include?("--ffi-gosu")
4
- require File.expand_path("../../ffi-gosu/lib/gosu", __dir__)
5
- else
6
- require "gosu"
7
- end
8
- require "json"
9
- require "excon"
10
- require "gosu_more_drawables"
11
- require "clipboard"
12
-
13
- require_relative "cyberarm_engine/version"
14
- require_relative "cyberarm_engine/stats"
15
-
16
- require_relative "cyberarm_engine/common"
17
-
18
- require_relative "cyberarm_engine/game_object"
19
- require_relative "cyberarm_engine/window"
20
-
21
- require_relative "cyberarm_engine/bounding_box"
22
- require_relative "cyberarm_engine/vector"
23
- require_relative "cyberarm_engine/transform"
24
- require_relative "cyberarm_engine/ray"
25
- require_relative "cyberarm_engine/background"
26
- require_relative "cyberarm_engine/background_nine_slice"
27
- require_relative "cyberarm_engine/animator"
28
-
29
- require_relative "cyberarm_engine/text"
30
- require_relative "cyberarm_engine/timer"
31
- require_relative "cyberarm_engine/config_file"
32
-
33
- require_relative "cyberarm_engine/console"
34
- require_relative "cyberarm_engine/console/command"
35
- require_relative "cyberarm_engine/console/subcommand"
36
- require_relative "cyberarm_engine/console/commands/help_command"
37
-
38
- require_relative "cyberarm_engine/ui/dsl"
39
-
40
- require_relative "cyberarm_engine/ui/theme"
41
- require_relative "cyberarm_engine/ui/event"
42
- require_relative "cyberarm_engine/ui/style"
43
- require_relative "cyberarm_engine/ui/border_canvas"
44
- require_relative "cyberarm_engine/ui/element"
45
- require_relative "cyberarm_engine/ui/elements/text_block"
46
- require_relative "cyberarm_engine/ui/elements/button"
47
- require_relative "cyberarm_engine/ui/elements/toggle_button"
48
- require_relative "cyberarm_engine/ui/elements/list_box"
49
- require_relative "cyberarm_engine/ui/elements/edit_line"
50
- require_relative "cyberarm_engine/ui/elements/edit_box"
51
- require_relative "cyberarm_engine/ui/elements/image"
52
- require_relative "cyberarm_engine/ui/elements/container"
53
- require_relative "cyberarm_engine/ui/elements/flow"
54
- require_relative "cyberarm_engine/ui/elements/stack"
55
- require_relative "cyberarm_engine/ui/elements/check_box"
56
- require_relative "cyberarm_engine/ui/elements/radio"
57
- require_relative "cyberarm_engine/ui/elements/progress"
58
- require_relative "cyberarm_engine/ui/elements/slider"
59
-
60
- require_relative "cyberarm_engine/game_state"
61
- require_relative "cyberarm_engine/ui/gui_state"
62
-
63
- require_relative "cyberarm_engine/model"
64
- require_relative "cyberarm_engine/model_cache"
65
- require_relative "cyberarm_engine/model/material"
66
- require_relative "cyberarm_engine/model/model_object"
67
- require_relative "cyberarm_engine/model/parser"
68
- require_relative "cyberarm_engine/model/parsers/wavefront_parser"
69
- require_relative "cyberarm_engine/model/parsers/collada_parser" if defined?(Nokogiri)
70
-
71
- require_relative "cyberarm_engine/builtin/intro_state"
1
+ CYBERARM_ENGINE_ROOT_PATH = File.expand_path("..", __dir__)
2
+
3
+ if ARGV.join.include?("--ffi-gosu")
4
+ require File.expand_path("../../ffi-gosu/lib/gosu", __dir__)
5
+ else
6
+ require "gosu"
7
+ end
8
+ require "json"
9
+ require "excon"
10
+ require "gosu_more_drawables"
11
+ require "clipboard"
12
+
13
+ require_relative "cyberarm_engine/version"
14
+ require_relative "cyberarm_engine/stats"
15
+
16
+ require_relative "cyberarm_engine/common"
17
+
18
+ require_relative "cyberarm_engine/game_object"
19
+ require_relative "cyberarm_engine/window"
20
+
21
+ require_relative "cyberarm_engine/bounding_box"
22
+ require_relative "cyberarm_engine/vector"
23
+ require_relative "cyberarm_engine/transform"
24
+ require_relative "cyberarm_engine/ray"
25
+ require_relative "cyberarm_engine/background"
26
+ require_relative "cyberarm_engine/background_nine_slice"
27
+ require_relative "cyberarm_engine/animator"
28
+
29
+ require_relative "cyberarm_engine/text"
30
+ require_relative "cyberarm_engine/timer"
31
+ require_relative "cyberarm_engine/config_file"
32
+
33
+ require_relative "cyberarm_engine/console"
34
+ require_relative "cyberarm_engine/console/command"
35
+ require_relative "cyberarm_engine/console/subcommand"
36
+ require_relative "cyberarm_engine/console/commands/help_command"
37
+
38
+ require_relative "cyberarm_engine/ui/dsl"
39
+
40
+ require_relative "cyberarm_engine/ui/theme"
41
+ require_relative "cyberarm_engine/ui/event"
42
+ require_relative "cyberarm_engine/ui/style"
43
+ require_relative "cyberarm_engine/ui/border_canvas"
44
+ require_relative "cyberarm_engine/ui/element"
45
+ require_relative "cyberarm_engine/ui/elements/text_block"
46
+ require_relative "cyberarm_engine/ui/elements/button"
47
+ require_relative "cyberarm_engine/ui/elements/toggle_button"
48
+ require_relative "cyberarm_engine/ui/elements/list_box"
49
+ require_relative "cyberarm_engine/ui/elements/edit_line"
50
+ require_relative "cyberarm_engine/ui/elements/edit_box"
51
+ require_relative "cyberarm_engine/ui/elements/image"
52
+ require_relative "cyberarm_engine/ui/elements/container"
53
+ require_relative "cyberarm_engine/ui/elements/flow"
54
+ require_relative "cyberarm_engine/ui/elements/stack"
55
+ require_relative "cyberarm_engine/ui/elements/check_box"
56
+ require_relative "cyberarm_engine/ui/elements/radio"
57
+ require_relative "cyberarm_engine/ui/elements/progress"
58
+ require_relative "cyberarm_engine/ui/elements/slider"
59
+
60
+ require_relative "cyberarm_engine/game_state"
61
+ require_relative "cyberarm_engine/ui/gui_state"
62
+
63
+ require_relative "cyberarm_engine/model"
64
+ require_relative "cyberarm_engine/model_cache"
65
+ require_relative "cyberarm_engine/model/material"
66
+ require_relative "cyberarm_engine/model/model_object"
67
+ require_relative "cyberarm_engine/model/parser"
68
+ require_relative "cyberarm_engine/model/parsers/wavefront_parser"
69
+ require_relative "cyberarm_engine/model/parsers/collada_parser" if defined?(Nokogiri)
70
+
71
+ require_relative "cyberarm_engine/builtin/intro_state"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cyberarm_engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.0
4
+ version: 0.19.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cyberarm
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-09-22 00:00:00.000000000 Z
11
+ date: 2021-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clipboard
@@ -210,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
210
210
  - !ruby/object:Gem::Version
211
211
  version: '0'
212
212
  requirements: []
213
- rubygems_version: 3.2.3
213
+ rubygems_version: 3.2.22
214
214
  signing_key:
215
215
  specification_version: 4
216
216
  summary: Make games quickly and easily with gosu