ehb_game_lib 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/ehb_game_lib.rb +2 -0
- data/lib/ehb_game_lib/gfx.rb +2 -0
- data/lib/ehb_game_lib/globals.rb +2 -0
- data/lib/ehb_game_lib/math/circle.rb +2 -0
- data/lib/ehb_game_lib/math/intersection/circle_line.rb +2 -0
- data/lib/ehb_game_lib/math/intersection/circle_line_segment.rb +2 -0
- data/lib/ehb_game_lib/math/line.rb +2 -0
- data/lib/ehb_game_lib/math/line_segment.rb +2 -0
- data/lib/ehb_game_lib/math/quadratic_equation.rb +4 -1
- data/lib/ehb_game_lib/math/rectable_object.rb +2 -0
- data/lib/ehb_game_lib/math/vector.rb +2 -0
- data/lib/ehb_game_lib/nes/all_colors_palette.rb +2 -0
- data/lib/ehb_game_lib/nes/color.rb +2 -0
- data/lib/ehb_game_lib/nes/palette.rb +2 -0
- data/lib/ehb_game_lib/patches/chingu/basic_game_object.rb +2 -0
- data/lib/ehb_game_lib/patches/gosu/font.rb +2 -0
- data/lib/ehb_game_lib/traits/bounding_line_segment.rb +4 -0
- data/lib/ehb_game_lib/utils/cursor.rb +3 -1
- data/lib/ehb_game_lib/version.rb +3 -1
- data/test/lib/ehb_game_lib/math/circle_test.rb +2 -0
- data/test/lib/ehb_game_lib/math/intersection/circle_line_segment_test.rb +2 -0
- data/test/lib/ehb_game_lib/math/intersection/circle_line_test.rb +2 -0
- data/test/lib/ehb_game_lib/math/line_segment_test.rb +2 -0
- data/test/lib/ehb_game_lib/math/line_test.rb +2 -0
- data/test/lib/ehb_game_lib/math/quadratic_equation_test.rb +2 -0
- data/test/lib/ehb_game_lib/math/rectable_object_test.rb +2 -0
- data/test/test_helper.rb +2 -0
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d643f13e6d8b07eaa4619f06e90dc4560ad05cecb7fa87bda94d1ddb929ac608
|
4
|
+
data.tar.gz: fecab868437c73851309abed83e4baa9090c6b8e460c9e96e9e3722af0c690aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2860f3c38dbce468873ea6c2802c4175c69af94f245c5a3c151ca52863e7f5320cb5c1bed61a94c5a0a7a6d5dc8031e3ba034a1a2fe6c50b8f7bfe86aecdb52e
|
7
|
+
data.tar.gz: 03e53f34ec987f63960fc5e046d364603df4c3ccaec23482ac1e5aaebaa9db3e4c09214c44a9e96262a10a06fdf982a2b7bf5d6fd9a9953f644c8c44390bc4ae
|
data/lib/ehb_game_lib.rb
CHANGED
data/lib/ehb_game_lib/gfx.rb
CHANGED
data/lib/ehb_game_lib/globals.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module EhbGameLib
|
2
4
|
module Math
|
3
5
|
class QuadraticEquation
|
@@ -12,6 +14,7 @@ module EhbGameLib
|
|
12
14
|
def roots
|
13
15
|
return [root(1), root(-1)] if delta > 0.0
|
14
16
|
return [root(1)] if delta == 0.0
|
17
|
+
|
15
18
|
[]
|
16
19
|
end
|
17
20
|
|
@@ -20,7 +23,7 @@ module EhbGameLib
|
|
20
23
|
end
|
21
24
|
|
22
25
|
def root(signal)
|
23
|
-
signal = signal
|
26
|
+
signal = signal.negative? ? -1 : 1
|
24
27
|
(-b + signal * ::Math.sqrt(delta)) / (2 * a)
|
25
28
|
end
|
26
29
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module EhbGameLib
|
2
4
|
module Traits
|
3
5
|
# Interface required:
|
@@ -5,10 +7,12 @@ module EhbGameLib
|
|
5
7
|
module BoundingLineSegment
|
6
8
|
def nearest_circle_collision(klasses)
|
7
9
|
return [nil, nil] unless line_segment?
|
10
|
+
|
8
11
|
min_obj = min_p = min_dist = nil
|
9
12
|
each_circle_collision(klasses) do |object, p|
|
10
13
|
dist = Gosu.distance(last_x, last_y, p.x, p.y)
|
11
14
|
next unless min_dist.nil? || dist < min_dist
|
15
|
+
|
12
16
|
min_dist = dist
|
13
17
|
min_obj = object
|
14
18
|
min_p = p
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module EhbGameLib
|
2
4
|
module Utils
|
3
5
|
class Cursor
|
@@ -38,7 +40,7 @@ module EhbGameLib
|
|
38
40
|
@index = 0
|
39
41
|
elsif @index >= @set.count
|
40
42
|
@index = @set.count - 1
|
41
|
-
elsif @index
|
43
|
+
elsif @index.negative?
|
42
44
|
@index = 0
|
43
45
|
end
|
44
46
|
end
|
data/lib/ehb_game_lib/version.rb
CHANGED
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ehb_game_lib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eduardo H. Bogoni
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -70,16 +70,16 @@ dependencies:
|
|
70
70
|
name: rubocop
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
75
|
+
version: 0.79.0
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.
|
82
|
+
version: 0.79.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: test-unit
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -147,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
147
|
version: '0'
|
148
148
|
requirements: []
|
149
149
|
rubyforge_project:
|
150
|
-
rubygems_version: 2.
|
150
|
+
rubygems_version: 2.7.7
|
151
151
|
signing_key:
|
152
152
|
specification_version: 4
|
153
153
|
summary: EHB's game library for Ruby
|