chingu 0.7.6.4 → 0.7.6.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -3
- data/.rspec +2 -0
- data/README.rdoc +48 -33
- data/Rakefile +42 -22
- data/chingu.gemspec +26 -4
- data/examples/example21.yml +55 -55
- data/examples/example6_transitional_game_state.rb +3 -2
- data/examples/example9_collision_detection.rb +12 -22
- data/lib/chingu.rb +1 -1
- data/lib/chingu/assets.rb +3 -1
- data/lib/chingu/basic_game_object.rb +1 -1
- data/lib/chingu/core_ext/array.rb +1 -0
- data/lib/chingu/game_object_list.rb +1 -12
- data/lib/chingu/game_state.rb +1 -1
- data/lib/chingu/game_state_manager.rb +1 -0
- data/lib/chingu/game_states/edit.rb +5 -2
- data/lib/chingu/game_states/fade_to.rb +4 -8
- data/lib/chingu/text.rb +1 -1
- data/lib/chingu/traits/bounding_circle.rb +2 -6
- data/lib/chingu/traits/collision_detection.rb +7 -7
- data/lib/chingu/traits/velocity.rb +9 -6
- data/spec/chingu/fpscounter_spec.rb +43 -0
- data/spec/chingu/game_object_spec.rb +96 -0
- data/spec/chingu/inflector_spec.rb +21 -0
- data/spec/chingu/rect_20x20.png +0 -0
- data/spec/chingu/text_spec.rb +18 -0
- data/spec/spec_helper.rb +20 -0
- data/specs.watchr +74 -0
- metadata +63 -4
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Chingu
|
4
|
+
|
5
|
+
describe Inflector do
|
6
|
+
|
7
|
+
describe ".camelize" do
|
8
|
+
it "camelizes strings" do
|
9
|
+
subject.camelize("automatic_assets").should eql("AutomaticAssets")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe ".underscore" do
|
14
|
+
it "converts class-like strings to underscore" do
|
15
|
+
subject.underscore("FireBall").should eql("fire_ball")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
Binary file
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Chingu
|
4
|
+
|
5
|
+
describe Text do
|
6
|
+
|
7
|
+
it "should initialize properly"
|
8
|
+
#it { should respond_to :text }
|
9
|
+
#it { should respond_to :height }
|
10
|
+
#it { should respond_to :gosu_font }
|
11
|
+
#it { should respond_to :line_spacing }
|
12
|
+
#it { should respond_to :align }
|
13
|
+
#it { should respond_to :max_width }
|
14
|
+
#it { should respond_to :background }
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
|
+
|
4
|
+
# encoding: utf-8
|
5
|
+
require 'rubygems'
|
6
|
+
require 'rspec'
|
7
|
+
|
8
|
+
require 'chingu'
|
9
|
+
|
10
|
+
def media_path(file)
|
11
|
+
File.join($window.root, "..", "..", "examples", "media", file)
|
12
|
+
end
|
13
|
+
|
14
|
+
if defined?(Rcov)
|
15
|
+
|
16
|
+
# all_app_files = Dir.glob('lib/**/*.rb')
|
17
|
+
# all_app_files.each{|rb| require rb}
|
18
|
+
|
19
|
+
end
|
20
|
+
|
data/specs.watchr
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Run me with:
|
2
|
+
#
|
3
|
+
# $ watchr specs.watchr
|
4
|
+
|
5
|
+
# --------------------------------------------------
|
6
|
+
# Convenience Methods
|
7
|
+
# --------------------------------------------------
|
8
|
+
# [32m [0m
|
9
|
+
def growl(message)
|
10
|
+
growlnotify = `which growlnotify`.chomp
|
11
|
+
image = !message.include?('0 failures') ? "~/.watchr_images/failed.png" : "~/.watchr_images/passed.png"
|
12
|
+
|
13
|
+
status = image =~ /failed/ ? '[31m' : '[32m'
|
14
|
+
|
15
|
+
message = message.split('seconds')[1].split(status)[1].split('[0m')[0]
|
16
|
+
|
17
|
+
options = "'Watchr - Chingu specs' -w --image '#{File.expand_path(image)}' -m '#{message}'"
|
18
|
+
system %(#{growlnotify} #{options} &)
|
19
|
+
end
|
20
|
+
|
21
|
+
def all_spec_files
|
22
|
+
Dir['spec/**/*_spec.rb']
|
23
|
+
end
|
24
|
+
|
25
|
+
def run_spec_matching(thing_to_match)
|
26
|
+
matches = all_spec_files.grep(/#{thing_to_match}/i)
|
27
|
+
if matches.empty?
|
28
|
+
puts "Sorry, thanks for playing, but there were no matches for #{thing_to_match}"
|
29
|
+
else
|
30
|
+
run matches.join(' ')
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def run(files_to_run)
|
35
|
+
puts("Running: #{files_to_run}")
|
36
|
+
result = `rspec -cfs #{files_to_run}`
|
37
|
+
print result
|
38
|
+
growl result rescue nil
|
39
|
+
no_int_for_you
|
40
|
+
end
|
41
|
+
|
42
|
+
def run_all_specs
|
43
|
+
run(all_spec_files.join(' '))
|
44
|
+
end
|
45
|
+
|
46
|
+
# --------------------------------------------------
|
47
|
+
# Watchr Rules
|
48
|
+
# --------------------------------------------------
|
49
|
+
watch('^spec/(.*)_spec\.rb') { |m| run_spec_matching(m[1]) }
|
50
|
+
watch('^lib/(.*)\.rb') { |m| run_spec_matching(m[1]) }
|
51
|
+
watch('^spec/spec_helper\.rb') { run_all_specs }
|
52
|
+
watch('^spec/support/.*\.rb') { run_all_specs }
|
53
|
+
|
54
|
+
# --------------------------------------------------
|
55
|
+
# Signal Handling
|
56
|
+
# --------------------------------------------------
|
57
|
+
|
58
|
+
def no_int_for_you
|
59
|
+
@sent_an_int = nil
|
60
|
+
end
|
61
|
+
|
62
|
+
Signal.trap 'INT' do
|
63
|
+
if @sent_an_int then
|
64
|
+
puts " A second INT? Ok, I get the message. Shutting down now."
|
65
|
+
exit
|
66
|
+
else
|
67
|
+
puts " Did you just send me an INT? Ugh. I'll quit for real if you do it again."
|
68
|
+
@sent_an_int = true
|
69
|
+
Kernel.sleep 1.5
|
70
|
+
run_all_specs
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# vim:ft=ruby
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chingu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 101
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 7
|
9
9
|
- 6
|
10
|
-
-
|
11
|
-
version: 0.7.6.
|
10
|
+
- 5
|
11
|
+
version: 0.7.6.5
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- ippa
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-06-
|
19
|
+
date: 2010-06-22 00:00:00 +02:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -35,6 +35,52 @@ dependencies:
|
|
35
35
|
version: 0.7.22
|
36
36
|
type: :runtime
|
37
37
|
version_requirements: *id001
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: rspec
|
40
|
+
prerelease: false
|
41
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
hash: 1052247034
|
47
|
+
segments:
|
48
|
+
- 2
|
49
|
+
- 0
|
50
|
+
- 0
|
51
|
+
- beta
|
52
|
+
- 12
|
53
|
+
version: 2.0.0.beta.12
|
54
|
+
type: :development
|
55
|
+
version_requirements: *id002
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: watchr
|
58
|
+
prerelease: false
|
59
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
60
|
+
none: false
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
hash: 3
|
65
|
+
segments:
|
66
|
+
- 0
|
67
|
+
version: "0"
|
68
|
+
type: :development
|
69
|
+
version_requirements: *id003
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: rcov
|
72
|
+
prerelease: false
|
73
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
hash: 3
|
79
|
+
segments:
|
80
|
+
- 0
|
81
|
+
version: "0"
|
82
|
+
type: :development
|
83
|
+
version_requirements: *id004
|
38
84
|
description: OpenGL accelerated 2D game framework for Ruby. Builds on Gosu (Ruby/C++) which provides all the core functionality. Chingu adds simple yet powerful game states, prettier input handling, deployment safe asset-handling, a basic re-usable game object and stackable game logic.
|
39
85
|
email: ippa@rubylicio.us
|
40
86
|
executables: []
|
@@ -46,6 +92,7 @@ extra_rdoc_files:
|
|
46
92
|
- README.rdoc
|
47
93
|
files:
|
48
94
|
- .gitignore
|
95
|
+
- .rspec
|
49
96
|
- History.txt
|
50
97
|
- LICENSE
|
51
98
|
- README.rdoc
|
@@ -173,6 +220,13 @@ files:
|
|
173
220
|
- lib/chingu/traits/viewport.rb
|
174
221
|
- lib/chingu/viewport.rb
|
175
222
|
- lib/chingu/window.rb
|
223
|
+
- spec/chingu/fpscounter_spec.rb
|
224
|
+
- spec/chingu/game_object_spec.rb
|
225
|
+
- spec/chingu/inflector_spec.rb
|
226
|
+
- spec/chingu/rect_20x20.png
|
227
|
+
- spec/chingu/text_spec.rb
|
228
|
+
- spec/spec_helper.rb
|
229
|
+
- specs.watchr
|
176
230
|
has_rdoc: true
|
177
231
|
homepage: http://github.com/ippa/chingu
|
178
232
|
licenses: []
|
@@ -208,6 +262,11 @@ signing_key:
|
|
208
262
|
specification_version: 3
|
209
263
|
summary: OpenGL accelerated 2D game framework for Ruby
|
210
264
|
test_files:
|
265
|
+
- spec/chingu/fpscounter_spec.rb
|
266
|
+
- spec/chingu/game_object_spec.rb
|
267
|
+
- spec/chingu/inflector_spec.rb
|
268
|
+
- spec/chingu/text_spec.rb
|
269
|
+
- spec/spec_helper.rb
|
211
270
|
- examples/example10_traits_retrofy.rb
|
212
271
|
- examples/example11_animation.rb
|
213
272
|
- examples/example12_trait_timer.rb
|