gemini 1.0.0

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.
Files changed (114) hide show
  1. data/bin/gemini +18 -0
  2. data/build_configuration.rb +24 -0
  3. data/lib/ibxm.jar +0 -0
  4. data/lib/jinput.jar +0 -0
  5. data/lib/jogg-0.0.7.jar +0 -0
  6. data/lib/jorbis-0.0.15.jar +0 -0
  7. data/lib/jruby-complete.jar +0 -0
  8. data/lib/lwjgl.jar +0 -0
  9. data/lib/lwjgl_util_applet.jar +0 -0
  10. data/lib/native_files/OpenAL32.dll +0 -0
  11. data/lib/native_files/jinput-dx8.dll +0 -0
  12. data/lib/native_files/jinput-raw.dll +0 -0
  13. data/lib/native_files/libjinput-linux.so +0 -0
  14. data/lib/native_files/libjinput-linux64.so +0 -0
  15. data/lib/native_files/libjinput-osx.jnilib +0 -0
  16. data/lib/native_files/liblwjgl.jnilib +0 -0
  17. data/lib/native_files/liblwjgl.so +0 -0
  18. data/lib/native_files/liblwjgl64.so +0 -0
  19. data/lib/native_files/libopenal.so +0 -0
  20. data/lib/native_files/lwjgl.dll +0 -0
  21. data/lib/native_files/openal.dylib +0 -0
  22. data/lib/natives-linux.jar +0 -0
  23. data/lib/natives-mac.jar +0 -0
  24. data/lib/natives-win32.jar +0 -0
  25. data/lib/phys2d.jar +0 -0
  26. data/lib/slick.jar +0 -0
  27. data/package/jar/gemini.jar +0 -0
  28. data/src/base_state.rb +112 -0
  29. data/src/behavior.rb +230 -0
  30. data/src/behavior_event.rb +23 -0
  31. data/src/behaviors.txt +5 -0
  32. data/src/behaviors/animated_sprite.rb +51 -0
  33. data/src/behaviors/audible.rb +11 -0
  34. data/src/behaviors/axis_stateful.rb +33 -0
  35. data/src/behaviors/big_sprite.rb +56 -0
  36. data/src/behaviors/bounding_box_collidable.rb +25 -0
  37. data/src/behaviors/camera_anchored_drawable.rb +20 -0
  38. data/src/behaviors/cardinal_movable.rb +114 -0
  39. data/src/behaviors/clickable.rb +18 -0
  40. data/src/behaviors/countable.rb +31 -0
  41. data/src/behaviors/debug_physical.rb +31 -0
  42. data/src/behaviors/debug_tangible.rb +30 -0
  43. data/src/behaviors/drawable.rb +6 -0
  44. data/src/behaviors/drawable_shape.rb +43 -0
  45. data/src/behaviors/fading_image_trail_emittable.rb +28 -0
  46. data/src/behaviors/game_object_emittable.rb +12 -0
  47. data/src/behaviors/gravity_source.rb +21 -0
  48. data/src/behaviors/inertial.rb +11 -0
  49. data/src/behaviors/movable2d.rb +9 -0
  50. data/src/behaviors/multi_animated_sprite.rb +22 -0
  51. data/src/behaviors/physical.rb +348 -0
  52. data/src/behaviors/physical_cardinal_movable.rb +110 -0
  53. data/src/behaviors/physical_sprite.rb +29 -0
  54. data/src/behaviors/platformer_controllable.rb +144 -0
  55. data/src/behaviors/pointer.rb +28 -0
  56. data/src/behaviors/pressable.rb +13 -0
  57. data/src/behaviors/receives_events.rb +21 -0
  58. data/src/behaviors/regional.rb +71 -0
  59. data/src/behaviors/rotates_to_point.rb +18 -0
  60. data/src/behaviors/spatial.rb +41 -0
  61. data/src/behaviors/spline_stretchable_sprite.rb +45 -0
  62. data/src/behaviors/sprite.rb +99 -0
  63. data/src/behaviors/stateful.rb +31 -0
  64. data/src/behaviors/taggable.rb +27 -0
  65. data/src/behaviors/tangible.rb +51 -0
  66. data/src/behaviors/timeable.rb +79 -0
  67. data/src/behaviors/top_down_vehicle.rb +41 -0
  68. data/src/behaviors/triangle_trail_emittable.rb +41 -0
  69. data/src/behaviors/updates.rb +10 -0
  70. data/src/behaviors/updates_at_consistant_rate.rb +27 -0
  71. data/src/behaviors/vectored_movement.rb +47 -0
  72. data/src/behaviors/world_collidable.rb +8 -0
  73. data/src/color.rb +70 -0
  74. data/src/game_object.rb +174 -0
  75. data/src/game_objects/background.rb +9 -0
  76. data/src/game_objects/fading_image.rb +23 -0
  77. data/src/game_objects/icon_strip_counter_display.rb +58 -0
  78. data/src/game_objects/static_sprite.rb +18 -0
  79. data/src/game_objects/tangible_object.rb +4 -0
  80. data/src/game_objects/text.rb +59 -0
  81. data/src/game_objects/triangle_trail.rb +85 -0
  82. data/src/gemini.rb +110 -0
  83. data/src/gemini_version.rb +3 -0
  84. data/src/inflector.rb +68 -0
  85. data/src/input_helpers/joystick_dead_zone_filter.rb +9 -0
  86. data/src/listenable_mixin.rb +15 -0
  87. data/src/managers/basic_game_object_manager.rb +81 -0
  88. data/src/managers/basic_physics_manager.rb +97 -0
  89. data/src/managers/basic_render_manager.rb +48 -0
  90. data/src/managers/basic_tangible_manager.rb +33 -0
  91. data/src/managers/basic_update_manager.rb +27 -0
  92. data/src/managers/diagnostic/diagnostic_input_manager.rb +0 -0
  93. data/src/managers/input_manager.rb +229 -0
  94. data/src/managers/input_support/input_mapping.rb +126 -0
  95. data/src/managers/input_support/input_message.rb +5 -0
  96. data/src/managers/input_support/slick_input_listener.rb +19 -0
  97. data/src/managers/input_support/slick_input_message.rb +11 -0
  98. data/src/managers/input_support/slick_input_translator.rb +15 -0
  99. data/src/managers/message_queue.rb +54 -0
  100. data/src/managers/scrolling_render_manager.rb +44 -0
  101. data/src/managers/sound_manager.rb +60 -0
  102. data/src/managers/tag_manager.rb +43 -0
  103. data/src/math.rb +13 -0
  104. data/src/music.rb +14 -0
  105. data/src/org/rubyforge/rawr/Main.java +67 -0
  106. data/src/platform.rb +28 -0
  107. data/src/proc_enhancement.rb +5 -0
  108. data/src/project_generator.rb +122 -0
  109. data/src/skeleton.txt +10 -0
  110. data/src/spline.rb +13 -0
  111. data/src/states/input_diagnostic_state.rb +53 -0
  112. data/src/vector.rb +99 -0
  113. data/test/test_state.rb +3 -0
  114. metadata +181 -0
@@ -0,0 +1,10 @@
1
+ As a user I should be able to invoke 'gemini <myproject>' to create a fresh Gemini project
2
+ As a user I should be able to have a default directory structure created for me (keymaps, game_objects, input_helpers, managers, and behaviors, states)
3
+ As a user I should be able to have a lib directory populated with default jars and libs.
4
+ As a user I should be able to have a Rawr configuration generated
5
+ As a user I should be able to use the generator without having to install Rawr previously (dependant gem)
6
+ As a user I should be able to have a working app upon generation (main and game state).
7
+ As a user I should be able to generate individual files (keymaps, game_objects, input_helpers, managers, and behaviors, states)
8
+ As a user I should be able to see "Hello World" when I run the default game.
9
+ As a user I should be able to exit the default game by pressing esc.
10
+ As a user I should be able to see examples of mappings commented out in a keymap file.
@@ -0,0 +1,13 @@
1
+ class Spline
2
+ def initialize(*x_y_arrays)
3
+ @points = x_y_arrays
4
+ @current_point_index = 0
5
+ end
6
+
7
+ def succ
8
+ y = @points[@current_point_index][1]
9
+ @current_point_index += 1
10
+ @current_point_index = 0 if @current_point_index >= @points.size
11
+ y
12
+ end
13
+ end
@@ -0,0 +1,53 @@
1
+ class InputDiagnosticState < Gemini::BaseState
2
+ def load
3
+ @input = manager(:input)
4
+ @raw_input = @input.instance_variable_get(:@raw_input)
5
+ @input.connected_joystick_size.times do |joystick_index|
6
+ width = joystick_width_offset(joystick_index)
7
+ @joystick_height_offset = 40
8
+ text = create :Text, width, @joystick_height_offset , "Controller #{joystick_index}"
9
+ text.x += text.text_width / 2
10
+ map_all_buttons_for_joystick joystick_index
11
+ map_all_axes_for_joystick joystick_index
12
+ end
13
+ end
14
+
15
+ def map_all_axes_for_joystick(joystick_id)
16
+ @raw_input.get_axis_count(joystick_id).times do |axis_id|
17
+ @joystick_height_offset += 10
18
+ axis_text = create :Text, joystick_width_offset(joystick_id), @joystick_height_offset, "axis"
19
+ axis_text.add_behavior :Updates
20
+ axis_text.on_update do
21
+ # TODO: Split name and value for easier alignment
22
+ axis_name = @raw_input.get_axis_name(joystick_id, axis_id)
23
+ axis_value = @raw_input.get_axis_value(joystick_id, axis_id)
24
+ axis_text.text = "#{axis_name}: #{"%+.2f" % axis_value}"
25
+ axis_text.x = joystick_width_offset(joystick_id) + 20 + (axis_text.text_width / 2)
26
+ end
27
+ end
28
+ end
29
+
30
+ def joystick_width_offset(joystick_index)
31
+ 80 + (joystick_index * 80)
32
+ end
33
+
34
+ def map_all_buttons_for_joystick(joystick_id)
35
+ 25.times do |button_id|
36
+ begin
37
+ @raw_input.is_button_pressed(button_id, joystick_id)
38
+ rescue java.lang.ArrayIndexOutOfBoundsException
39
+ return # All done if we reached the end
40
+ end
41
+
42
+ @joystick_height_offset += 10
43
+ button_text = create :Text, joystick_width_offset(joystick_id), @joystick_height_offset, "button"
44
+ button_text.add_behavior :Updates
45
+ button_text.on_update do
46
+ button_down = @raw_input.is_button_pressed(button_id, joystick_id)
47
+ button_down_text = button_down ? "Down" : "Up"
48
+ button_text.text = "#{button_id}: #{button_down_text}"
49
+ button_text.x = joystick_width_offset(joystick_id) + 20 + (button_text.text_width / 2)
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,99 @@
1
+ class Vector
2
+ attr_reader :native_vector
3
+
4
+ def dup
5
+ self.new(x, y)
6
+ end
7
+
8
+ def self.from_polar_vector(magnitude, angle)
9
+ w = Math.sin(Gemini::Math.degrees_to_radians(angle))
10
+ h = -Math.cos(Gemini::Math.degrees_to_radians(angle))
11
+ return new(w * magnitude, h * magnitude)
12
+ end
13
+
14
+ def initialize(x = 0.0, y = 0.0, z = nil)
15
+ @native_vector = Java::org::newdawn::slick::geom::Vector2f.new(x, y)
16
+ end
17
+
18
+ def +(other_vector)
19
+ Vector.new(x + other_vector.x, y + other_vector.y)
20
+ end
21
+
22
+ def x
23
+ @native_vector.x
24
+ end
25
+
26
+ def y
27
+ @native_vector.y
28
+ end
29
+
30
+ def z
31
+ @native_vector.z
32
+ end
33
+
34
+ def x=(new_x)
35
+ @native_vector.x = new_x
36
+ end
37
+
38
+ def y=(new_y)
39
+ @native_vector.y = new_y
40
+ end
41
+
42
+ def z=(new_z)
43
+ @native_vector.z = new_z
44
+ end
45
+
46
+ def to_phys2d_vector
47
+ Java::net::phys2d::math::Vector2f.new(@native_vector.x, @native_vector.y)
48
+ end
49
+
50
+ def distance_from(other_vector)
51
+ (((x - other_vector.x) ** 2) + ((y - other_vector.y) ** 2)) ** (1.0 / 2.0)
52
+ end
53
+
54
+ def angle_from(other_vector)
55
+ #TODO: Adding 90 degrees indicates to me that this is the wrong trig function.
56
+ # Although it's good for perpendicular angles, which we'll need a method for.
57
+ Gemini::Math.radians_to_degrees(Math.atan2(y - other_vector.y, x - other_vector.x)) + 90.0
58
+ end
59
+
60
+ def pivot_around_degrees(other_vector, rotation)
61
+ pivot_around(other_vector, Gemini::Math.degrees_to_radians(rotation))
62
+ end
63
+
64
+ def pivot_around(other_vector, rotation)
65
+ diff_x = x - other_vector.x
66
+ diff_y = y - other_vector.y
67
+ sine = Math.sin(rotation)
68
+ cosine = Math.cos(rotation)
69
+ rotated_x = (cosine * diff_x) - (sine * diff_y)
70
+ rotated_y = (sine * diff_x) + (cosine * diff_y)
71
+ self.class.new rotated_x, rotated_y
72
+ end
73
+
74
+ def polar_angle
75
+ Math.atan2(y, x)
76
+ end
77
+
78
+ def polar_angle_degrees
79
+ Gemini::Math.radians_to_degrees polar_angle
80
+ end
81
+
82
+ def negate
83
+ self.class.new(-x, -y)
84
+ end
85
+ end
86
+
87
+ class Java::net::phys2d::math::Vector2f
88
+ def +(other_vector)
89
+ Vector.new(x + other_vector.x, y + other_vector.y)
90
+ end
91
+
92
+ def to_vector
93
+ Vector.new(x, y)
94
+ end
95
+
96
+ def to_phys2d_vector
97
+ self
98
+ end
99
+ end
@@ -0,0 +1,3 @@
1
+ class TestState < Gemini::BaseState
2
+
3
+ end
metadata ADDED
@@ -0,0 +1,181 @@
1
+ --- !ruby/object:Gem::Specification
2
+ extensions: []
3
+
4
+ homepage: http://rubyforge.org/projects/gemini/
5
+ executables:
6
+ - gemini
7
+ version: !ruby/object:Gem::Version
8
+ version: 1.0.0
9
+ post_install_message:
10
+ date: 2009-06-21 07:00:00 +00:00
11
+ files:
12
+ - lib/ibxm.jar
13
+ - lib/jinput.jar
14
+ - lib/jogg-0.0.7.jar
15
+ - lib/jorbis-0.0.15.jar
16
+ - lib/jruby-complete.jar
17
+ - lib/lwjgl.jar
18
+ - lib/lwjgl_util_applet.jar
19
+ - lib/natives-linux.jar
20
+ - lib/natives-mac.jar
21
+ - lib/natives-win32.jar
22
+ - lib/phys2d.jar
23
+ - lib/slick.jar
24
+ - lib/native_files/jinput-dx8.dll
25
+ - lib/native_files/jinput-raw.dll
26
+ - lib/native_files/libjinput-linux.so
27
+ - lib/native_files/libjinput-linux64.so
28
+ - lib/native_files/libjinput-osx.jnilib
29
+ - lib/native_files/liblwjgl.jnilib
30
+ - lib/native_files/liblwjgl.so
31
+ - lib/native_files/liblwjgl64.so
32
+ - lib/native_files/libopenal.so
33
+ - lib/native_files/lwjgl.dll
34
+ - lib/native_files/openal.dylib
35
+ - lib/native_files/OpenAL32.dll
36
+ - src/base_state.rb
37
+ - src/behavior.rb
38
+ - src/behavior_event.rb
39
+ - src/behaviors.txt
40
+ - src/color.rb
41
+ - src/game_object.rb
42
+ - src/gemini.rb
43
+ - src/gemini_version.rb
44
+ - src/inflector.rb
45
+ - src/listenable_mixin.rb
46
+ - src/math.rb
47
+ - src/music.rb
48
+ - src/platform.rb
49
+ - src/proc_enhancement.rb
50
+ - src/project_generator.rb
51
+ - src/skeleton.txt
52
+ - src/spline.rb
53
+ - src/vector.rb
54
+ - src/behaviors/animated_sprite.rb
55
+ - src/behaviors/audible.rb
56
+ - src/behaviors/axis_stateful.rb
57
+ - src/behaviors/big_sprite.rb
58
+ - src/behaviors/bounding_box_collidable.rb
59
+ - src/behaviors/camera_anchored_drawable.rb
60
+ - src/behaviors/cardinal_movable.rb
61
+ - src/behaviors/clickable.rb
62
+ - src/behaviors/countable.rb
63
+ - src/behaviors/debug_physical.rb
64
+ - src/behaviors/debug_tangible.rb
65
+ - src/behaviors/drawable.rb
66
+ - src/behaviors/drawable_shape.rb
67
+ - src/behaviors/fading_image_trail_emittable.rb
68
+ - src/behaviors/game_object_emittable.rb
69
+ - src/behaviors/gravity_source.rb
70
+ - src/behaviors/inertial.rb
71
+ - src/behaviors/movable2d.rb
72
+ - src/behaviors/multi_animated_sprite.rb
73
+ - src/behaviors/physical.rb
74
+ - src/behaviors/physical_cardinal_movable.rb
75
+ - src/behaviors/physical_sprite.rb
76
+ - src/behaviors/platformer_controllable.rb
77
+ - src/behaviors/pointer.rb
78
+ - src/behaviors/pressable.rb
79
+ - src/behaviors/receives_events.rb
80
+ - src/behaviors/regional.rb
81
+ - src/behaviors/rotates_to_point.rb
82
+ - src/behaviors/spatial.rb
83
+ - src/behaviors/spline_stretchable_sprite.rb
84
+ - src/behaviors/sprite.rb
85
+ - src/behaviors/stateful.rb
86
+ - src/behaviors/taggable.rb
87
+ - src/behaviors/tangible.rb
88
+ - src/behaviors/timeable.rb
89
+ - src/behaviors/top_down_vehicle.rb
90
+ - src/behaviors/triangle_trail_emittable.rb
91
+ - src/behaviors/updates.rb
92
+ - src/behaviors/updates_at_consistant_rate.rb
93
+ - src/behaviors/vectored_movement.rb
94
+ - src/behaviors/world_collidable.rb
95
+ - src/game_objects/background.rb
96
+ - src/game_objects/fading_image.rb
97
+ - src/game_objects/icon_strip_counter_display.rb
98
+ - src/game_objects/static_sprite.rb
99
+ - src/game_objects/tangible_object.rb
100
+ - src/game_objects/text.rb
101
+ - src/game_objects/triangle_trail.rb
102
+ - src/input_helpers/joystick_dead_zone_filter.rb
103
+ - src/managers/basic_game_object_manager.rb
104
+ - src/managers/basic_physics_manager.rb
105
+ - src/managers/basic_render_manager.rb
106
+ - src/managers/basic_tangible_manager.rb
107
+ - src/managers/basic_update_manager.rb
108
+ - src/managers/input_manager.rb
109
+ - src/managers/message_queue.rb
110
+ - src/managers/scrolling_render_manager.rb
111
+ - src/managers/sound_manager.rb
112
+ - src/managers/tag_manager.rb
113
+ - src/managers/diagnostic/diagnostic_input_manager.rb
114
+ - src/managers/input_support/input_mapping.rb
115
+ - src/managers/input_support/input_message.rb
116
+ - src/managers/input_support/slick_input_listener.rb
117
+ - src/managers/input_support/slick_input_message.rb
118
+ - src/managers/input_support/slick_input_translator.rb
119
+ - src/org/rubyforge/rawr/Main.java
120
+ - src/states/input_diagnostic_state.rb
121
+ - bin/gemini
122
+ - build_configuration.rb
123
+ - package/jar/gemini.jar
124
+ rubygems_version: 1.3.3
125
+ rdoc_options:
126
+ - --main
127
+ - README.txt
128
+ signing_key:
129
+ cert_chain: []
130
+
131
+ name: gemini
132
+ has_rdoc: true
133
+ platform: ruby
134
+ summary: Gemini is a Ruby game engine that separates the game logic from reusable
135
+ game features. Includes hardware accelerated graphics, physics, standalone distros,
136
+ and more.
137
+ default_executable:
138
+ bindir: bin
139
+ licenses: []
140
+
141
+ required_rubygems_version: !ruby/object:Gem::Requirement
142
+ version:
143
+ requirements:
144
+ - - '>='
145
+ - !ruby/object:Gem::Version
146
+ version: "0"
147
+ required_ruby_version: !ruby/object:Gem::Requirement
148
+ version:
149
+ requirements:
150
+ - - '>='
151
+ - !ruby/object:Gem::Version
152
+ version: "0"
153
+ require_paths:
154
+ - lib
155
+ - src
156
+ specification_version: 3
157
+ test_files:
158
+ - test/test_state.rb
159
+ dependencies:
160
+ - !ruby/object:Gem::Dependency
161
+ type: :runtime
162
+ name: rawr
163
+ version_requirement:
164
+ version_requirements: !ruby/object:Gem::Requirement
165
+ version:
166
+ requirements:
167
+ - - '>='
168
+ - !ruby/object:Gem::Version
169
+ version: "0"
170
+ description: ""
171
+ email: logustus@gmail.com
172
+ authors:
173
+ - Logan Barnett, David Koontz
174
+ extra_rdoc_files:
175
+ - src/behaviors.txt
176
+ - src/skeleton.txt
177
+ - bin/gemini
178
+ requirements: []
179
+
180
+ rubyforge_project: gemini
181
+ autorequire: