jemini 2010.1.5 → 2010.1.24
Sign up to get free protection for your applications and to get access to all the features.
- data/README.txt +1 -1
- data/package/jar/jemini.jar +0 -0
- data/skeleton/data/jemini_logo.png +0 -0
- data/skeleton/icons/jemini.icns +0 -0
- data/skeleton/icons/jemini.ico +0 -0
- data/src/behaviors/drawable_ellipse.rb +2 -3
- data/src/behaviors/drawable_line.rb +2 -3
- data/src/behaviors/drawable_rectangle.rb +2 -3
- data/src/color.rb +34 -13
- data/src/game_objects/sprite.rb +7 -0
- data/src/logger_mixin.rb +4 -2
- data/src/project_generator.rb +14 -5
- metadata +7 -3
data/README.txt
CHANGED
data/package/jar/jemini.jar
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# draws a line on the screen
|
2
2
|
class DrawableEllipse < Jemini::Behavior
|
3
3
|
java_import 'org.newdawn.slick.geom.Ellipse'
|
4
|
-
java_import 'org.newdawn.slick.Color'
|
5
4
|
depends_on :Spatial
|
6
5
|
wrap_with_callbacks :draw
|
7
6
|
|
@@ -11,7 +10,7 @@ class DrawableEllipse < Jemini::Behavior
|
|
11
10
|
attr_accessor :ellipse_filled
|
12
11
|
|
13
12
|
def load
|
14
|
-
@color = Color.white
|
13
|
+
@color = Color.new :white
|
15
14
|
@ellipse_filled = true
|
16
15
|
@ellipse = Ellipse.new @game_object.position.x, @game_object.position.y, 1.0, 1.0
|
17
16
|
@game_object.on_after_position_changes { set_drawing_location }
|
@@ -37,7 +36,7 @@ class DrawableEllipse < Jemini::Behavior
|
|
37
36
|
|
38
37
|
#Draw an outline to the given graphics context.
|
39
38
|
def draw(graphics)
|
40
|
-
graphics.set_color @color
|
39
|
+
graphics.set_color @color.native_color
|
41
40
|
if @ellipse_filled
|
42
41
|
graphics.fill @ellipse
|
43
42
|
else
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# draws a line on the screen
|
2
2
|
class DrawableLine < Jemini::Behavior
|
3
3
|
java_import 'org.newdawn.slick.geom.Line'
|
4
|
-
java_import 'org.newdawn.slick.Color'
|
5
4
|
depends_on :Spatial
|
6
5
|
wrap_with_callbacks :draw
|
7
6
|
|
@@ -11,7 +10,7 @@ class DrawableLine < Jemini::Behavior
|
|
11
10
|
attr_accessor :color
|
12
11
|
|
13
12
|
def load
|
14
|
-
@color = Color.white
|
13
|
+
@color = Color.new :white
|
15
14
|
@line_end_position = Vector.new(0.0, 0.0)
|
16
15
|
@line = Line.new @game_object.position.to_slick_vector, @line_end_position.to_slick_vector
|
17
16
|
@game_object.on_after_position_changes { set_line }
|
@@ -25,7 +24,7 @@ class DrawableLine < Jemini::Behavior
|
|
25
24
|
|
26
25
|
#Draw the line to the given graphics context.
|
27
26
|
def draw(graphics)
|
28
|
-
graphics.set_color @color
|
27
|
+
graphics.set_color @color.native_color
|
29
28
|
graphics.draw @line
|
30
29
|
end
|
31
30
|
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# draws a line on the screen
|
2
2
|
class DrawableRectangle < Jemini::Behavior
|
3
3
|
java_import 'org.newdawn.slick.geom.Rectangle'
|
4
|
-
java_import 'org.newdawn.slick.Color'
|
5
4
|
depends_on :Spatial
|
6
5
|
wrap_with_callbacks :draw
|
7
6
|
|
@@ -11,7 +10,7 @@ class DrawableRectangle < Jemini::Behavior
|
|
11
10
|
attr_accessor :rectangle_filled
|
12
11
|
|
13
12
|
def load
|
14
|
-
@color = Color.white
|
13
|
+
@color = Color.new :white
|
15
14
|
@rectangle_filled = true
|
16
15
|
@rectangle = Rectangle.new @game_object.position.x, @game_object.position.y, 1.0, 1.0
|
17
16
|
@game_object.on_after_position_changes { set_drawing_location }
|
@@ -37,7 +36,7 @@ class DrawableRectangle < Jemini::Behavior
|
|
37
36
|
|
38
37
|
#Draw an outline to the given graphics context.
|
39
38
|
def draw(graphics)
|
40
|
-
graphics.set_color @color
|
39
|
+
graphics.set_color @color.native_color
|
41
40
|
if @rectangle_filled
|
42
41
|
graphics.fill @rectangle
|
43
42
|
else
|
data/src/color.rb
CHANGED
@@ -3,20 +3,17 @@ class Color
|
|
3
3
|
attr_reader :native_color
|
4
4
|
|
5
5
|
def initialize(red_or_other, blue = nil, green = nil, alpha = 1.0)
|
6
|
-
if red_or_other
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
if from_hex?(red_or_other, green, blue)
|
7
|
+
from_hex(red_or_other)
|
8
|
+
elsif from_rgba?(red_or_other, blue, green)
|
9
|
+
from_rgba(red_or_other, blue, green, alpha)
|
10
|
+
elsif red_or_other.is_a? SlickColor
|
11
|
+
@native_color = red_or_other
|
12
12
|
else
|
13
|
-
|
14
|
-
fixed_color = SlickColor.send(red_or_other.to_s.downcase)
|
15
|
-
# we don't want to change the original, so we copy it
|
16
|
-
@native_color = SlickColor.new(fixed_color.r, fixed_color.g, fixed_color.b, fixed_color.a)
|
13
|
+
from_word(red_or_other)
|
17
14
|
end
|
18
15
|
end
|
19
|
-
|
16
|
+
|
20
17
|
def red
|
21
18
|
@native_color.r
|
22
19
|
end
|
@@ -58,14 +55,38 @@ class Color
|
|
58
55
|
end
|
59
56
|
|
60
57
|
def darken_by(amount)
|
61
|
-
@native_color.
|
58
|
+
self.class.new @native_color.darker amount
|
62
59
|
end
|
63
60
|
|
64
61
|
def darken_by!(amount)
|
65
|
-
@native_color = @native_color.
|
62
|
+
@native_color = @native_color.darker amount
|
66
63
|
end
|
67
64
|
|
68
65
|
def fade_by(amount)
|
69
66
|
self.alpha = alpha * (1.0 - amount)
|
70
67
|
end
|
68
|
+
|
69
|
+
private
|
70
|
+
def from_hex?(red, green, blue)
|
71
|
+
red.is_a?(Numeric) && green.nil? && blue.nil? #alpha defaults to 1.0
|
72
|
+
end
|
73
|
+
|
74
|
+
def from_hex(hex)
|
75
|
+
@native_color = SlickColor.new(hex)
|
76
|
+
end
|
77
|
+
|
78
|
+
def from_rgba?(red, blue, green)
|
79
|
+
red.is_a?(Numeric) && !blue.nil? && !green.nil?
|
80
|
+
end
|
81
|
+
|
82
|
+
def from_rgba(red, blue, green, alpha)
|
83
|
+
@native_color = SlickColor.new(red, blue, green, alpha)
|
84
|
+
end
|
85
|
+
|
86
|
+
def from_word(word)
|
87
|
+
# create from predefined Slick colors
|
88
|
+
fixed_color = SlickColor.send(word.to_s.downcase)
|
89
|
+
# we don't want to change the original, so we copy it
|
90
|
+
@native_color = SlickColor.new(fixed_color.r, fixed_color.g, fixed_color.b, fixed_color.a)
|
91
|
+
end
|
71
92
|
end
|
data/src/logger_mixin.rb
CHANGED
@@ -3,9 +3,11 @@ require 'logger'
|
|
3
3
|
module LoggerMixin
|
4
4
|
|
5
5
|
#Get the Logger object (see the Ruby standard library documentation).
|
6
|
-
#The log level is set to match the
|
6
|
+
#The log level is set to match the LOG_LEVEL environment variable, or Logger::ERROR by default.
|
7
7
|
def log
|
8
|
-
@log ||= Logger.new(STDOUT
|
8
|
+
@log ||= Logger.new(STDOUT)
|
9
|
+
@log.level = (ENV['LOG_LEVEL'] and "Logger::#{ENV['LOG_LEVEL']}".constantize) || Logger::ERROR
|
10
|
+
@log
|
9
11
|
end
|
10
12
|
|
11
13
|
end
|
data/src/project_generator.rb
CHANGED
@@ -12,6 +12,7 @@ module Jemini
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def generate_project
|
15
|
+
copy_skeleton
|
15
16
|
generate_default_dirs
|
16
17
|
generate_main
|
17
18
|
# generate_main_with_natives
|
@@ -21,6 +22,11 @@ module Jemini
|
|
21
22
|
copy_jemini_jar
|
22
23
|
end
|
23
24
|
|
25
|
+
def copy_skeleton
|
26
|
+
skeleton_dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'skeleton', '.'))
|
27
|
+
cp_r skeleton_dir, @project_dir
|
28
|
+
end
|
29
|
+
|
24
30
|
def generate_main
|
25
31
|
mkdir_p File.expand_path(File.join(@project_dir, 'src'))
|
26
32
|
path = File.expand_path(File.join(@project_dir, 'src', 'main.rb'))
|
@@ -100,10 +106,8 @@ ENDL
|
|
100
106
|
f << <<-ENDL
|
101
107
|
class HelloWorldState < Jemini::GameState
|
102
108
|
def load
|
103
|
-
create(:
|
104
|
-
|
105
|
-
:position => Vector.new(screen_width / 2, screen_height / 2)
|
106
|
-
)
|
109
|
+
create(:Sprite, :jemini_logo).position = Vector.new(screen_size.half.x, screen_size.y * 0.25)
|
110
|
+
create(:Text, "Now, place your own state code in the src/states folder!", :position => screen_size.half)
|
107
111
|
end
|
108
112
|
end
|
109
113
|
ENDL
|
@@ -116,7 +120,12 @@ ENDL
|
|
116
120
|
puts `rawr install #{@rawr_install_args} #{@project_dir}`
|
117
121
|
build_config_path = File.join(@project_dir, 'build_configuration.rb')
|
118
122
|
build_config = File.read build_config_path
|
119
|
-
build_config.sub!('#c.java_library_path = "lib/java/native"',
|
123
|
+
build_config.sub!('#c.java_library_path = "lib/java/native"', <<-CONFIG)
|
124
|
+
c.java_library_path = "lib/java/native_files"'
|
125
|
+
c.mac_icon_path = File.expand_path('icons/jemini.icns')
|
126
|
+
c.windows_icon_path = File.expand_path('icons/jemini.ico')
|
127
|
+
CONFIG
|
128
|
+
|
120
129
|
build_config.sub!('#c.jvm_arguments = "-server"', 'c.jvm_arguments = "-XX:+UseConcMarkSweepGC -Djruby.compile.mode=FORCE -Xms256m -Xmx512m"')
|
121
130
|
build_config.sub!(%Q{#c.jars[:data] = { :directory => 'data/images', :location_in_jar => 'images', :exclude => /bak/}}, %Q{c.jars[:data] = { :directory => 'data', :location_in_jar => 'data', :exclude => /bak/}})
|
122
131
|
build_config.sub!(%Q{#c.files_to_copy = Dir['other_files/dir/**/*']}, %Q{c.files_to_copy = Dir['lib/java/native_files/**/*']})
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jemini
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2010.1.
|
4
|
+
version: 2010.1.24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Logan Barnett, David Koontz, Jay McGavren
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-24 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 1.3.
|
23
|
+
version: 1.3.7
|
24
24
|
version:
|
25
25
|
description: Jemini is a game library designed to allow creation of reusable features. How many times has someone implemented the aiming on a first person shooter, or a minimap on a real time strategy? Jemini comes packaged with lots of behaviors out of the box, with the ability to easily author more. Jemini uses Phys2D and Slick for physics and graphics, with 3D on the roadmap.
|
26
26
|
email: logustus@gmail.com
|
@@ -95,6 +95,7 @@ files:
|
|
95
95
|
- src/game_objects/background.rb
|
96
96
|
- src/game_objects/fading_image.rb
|
97
97
|
- src/game_objects/icon_strip_counter_display.rb
|
98
|
+
- src/game_objects/sprite.rb
|
98
99
|
- src/game_objects/tangible_object.rb
|
99
100
|
- src/game_objects/text.rb
|
100
101
|
- src/game_objects/triangle_trail.rb
|
@@ -155,6 +156,9 @@ files:
|
|
155
156
|
- lib/native_files/OpenAL32.dll
|
156
157
|
- package/jar/jemini.jar
|
157
158
|
- README.txt
|
159
|
+
- skeleton/data/jemini_logo.png
|
160
|
+
- skeleton/icons/jemini.icns
|
161
|
+
- skeleton/icons/jemini.ico
|
158
162
|
has_rdoc: true
|
159
163
|
homepage: http://rubyforge.org/projects/jemini/
|
160
164
|
licenses: []
|