moonpxi-nimo 0.1.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.
- data/.document +5 -0
- data/.gitignore +5 -0
- data/LICENSE +20 -0
- data/README.rdoc +15 -0
- data/Rakefile +47 -0
- data/VERSION +1 -0
- data/examples/bouncy.rb +101 -0
- data/examples/eventy.rb +19 -0
- data/examples/images/dg_classm32.png +0 -0
- data/examples/images/dg_dungeon32.png +0 -0
- data/examples/images/jeeklabs.png +0 -0
- data/examples/images/tcheco.png +0 -0
- data/examples/imagey.rb +82 -0
- data/examples/screeny.rb +80 -0
- data/examples/simplest.rb +23 -0
- data/examples/sounds/KDE-Sys-Log-Out.ogg +0 -0
- data/examples/sounds/k3b_error1.wav +0 -0
- data/examples/soundy.rb +40 -0
- data/examples/spritey.rb +90 -0
- data/lib/nimo.rb +35 -0
- data/lib/nimo/behavior/deflector.rb +39 -0
- data/lib/nimo/behavior/moveable.rb +33 -0
- data/lib/nimo/behavior/projectile.rb +23 -0
- data/lib/nimo/behavior/with_velocity.rb +28 -0
- data/lib/nimo/game_object.rb +58 -0
- data/lib/nimo/game_window.rb +59 -0
- data/lib/nimo/listeners/event_listener.rb +27 -0
- data/lib/nimo/listeners/input_listener.rb +70 -0
- data/lib/nimo/representations/image_representation.rb +18 -0
- data/lib/nimo/representations/object_representation.rb +67 -0
- data/lib/nimo/representations/quad_representation.rb +23 -0
- data/lib/nimo/representations/sprite_representation.rb +78 -0
- data/lib/nimo/representations/text_representation.rb +27 -0
- data/lib/nimo/screen.rb +103 -0
- data/lib/nimo/utils/game.rb +63 -0
- data/lib/nimo/utils/intersection.rb +30 -0
- data/lib/nimo/utils/object_extension.rb +17 -0
- data/lib/nimo/utils/resources.rb +51 -0
- data/nimo.gemspec +117 -0
- data/spec/nimo/behavior/deflector_spec.rb +51 -0
- data/spec/nimo/behavior/moveable_spec.rb +81 -0
- data/spec/nimo/behavior/projectile_spec.rb +34 -0
- data/spec/nimo/behavior/with_velocity_spec.rb +18 -0
- data/spec/nimo/game_object_spec.rb +169 -0
- data/spec/nimo/game_window_spec.rb +88 -0
- data/spec/nimo/listeners/event_listener_spec.rb +34 -0
- data/spec/nimo/listeners/input_listener_spec.rb +87 -0
- data/spec/nimo/representations/image_representation_spec.rb +41 -0
- data/spec/nimo/representations/object_representation_spec.rb +74 -0
- data/spec/nimo/representations/sprite_representation_spec.rb +73 -0
- data/spec/nimo/representations/text_representation_spec.rb +21 -0
- data/spec/nimo/screen_spec.rb +114 -0
- data/spec/nimo/utils/game_spec.rb +44 -0
- data/spec/nimo/utils/object_extension_spec.rb +21 -0
- data/spec/nimo/utils/resources_spec.rb +59 -0
- data/spec/spec_helper.rb +9 -0
- metadata +133 -0
@@ -0,0 +1,44 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
|
3
|
+
describe "Nimo::Game module method" do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
@game_window = mock("game window")
|
7
|
+
Nimo::GameWindow.should_receive(:new).with("title", 320, 240).and_return(@game_window)
|
8
|
+
@game_window.should_receive(:show)
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should construct and show a GameWindow with title and dimenstion attributes" do
|
12
|
+
window = Nimo::Game("title", 320, 240)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should construct and show a GameWindow with a construction block" do
|
16
|
+
@game_window.should_receive(:add_screen)
|
17
|
+
|
18
|
+
window = Nimo::Game("title", 320, 240) do
|
19
|
+
screen :some_screen
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
# describe "(screen construction)" do
|
25
|
+
# it "should add a new screen with the supplied screen building block" do
|
26
|
+
# screen = mock("screen")
|
27
|
+
# Nimo::Screen.should_receive(:new).and_return(screen)
|
28
|
+
# screen.should_receive(:quad).with(:something)
|
29
|
+
# screen.should_receive(:notify)
|
30
|
+
#
|
31
|
+
# @game_window.screen :name do
|
32
|
+
# quad :something
|
33
|
+
# end
|
34
|
+
# end
|
35
|
+
#
|
36
|
+
# it "should forward image loading to the Resources" do
|
37
|
+
# image_def = {:some_tag => { :filename => "some file name.png" }}
|
38
|
+
# @resources.should_receive(:load_images).with(image_def)
|
39
|
+
#
|
40
|
+
# @game_window.images(image_def)
|
41
|
+
# end
|
42
|
+
# end
|
43
|
+
|
44
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
|
3
|
+
describe Object do
|
4
|
+
|
5
|
+
it "should create object from hash" do
|
6
|
+
obj = Object.from_hash(:a => 1, :b => 2)
|
7
|
+
|
8
|
+
obj.a.should == 1
|
9
|
+
obj.b.should == 2
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should set values in the object from hash" do
|
13
|
+
obj = Object.from_hash(:a => 1, :b => 2)
|
14
|
+
obj.a = 3
|
15
|
+
obj.b = 4
|
16
|
+
|
17
|
+
obj.a.should == 3
|
18
|
+
obj.b.should == 4
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
|
3
|
+
describe Nimo::Resources do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
@resources = Nimo::Resources.new(nil)
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should load images" do
|
10
|
+
some_image = mock("image")
|
11
|
+
Gosu::Image.should_receive(:new).and_return(some_image)
|
12
|
+
|
13
|
+
@resources.load_images(:some_image => { :filename => "some_file.png" })
|
14
|
+
|
15
|
+
@resources.images.should have_key(:some_image)
|
16
|
+
@resources.image(:some_image).should == some_image
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should raise exception when trying to get an unknown image" do
|
20
|
+
lambda { @resources.image(:unknown) }.should raise_error("No image resource named 'unknown'")
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should load tiled images" do
|
24
|
+
Gosu::Image.should_receive(:load_tiles).and_return(nil)
|
25
|
+
|
26
|
+
@resources.load_images(:some_tile => { :filename => "some_file.png", :tile_dimension => [32, 32] })
|
27
|
+
|
28
|
+
@resources.images.should have_key(:some_tile)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should load fonts" do
|
32
|
+
some_font = mock("font")
|
33
|
+
Gosu::Font.should_receive(:new).and_return(some_font)
|
34
|
+
|
35
|
+
@resources.load_fonts(:some_font => { :type => "some_font_name", :size => 42 })
|
36
|
+
|
37
|
+
@resources.fonts.should have_key(:some_font)
|
38
|
+
@resources.font(:some_font).should == some_font
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should raise exception when trying to get an unknown font" do
|
42
|
+
lambda { @resources.font(:unknown) }.should raise_error("No font resource named 'unknown'")
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should load sounds" do
|
46
|
+
some_sound = mock("sound")
|
47
|
+
Gosu::Song.should_receive(:new).and_return(some_sound)
|
48
|
+
|
49
|
+
@resources.load_sounds(:some_sound => { :filename => "some_file.wav" })
|
50
|
+
|
51
|
+
@resources.sounds.should have_key(:some_sound)
|
52
|
+
@resources.sound(:some_sound).should == some_sound
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should raise exception when trying to get an unknown sound" do
|
56
|
+
lambda { @resources.sound(:unknown) }.should raise_error("No sound resource named 'unknown'")
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: moonpxi-nimo
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- moonpxi
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-09-17 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description:
|
17
|
+
email: paulo.schneider@gmail.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- LICENSE
|
24
|
+
- README.rdoc
|
25
|
+
files:
|
26
|
+
- .document
|
27
|
+
- .gitignore
|
28
|
+
- LICENSE
|
29
|
+
- README.rdoc
|
30
|
+
- Rakefile
|
31
|
+
- VERSION
|
32
|
+
- examples/bouncy.rb
|
33
|
+
- examples/eventy.rb
|
34
|
+
- examples/images/dg_classm32.png
|
35
|
+
- examples/images/dg_dungeon32.png
|
36
|
+
- examples/images/jeeklabs.png
|
37
|
+
- examples/images/tcheco.png
|
38
|
+
- examples/imagey.rb
|
39
|
+
- examples/screeny.rb
|
40
|
+
- examples/simplest.rb
|
41
|
+
- examples/sounds/KDE-Sys-Log-Out.ogg
|
42
|
+
- examples/sounds/k3b_error1.wav
|
43
|
+
- examples/soundy.rb
|
44
|
+
- examples/spritey.rb
|
45
|
+
- lib/nimo.rb
|
46
|
+
- lib/nimo/behavior/deflector.rb
|
47
|
+
- lib/nimo/behavior/moveable.rb
|
48
|
+
- lib/nimo/behavior/projectile.rb
|
49
|
+
- lib/nimo/behavior/with_velocity.rb
|
50
|
+
- lib/nimo/game_object.rb
|
51
|
+
- lib/nimo/game_window.rb
|
52
|
+
- lib/nimo/listeners/event_listener.rb
|
53
|
+
- lib/nimo/listeners/input_listener.rb
|
54
|
+
- lib/nimo/representations/image_representation.rb
|
55
|
+
- lib/nimo/representations/object_representation.rb
|
56
|
+
- lib/nimo/representations/quad_representation.rb
|
57
|
+
- lib/nimo/representations/sprite_representation.rb
|
58
|
+
- lib/nimo/representations/text_representation.rb
|
59
|
+
- lib/nimo/screen.rb
|
60
|
+
- lib/nimo/utils/game.rb
|
61
|
+
- lib/nimo/utils/intersection.rb
|
62
|
+
- lib/nimo/utils/object_extension.rb
|
63
|
+
- lib/nimo/utils/resources.rb
|
64
|
+
- nimo.gemspec
|
65
|
+
- spec/nimo/behavior/deflector_spec.rb
|
66
|
+
- spec/nimo/behavior/moveable_spec.rb
|
67
|
+
- spec/nimo/behavior/projectile_spec.rb
|
68
|
+
- spec/nimo/behavior/with_velocity_spec.rb
|
69
|
+
- spec/nimo/game_object_spec.rb
|
70
|
+
- spec/nimo/game_window_spec.rb
|
71
|
+
- spec/nimo/listeners/event_listener_spec.rb
|
72
|
+
- spec/nimo/listeners/input_listener_spec.rb
|
73
|
+
- spec/nimo/representations/image_representation_spec.rb
|
74
|
+
- spec/nimo/representations/object_representation_spec.rb
|
75
|
+
- spec/nimo/representations/sprite_representation_spec.rb
|
76
|
+
- spec/nimo/representations/text_representation_spec.rb
|
77
|
+
- spec/nimo/screen_spec.rb
|
78
|
+
- spec/nimo/utils/game_spec.rb
|
79
|
+
- spec/nimo/utils/object_extension_spec.rb
|
80
|
+
- spec/nimo/utils/resources_spec.rb
|
81
|
+
- spec/spec_helper.rb
|
82
|
+
has_rdoc: false
|
83
|
+
homepage: http://github.com/moonpxi/nimo
|
84
|
+
licenses:
|
85
|
+
post_install_message:
|
86
|
+
rdoc_options:
|
87
|
+
- --charset=UTF-8
|
88
|
+
require_paths:
|
89
|
+
- lib
|
90
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: "0"
|
95
|
+
version:
|
96
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: "0"
|
101
|
+
version:
|
102
|
+
requirements: []
|
103
|
+
|
104
|
+
rubyforge_project:
|
105
|
+
rubygems_version: 1.3.5
|
106
|
+
signing_key:
|
107
|
+
specification_version: 3
|
108
|
+
summary: Ruby game development library using Gosu.
|
109
|
+
test_files:
|
110
|
+
- spec/nimo/behavior/deflector_spec.rb
|
111
|
+
- spec/nimo/behavior/moveable_spec.rb
|
112
|
+
- spec/nimo/behavior/projectile_spec.rb
|
113
|
+
- spec/nimo/behavior/with_velocity_spec.rb
|
114
|
+
- spec/nimo/game_object_spec.rb
|
115
|
+
- spec/nimo/game_window_spec.rb
|
116
|
+
- spec/nimo/listeners/event_listener_spec.rb
|
117
|
+
- spec/nimo/listeners/input_listener_spec.rb
|
118
|
+
- spec/nimo/representations/image_representation_spec.rb
|
119
|
+
- spec/nimo/representations/object_representation_spec.rb
|
120
|
+
- spec/nimo/representations/sprite_representation_spec.rb
|
121
|
+
- spec/nimo/representations/text_representation_spec.rb
|
122
|
+
- spec/nimo/screen_spec.rb
|
123
|
+
- spec/nimo/utils/game_spec.rb
|
124
|
+
- spec/nimo/utils/object_extension_spec.rb
|
125
|
+
- spec/nimo/utils/resources_spec.rb
|
126
|
+
- spec/spec_helper.rb
|
127
|
+
- examples/bouncy.rb
|
128
|
+
- examples/eventy.rb
|
129
|
+
- examples/imagey.rb
|
130
|
+
- examples/screeny.rb
|
131
|
+
- examples/simplest.rb
|
132
|
+
- examples/soundy.rb
|
133
|
+
- examples/spritey.rb
|