lotu 0.1.14 → 0.1.15
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.
- data/.rspec +2 -0
- data/Rakefile +12 -1
- data/VERSION +1 -1
- data/examples/hello_world/moving_portraits.rb +9 -9
- data/lib/lotu/actor.rb +0 -1
- data/lib/lotu/behaviors/system_user.rb +3 -2
- data/lib/lotu/game.rb +6 -8
- data/lib/lotu/systems/collision_system.rb +3 -4
- data/lib/lotu/systems/fps_system.rb +2 -3
- data/lib/lotu/systems/input_system.rb +3 -4
- data/lib/lotu/systems/interpolation_system.rb +7 -6
- data/lib/lotu/systems/stalker_system.rb +2 -3
- data/lib/lotu/systems/steering_system.rb +11 -11
- data/lib/lotu.rb +1 -1
- data/lotu.gemspec +63 -58
- data/spec/lotu/actor_spec.rb +32 -0
- data/spec/lotu/game_spec.rb +44 -0
- metadata +61 -59
- data/.gitignore +0 -22
data/.rspec
ADDED
data/Rakefile
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
require 'rubygems'
|
|
2
2
|
require 'rake'
|
|
3
|
+
require 'psych' if RUBY_VERSION.include?( '1.9' )
|
|
3
4
|
|
|
4
5
|
begin
|
|
5
6
|
require 'jeweler'
|
|
@@ -10,7 +11,8 @@ begin
|
|
|
10
11
|
gem.email = "dev@lobotuerto.com"
|
|
11
12
|
gem.homepage = "http://github.com/lobo-tuerto/lotu"
|
|
12
13
|
gem.authors = ["lobo_tuerto"]
|
|
13
|
-
gem.add_dependency "gosu", ">= 0.7.
|
|
14
|
+
gem.add_dependency "gosu", ">= 0.7.27.1"
|
|
15
|
+
gem.add_development_dependency "rspec", ">= 2.5.0"
|
|
14
16
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
|
15
17
|
end
|
|
16
18
|
Jeweler::GemcutterTasks.new
|
|
@@ -27,3 +29,12 @@ Rake::RDocTask.new do |rdoc|
|
|
|
27
29
|
rdoc.rdoc_files.include('README*')
|
|
28
30
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
29
31
|
end
|
|
32
|
+
|
|
33
|
+
# rspec rake task stuff
|
|
34
|
+
require 'rspec/core/rake_task'
|
|
35
|
+
desc "Run the tests under spec"
|
|
36
|
+
RSpec::Core::RakeTask.new do |t|
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# default rake task
|
|
40
|
+
task :default => :spec
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.
|
|
1
|
+
0.1.15
|
|
@@ -14,16 +14,16 @@ include Gosu
|
|
|
14
14
|
include Lotu
|
|
15
15
|
|
|
16
16
|
# We want to move something around the screen so we create a new Actor
|
|
17
|
-
# subclass, set the image all instances of
|
|
17
|
+
# subclass, set the image for all the instances of that class and
|
|
18
18
|
# define the movement methods
|
|
19
19
|
class Portrait < Actor
|
|
20
20
|
|
|
21
|
-
def initialize(opts
|
|
21
|
+
def initialize( opts )
|
|
22
22
|
# It's important to call super so we take advantage of automatic
|
|
23
|
-
# management for this object (being added to draw and update
|
|
23
|
+
# management for this object (being added to draw and update queues)
|
|
24
24
|
super
|
|
25
25
|
# Use the image which filename is "lobo_tuerto.png", and scale
|
|
26
|
-
# it's
|
|
26
|
+
# it's size to half width and half height
|
|
27
27
|
set_image 'lobo_tuerto.png', :factor_x => 0.5, :factor_y => 0.5
|
|
28
28
|
end
|
|
29
29
|
|
|
@@ -36,15 +36,15 @@ class Portrait < Actor
|
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
# Let's subclass the Game class and write some code!
|
|
39
|
-
class
|
|
39
|
+
class MyPortraits < Game
|
|
40
40
|
|
|
41
41
|
def initialize
|
|
42
42
|
# This will call the hooks:
|
|
43
43
|
# load_resources, setup_systems, setup_input and setup_actors
|
|
44
44
|
# declared in the parent class
|
|
45
45
|
super
|
|
46
|
-
# When the Escape key is pressed, call the close method on
|
|
47
|
-
# instance
|
|
46
|
+
# When the Escape key is pressed, call the close method on our
|
|
47
|
+
# game instance MyPortraits, when D key is pressed turn on
|
|
48
48
|
# debug, we pass false into the array to tell the input system we
|
|
49
49
|
# don't want autofire on, else pass the number of milliseconds
|
|
50
50
|
# (zero and no array is the same)
|
|
@@ -63,7 +63,7 @@ class Portraits < Game
|
|
|
63
63
|
|
|
64
64
|
# This method is called when we call super inside initialize
|
|
65
65
|
def setup_actors
|
|
66
|
-
# Create a
|
|
66
|
+
# Create a portrait in the middle of the screen
|
|
67
67
|
@lobo1 = Portrait.new(:x => width/2, :y => height/2)
|
|
68
68
|
# Map keys to some methods
|
|
69
69
|
@lobo1.set_keys(KbRight => :move_right,
|
|
@@ -89,4 +89,4 @@ class Portraits < Game
|
|
|
89
89
|
end
|
|
90
90
|
|
|
91
91
|
# Create and show the app
|
|
92
|
-
|
|
92
|
+
MyPortraits.new.show
|
data/lib/lotu/actor.rb
CHANGED
data/lib/lotu/game.rb
CHANGED
|
@@ -19,6 +19,7 @@ module Lotu
|
|
|
19
19
|
# Handy global window variable
|
|
20
20
|
$lotu = self
|
|
21
21
|
@debug = opts[:debug] || false
|
|
22
|
+
@pause = false
|
|
22
23
|
setup_containers
|
|
23
24
|
|
|
24
25
|
# For timer initialization
|
|
@@ -60,9 +61,6 @@ module Lotu
|
|
|
60
61
|
|
|
61
62
|
# Setup various containers
|
|
62
63
|
def setup_containers
|
|
63
|
-
# For systems
|
|
64
|
-
@systems = {}
|
|
65
|
-
|
|
66
64
|
# For queues
|
|
67
65
|
@update_queue = []
|
|
68
66
|
@draw_queue = []
|
|
@@ -155,7 +153,7 @@ module Lotu
|
|
|
155
153
|
|
|
156
154
|
def load_images(path)
|
|
157
155
|
count = 0
|
|
158
|
-
with_files(/\.png
|
|
156
|
+
with_files(/\.png$|\.jpg$|\.bmp$/, path) do |file_name, file_path|
|
|
159
157
|
count += 1
|
|
160
158
|
@images[file_name] = Gosu::Image.new($lotu, file_path)
|
|
161
159
|
end
|
|
@@ -164,7 +162,7 @@ module Lotu
|
|
|
164
162
|
|
|
165
163
|
def load_sounds(path)
|
|
166
164
|
count = 0
|
|
167
|
-
with_files(/\.ogg
|
|
165
|
+
with_files(/\.ogg$|\.mp3$|\.wav$/, path) do |file_name, file_path|
|
|
168
166
|
count += 1
|
|
169
167
|
@sounds[file_name] = Gosu::Sample.new($lotu, file_path)
|
|
170
168
|
end
|
|
@@ -173,7 +171,7 @@ module Lotu
|
|
|
173
171
|
|
|
174
172
|
def load_songs(path)
|
|
175
173
|
count = 0
|
|
176
|
-
with_files(/\.ogg
|
|
174
|
+
with_files(/\.ogg$|\.mp3$|\.wav$/, path) do |file_name, file_path|
|
|
177
175
|
count += 1
|
|
178
176
|
@songs[file_name] = Gosu::Song.new($lotu, file_path)
|
|
179
177
|
end
|
|
@@ -184,7 +182,7 @@ module Lotu
|
|
|
184
182
|
count = 0
|
|
185
183
|
coords = Hash.new{|h,k| h[k] = []}
|
|
186
184
|
|
|
187
|
-
with_files(/\.txt
|
|
185
|
+
with_files(/\.txt$/, path) do |file_name, file_path|
|
|
188
186
|
name = File.basename(file_name, '.txt')
|
|
189
187
|
File.open(file_path) do |file|
|
|
190
188
|
file.lines.each do |line|
|
|
@@ -194,7 +192,7 @@ module Lotu
|
|
|
194
192
|
false
|
|
195
193
|
end
|
|
196
194
|
|
|
197
|
-
with_files(/\.png
|
|
195
|
+
with_files(/\.png$|\.jpg$|\.bmp$/, path) do |file_name, file_path|
|
|
198
196
|
name, extension = file_name.split('.')
|
|
199
197
|
count += 1 if coords[name]
|
|
200
198
|
coords[name].each do |index, x, y, width, height|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
module Lotu
|
|
2
|
-
class CollisionSystem
|
|
2
|
+
class CollisionSystem < System
|
|
3
3
|
|
|
4
4
|
def initialize(user, opts={})
|
|
5
|
-
|
|
5
|
+
super
|
|
6
|
+
@user.extend UserMethods
|
|
6
7
|
@entities = Hash.new{ |h,k| h[k] = [] }
|
|
7
8
|
@actions = {}
|
|
8
9
|
end
|
|
@@ -29,8 +30,6 @@ module Lotu
|
|
|
29
30
|
end
|
|
30
31
|
end
|
|
31
32
|
|
|
32
|
-
def draw;end
|
|
33
|
-
|
|
34
33
|
module UserMethods
|
|
35
34
|
def when_colliding(*args, &blk)
|
|
36
35
|
systems[CollisionSystem].when_colliding(*args, &blk)
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
module Lotu
|
|
2
|
-
class FpsSystem
|
|
2
|
+
class FpsSystem < System
|
|
3
3
|
|
|
4
4
|
def initialize(user, opts={})
|
|
5
|
+
super
|
|
5
6
|
default_opts = {
|
|
6
7
|
:ticks_per_update => 10
|
|
7
8
|
}
|
|
@@ -26,7 +27,5 @@ module Lotu
|
|
|
26
27
|
"Ticks per update: #{@ticks_per_update} | FPS: #{format("%.2f",@fps)}"
|
|
27
28
|
end
|
|
28
29
|
|
|
29
|
-
def draw;end
|
|
30
|
-
|
|
31
30
|
end
|
|
32
31
|
end
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
module Lotu
|
|
2
|
-
class InputSystem
|
|
2
|
+
class InputSystem < System
|
|
3
3
|
|
|
4
4
|
def initialize(user, opts={})
|
|
5
|
-
|
|
5
|
+
super
|
|
6
|
+
@user.extend UserMethods
|
|
6
7
|
# Current ongoing actions (button is being pushed)
|
|
7
8
|
@actions = []
|
|
8
9
|
@unique_actions = []
|
|
@@ -56,8 +57,6 @@ module Lotu
|
|
|
56
57
|
end
|
|
57
58
|
end
|
|
58
59
|
|
|
59
|
-
def draw;end
|
|
60
|
-
|
|
61
60
|
module UserMethods
|
|
62
61
|
def set_keys(keys)
|
|
63
62
|
systems[InputSystem].set_keys(self, keys)
|
|
@@ -33,11 +33,11 @@ module Lotu
|
|
|
33
33
|
@interpolations.each do |t|
|
|
34
34
|
t[:accum_time] += dt
|
|
35
35
|
if t[:accum_time] > t[:start_in]
|
|
36
|
-
step = (t[:end] - t[:init])/t[:duration] * dt
|
|
36
|
+
step = ( t[:end] - t[:init] )/t[:duration] * dt
|
|
37
37
|
t[:calc] += step
|
|
38
|
-
tag_for_deletion(t) if step == 0
|
|
39
|
-
if(t[:init] + t[:calc] > t[:end] && step > 0) || (t[:init] + t[:calc] < t[:end] && step < 0)
|
|
40
|
-
if t[:loop] || (t[:bounce] && !t[:bouncing_back])
|
|
38
|
+
tag_for_deletion( t ) if step == 0
|
|
39
|
+
if( t[:init] + t[:calc] > t[:end] && step > 0 ) || ( t[:init] + t[:calc] < t[:end] && step < 0 )
|
|
40
|
+
if t[:loop] || ( t[:bounce] && !t[:bouncing_back] )
|
|
41
41
|
t[:calc] = 0
|
|
42
42
|
else
|
|
43
43
|
t[:calc] = t[:end] - t[:init]
|
|
@@ -50,12 +50,13 @@ module Lotu
|
|
|
50
50
|
end
|
|
51
51
|
value = t[:init] + t[:calc]
|
|
52
52
|
value = value.send(t[:on_result]) if t[:on_result]
|
|
53
|
-
t[:object].send(t[:property_setter], value)
|
|
53
|
+
t[:object].send( t[:property_setter], value )
|
|
54
54
|
end
|
|
55
55
|
end
|
|
56
56
|
|
|
57
57
|
@tagged_for_deletion.each do |to_delete|
|
|
58
|
-
|
|
58
|
+
#@interpolations.delete( to_delete )
|
|
59
|
+
@interpolations.delete_if{ |i| i.object_id == to_delete.object_id }
|
|
59
60
|
end.clear
|
|
60
61
|
end
|
|
61
62
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
module Lotu
|
|
2
|
-
class StalkerSystem
|
|
2
|
+
class StalkerSystem < System
|
|
3
3
|
|
|
4
4
|
def initialize(user, opts={})
|
|
5
|
+
super
|
|
5
6
|
default_opts = {
|
|
6
7
|
:stalk => [Actor],
|
|
7
8
|
:ticks_per_update => 30
|
|
@@ -31,7 +32,5 @@ module Lotu
|
|
|
31
32
|
end
|
|
32
33
|
end
|
|
33
34
|
|
|
34
|
-
def draw;end
|
|
35
|
-
|
|
36
35
|
end
|
|
37
36
|
end
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
module Lotu
|
|
3
|
-
class SteeringSystem
|
|
3
|
+
class SteeringSystem < System
|
|
4
4
|
|
|
5
5
|
def initialize(user, opts={})
|
|
6
|
+
super
|
|
6
7
|
# Add new functionality to Actor
|
|
7
|
-
user.extend UserMethods
|
|
8
|
+
@user.extend UserMethods
|
|
8
9
|
|
|
9
10
|
# Initialize attributes
|
|
10
11
|
default_opts = {
|
|
@@ -17,20 +18,19 @@ module Lotu
|
|
|
17
18
|
}
|
|
18
19
|
opts = default_opts.merge!(opts)
|
|
19
20
|
|
|
20
|
-
user.mass = opts[:mass]
|
|
21
|
-
user.max_speed = opts[:max_speed]
|
|
22
|
-
user.max_turn_rate = opts[:max_turn_rate]
|
|
23
|
-
user.max_force = opts[:max_force]
|
|
24
|
-
user.wander_radius = opts[:wander_radius]
|
|
25
|
-
user.wander_distance = opts[:wander_distance]
|
|
21
|
+
@user.mass = opts[:mass]
|
|
22
|
+
@user.max_speed = opts[:max_speed]
|
|
23
|
+
@user.max_turn_rate = opts[:max_turn_rate]
|
|
24
|
+
@user.max_force = opts[:max_force]
|
|
25
|
+
@user.wander_radius = opts[:wander_radius]
|
|
26
|
+
@user.wander_distance = opts[:wander_distance]
|
|
26
27
|
|
|
27
28
|
# More attributes
|
|
28
|
-
@user = user
|
|
29
29
|
@behaviors = {}
|
|
30
30
|
@force = Vector2d.new
|
|
31
31
|
@zero = Vector2d.new
|
|
32
|
-
user.pos.x = user.x
|
|
33
|
-
user.pos.y = user.y
|
|
32
|
+
@user.pos.x = user.x
|
|
33
|
+
@user.pos.y = user.y
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
def update
|
data/lib/lotu.rb
CHANGED
|
@@ -5,4 +5,4 @@ require 'gosu'
|
|
|
5
5
|
%w{vector2d string}.each{|file| require "misc/#{file}"}
|
|
6
6
|
%w{system_user collidable controllable eventful}.each{|file| require "behaviors/#{file}"}
|
|
7
7
|
%w{game system actor cursor text_box}.each{|file| require file}
|
|
8
|
-
%w{
|
|
8
|
+
%w{interpolation animation input stalker fps collision steering}.map{|s| "#{s}_system"}.each{|file| require "systems/#{file}"}
|
data/lotu.gemspec
CHANGED
|
@@ -1,90 +1,95 @@
|
|
|
1
1
|
# Generated by jeweler
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = %q{lotu}
|
|
8
|
-
s.version = "0.1.
|
|
8
|
+
s.version = "0.1.15"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["lobo_tuerto"]
|
|
12
|
-
s.date = %q{
|
|
12
|
+
s.date = %q{2011-02-22}
|
|
13
13
|
s.description = %q{lotu aims to bring an agile and simple game development framework to life. It provides useful abstractions so you can concentrate on developing your game.}
|
|
14
14
|
s.email = %q{dev@lobotuerto.com}
|
|
15
15
|
s.extra_rdoc_files = [
|
|
16
16
|
"LICENSE",
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
"README.rdoc",
|
|
18
|
+
"TODO"
|
|
19
19
|
]
|
|
20
20
|
s.files = [
|
|
21
21
|
".document",
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
22
|
+
".rspec",
|
|
23
|
+
"LICENSE",
|
|
24
|
+
"README.rdoc",
|
|
25
|
+
"Rakefile",
|
|
26
|
+
"VERSION",
|
|
27
|
+
"examples/hello_world/moving_portraits.rb",
|
|
28
|
+
"examples/media/animations/missile.png",
|
|
29
|
+
"examples/media/animations/missile.txt",
|
|
30
|
+
"examples/media/images/cohete-big.png",
|
|
31
|
+
"examples/media/images/cohete-medium.png",
|
|
32
|
+
"examples/media/images/cohete-small.png",
|
|
33
|
+
"examples/media/images/crosshair-1.png",
|
|
34
|
+
"examples/media/images/crosshair-2.png",
|
|
35
|
+
"examples/media/images/crosshair-3.png",
|
|
36
|
+
"examples/media/images/lobo_tuerto.png",
|
|
37
|
+
"examples/media/images/missile-med.png",
|
|
38
|
+
"examples/media/images/silo.png",
|
|
39
|
+
"examples/screen_cursor/mouse_and_keyboard_cursors.rb",
|
|
40
|
+
"examples/steering_behaviors/pursuit_and_evade.rb",
|
|
41
|
+
"examples/steering_behaviors/pursuit_and_evade_multiple.rb",
|
|
42
|
+
"lib/lotu.rb",
|
|
43
|
+
"lib/lotu/actor.rb",
|
|
44
|
+
"lib/lotu/behaviors/collidable.rb",
|
|
45
|
+
"lib/lotu/behaviors/controllable.rb",
|
|
46
|
+
"lib/lotu/behaviors/eventful.rb",
|
|
47
|
+
"lib/lotu/behaviors/system_user.rb",
|
|
48
|
+
"lib/lotu/cursor.rb",
|
|
49
|
+
"lib/lotu/game.rb",
|
|
50
|
+
"lib/lotu/misc/string.rb",
|
|
51
|
+
"lib/lotu/misc/vector2d.rb",
|
|
52
|
+
"lib/lotu/system.rb",
|
|
53
|
+
"lib/lotu/systems/animation_system.rb",
|
|
54
|
+
"lib/lotu/systems/collision_system.rb",
|
|
55
|
+
"lib/lotu/systems/fps_system.rb",
|
|
56
|
+
"lib/lotu/systems/input_system.rb",
|
|
57
|
+
"lib/lotu/systems/interpolation_system.rb",
|
|
58
|
+
"lib/lotu/systems/stalker_system.rb",
|
|
59
|
+
"lib/lotu/systems/steering_system.rb",
|
|
60
|
+
"lib/lotu/text_box.rb",
|
|
61
|
+
"lotu.gemspec",
|
|
62
|
+
"spec/lotu/actor_spec.rb",
|
|
63
|
+
"spec/lotu/game_spec.rb",
|
|
64
|
+
"test/actor_test.rb"
|
|
63
65
|
]
|
|
64
66
|
s.homepage = %q{http://github.com/lobo-tuerto/lotu}
|
|
65
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
|
66
67
|
s.require_paths = ["lib"]
|
|
67
|
-
s.rubygems_version = %q{1.
|
|
68
|
+
s.rubygems_version = %q{1.5.0}
|
|
68
69
|
s.summary = %q{A simple, agile Ruby game development framework.}
|
|
69
70
|
s.test_files = [
|
|
70
|
-
"
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
"examples/hello_world/moving_portraits.rb",
|
|
72
|
+
"examples/screen_cursor/mouse_and_keyboard_cursors.rb",
|
|
73
|
+
"examples/steering_behaviors/pursuit_and_evade.rb",
|
|
74
|
+
"examples/steering_behaviors/pursuit_and_evade_multiple.rb",
|
|
75
|
+
"spec/lotu/actor_spec.rb",
|
|
76
|
+
"spec/lotu/game_spec.rb",
|
|
77
|
+
"test/actor_test.rb"
|
|
75
78
|
]
|
|
76
79
|
|
|
77
80
|
if s.respond_to? :specification_version then
|
|
78
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
|
79
81
|
s.specification_version = 3
|
|
80
82
|
|
|
81
|
-
if Gem::Version.new(Gem::
|
|
82
|
-
s.add_runtime_dependency(%q<gosu>, [">= 0.7.
|
|
83
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
|
84
|
+
s.add_runtime_dependency(%q<gosu>, [">= 0.7.27.1"])
|
|
85
|
+
s.add_development_dependency(%q<rspec>, [">= 2.5.0"])
|
|
83
86
|
else
|
|
84
|
-
s.add_dependency(%q<gosu>, [">= 0.7.
|
|
87
|
+
s.add_dependency(%q<gosu>, [">= 0.7.27.1"])
|
|
88
|
+
s.add_dependency(%q<rspec>, [">= 2.5.0"])
|
|
85
89
|
end
|
|
86
90
|
else
|
|
87
|
-
s.add_dependency(%q<gosu>, [">= 0.7.
|
|
91
|
+
s.add_dependency(%q<gosu>, [">= 0.7.27.1"])
|
|
92
|
+
s.add_dependency(%q<rspec>, [">= 2.5.0"])
|
|
88
93
|
end
|
|
89
94
|
end
|
|
90
95
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
require 'lotu'
|
|
2
|
+
|
|
3
|
+
describe "Actor" do
|
|
4
|
+
before :each do
|
|
5
|
+
@game = Lotu::Game.new
|
|
6
|
+
@actor = Lotu::Actor.new
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
after :each do
|
|
10
|
+
@actor.die
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it{ @actor.should respond_to :x }
|
|
14
|
+
it{ @actor.should respond_to :y }
|
|
15
|
+
it{ @actor.should respond_to :parent }
|
|
16
|
+
it{ @actor.should respond_to :color }
|
|
17
|
+
|
|
18
|
+
describe "at creation" do
|
|
19
|
+
it "#x == 0" do
|
|
20
|
+
@actor.x.should == 0
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it "#y == 0" do
|
|
24
|
+
@actor.y.should == 0
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it "#z == 0" do
|
|
28
|
+
@actor.z.should == 0
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
require 'lotu'
|
|
2
|
+
|
|
3
|
+
describe "Game" do
|
|
4
|
+
before :each do
|
|
5
|
+
@game = Lotu::Game.new
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
it{ @game.should respond_to :close }
|
|
9
|
+
it{ @game.should respond_to :update }
|
|
10
|
+
it{ @game.should respond_to :draw }
|
|
11
|
+
|
|
12
|
+
describe "every game tick" do
|
|
13
|
+
before :each do
|
|
14
|
+
@actor = Lotu::Actor.new
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
after :each do
|
|
18
|
+
@actor.die
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it "should call #update on actors" do
|
|
22
|
+
@actor.should_receive :update
|
|
23
|
+
@game.update
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it "should call #draw on actors" do
|
|
27
|
+
@actor.should_receive :draw
|
|
28
|
+
@game.draw
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
%Q{
|
|
35
|
+
1.upto(100) do |i|
|
|
36
|
+
if i % 3 == 0 || i % 5 == 0
|
|
37
|
+
print 'Fizz' if i % 3 == 0
|
|
38
|
+
print 'Buzz' if i % 5 == 0
|
|
39
|
+
else
|
|
40
|
+
print i
|
|
41
|
+
end
|
|
42
|
+
print "\n"
|
|
43
|
+
end
|
|
44
|
+
}.size
|
metadata
CHANGED
|
@@ -1,49 +1,52 @@
|
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lotu
|
|
3
|
-
version: !ruby/object:Gem::Version
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
- 0
|
|
7
|
-
- 1
|
|
8
|
-
- 14
|
|
9
|
-
version: 0.1.14
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.15
|
|
5
|
+
prerelease: !!null
|
|
10
6
|
platform: ruby
|
|
11
|
-
authors:
|
|
7
|
+
authors:
|
|
12
8
|
- lobo_tuerto
|
|
13
|
-
autorequire:
|
|
9
|
+
autorequire: !!null
|
|
14
10
|
bindir: bin
|
|
15
11
|
cert_chain: []
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
- !ruby/object:Gem::Dependency
|
|
12
|
+
date: 2011-02-22 00:00:00.000000000 -06:00
|
|
13
|
+
default_executable: !!null
|
|
14
|
+
dependencies:
|
|
15
|
+
- !ruby/object:Gem::Dependency
|
|
21
16
|
name: gosu
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
requirements:
|
|
25
|
-
- -
|
|
26
|
-
- !ruby/object:Gem::Version
|
|
27
|
-
|
|
28
|
-
- 0
|
|
29
|
-
- 7
|
|
30
|
-
- 18
|
|
31
|
-
version: 0.7.18
|
|
17
|
+
requirement: &10531180 !ruby/object:Gem::Requirement
|
|
18
|
+
none: false
|
|
19
|
+
requirements:
|
|
20
|
+
- - ! '>='
|
|
21
|
+
- !ruby/object:Gem::Version
|
|
22
|
+
version: 0.7.27.1
|
|
32
23
|
type: :runtime
|
|
33
|
-
|
|
34
|
-
|
|
24
|
+
prerelease: false
|
|
25
|
+
version_requirements: *10531180
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: rspec
|
|
28
|
+
requirement: &10530140 !ruby/object:Gem::Requirement
|
|
29
|
+
none: false
|
|
30
|
+
requirements:
|
|
31
|
+
- - ! '>='
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: 2.5.0
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: *10530140
|
|
37
|
+
description: lotu aims to bring an agile and simple game development framework to
|
|
38
|
+
life. It provides useful abstractions so you can concentrate on developing your
|
|
39
|
+
game.
|
|
35
40
|
email: dev@lobotuerto.com
|
|
36
41
|
executables: []
|
|
37
|
-
|
|
38
42
|
extensions: []
|
|
39
|
-
|
|
40
|
-
extra_rdoc_files:
|
|
43
|
+
extra_rdoc_files:
|
|
41
44
|
- LICENSE
|
|
42
45
|
- README.rdoc
|
|
43
46
|
- TODO
|
|
44
|
-
files:
|
|
47
|
+
files:
|
|
45
48
|
- .document
|
|
46
|
-
- .
|
|
49
|
+
- .rspec
|
|
47
50
|
- LICENSE
|
|
48
51
|
- README.rdoc
|
|
49
52
|
- Rakefile
|
|
@@ -83,41 +86,40 @@ files:
|
|
|
83
86
|
- lib/lotu/systems/steering_system.rb
|
|
84
87
|
- lib/lotu/text_box.rb
|
|
85
88
|
- lotu.gemspec
|
|
89
|
+
- spec/lotu/actor_spec.rb
|
|
90
|
+
- spec/lotu/game_spec.rb
|
|
86
91
|
- test/actor_test.rb
|
|
87
92
|
- TODO
|
|
88
93
|
has_rdoc: true
|
|
89
94
|
homepage: http://github.com/lobo-tuerto/lotu
|
|
90
95
|
licenses: []
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
- --charset=UTF-8
|
|
95
|
-
require_paths:
|
|
96
|
+
post_install_message: !!null
|
|
97
|
+
rdoc_options: []
|
|
98
|
+
require_paths:
|
|
96
99
|
- lib
|
|
97
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
requirements:
|
|
106
|
-
- -
|
|
107
|
-
- !ruby/object:Gem::Version
|
|
108
|
-
|
|
109
|
-
- 0
|
|
110
|
-
version: "0"
|
|
100
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
101
|
+
none: false
|
|
102
|
+
requirements:
|
|
103
|
+
- - ! '>='
|
|
104
|
+
- !ruby/object:Gem::Version
|
|
105
|
+
version: '0'
|
|
106
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
|
+
none: false
|
|
108
|
+
requirements:
|
|
109
|
+
- - ! '>='
|
|
110
|
+
- !ruby/object:Gem::Version
|
|
111
|
+
version: '0'
|
|
111
112
|
requirements: []
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
signing_key:
|
|
113
|
+
rubyforge_project: !!null
|
|
114
|
+
rubygems_version: 1.5.0
|
|
115
|
+
signing_key: !!null
|
|
116
116
|
specification_version: 3
|
|
117
117
|
summary: A simple, agile Ruby game development framework.
|
|
118
|
-
test_files:
|
|
119
|
-
- test/actor_test.rb
|
|
120
|
-
- examples/steering_behaviors/pursuit_and_evade.rb
|
|
121
|
-
- examples/steering_behaviors/pursuit_and_evade_multiple.rb
|
|
118
|
+
test_files:
|
|
122
119
|
- examples/hello_world/moving_portraits.rb
|
|
123
120
|
- examples/screen_cursor/mouse_and_keyboard_cursors.rb
|
|
121
|
+
- examples/steering_behaviors/pursuit_and_evade.rb
|
|
122
|
+
- examples/steering_behaviors/pursuit_and_evade_multiple.rb
|
|
123
|
+
- spec/lotu/actor_spec.rb
|
|
124
|
+
- spec/lotu/game_spec.rb
|
|
125
|
+
- test/actor_test.rb
|