cyberarm_engine 0.1.0 → 0.2.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.
- checksums.yaml +4 -4
- data/lib/cyberarm_engine/engine.rb +2 -0
- data/lib/cyberarm_engine/game_object.rb +3 -3
- data/lib/cyberarm_engine/game_state.rb +1 -0
- data/lib/cyberarm_engine/objects/text.rb +9 -1
- data/lib/cyberarm_engine/version.rb +1 -1
- data/lib/cyberarm_engine.rb +0 -1
- metadata +2 -3
- data/lib/cyberarm_engine/objects/multi_line_text.rb +0 -67
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28f56ac3d950bdf607b6218c44aa0e680e1cdadb004116c8da15592955a948a2
|
4
|
+
data.tar.gz: b5f7e956196727056a6c32e67f37c09f56b5175c8ab85387e90eefdcc379a76d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31ae41df145e56a7ef1b8587848bc67535cca23255efc73e971f71d41528776de99897324d955e2402f66bb5f7167df580e8434140cbd16827cf822433defe29
|
7
|
+
data.tar.gz: 866cbdd36ed876356270bec679f08de4345ab340bc754a5bed7e4d00816a2ca27086434c7276f6dcb0226299da80a5964568629ee6aa3d0b14011c1ddf83876b
|
@@ -36,7 +36,7 @@ module CyberarmEngine
|
|
36
36
|
|
37
37
|
setup
|
38
38
|
|
39
|
-
@debug_text =
|
39
|
+
@debug_text = Text.new("", color: @debug_color, y: @position.y-(self.height*self.scale), z: 9999)
|
40
40
|
@debug_text.x = @position.x
|
41
41
|
if @radius == 0 || @radius == nil
|
42
42
|
@radius = options[:radius] ? options[:radius] : defined?(@image.width) ? ((@image.width+@image.height)/4)*scale : 1
|
@@ -121,11 +121,11 @@ module CyberarmEngine
|
|
121
121
|
end
|
122
122
|
|
123
123
|
def width
|
124
|
-
@image ? @image.width : 0
|
124
|
+
@image ? @image.width * self.scale : 0
|
125
125
|
end
|
126
126
|
|
127
127
|
def height
|
128
|
-
@image ? @image.height : 0
|
128
|
+
@image ? @image.height * self.scale : 0
|
129
129
|
end
|
130
130
|
|
131
131
|
def pause
|
@@ -67,7 +67,7 @@ module CyberarmEngine
|
|
67
67
|
end
|
68
68
|
|
69
69
|
def height
|
70
|
-
textobject.height
|
70
|
+
@text.lines.count * textobject.height
|
71
71
|
end
|
72
72
|
|
73
73
|
def draw
|
@@ -91,6 +91,14 @@ module CyberarmEngine
|
|
91
91
|
@textobject.draw_markup(@text, @x, @y, @z, @factor_x, @factor_y, @color)
|
92
92
|
end
|
93
93
|
|
94
|
+
def alpha=(n)
|
95
|
+
@color = Gosu::Color.new(@color.red, @color.green, @color.blue, n)
|
96
|
+
end
|
97
|
+
|
98
|
+
def alpha
|
99
|
+
@color.alpha
|
100
|
+
end
|
101
|
+
|
94
102
|
def update; end
|
95
103
|
end
|
96
104
|
end
|
data/lib/cyberarm_engine.rb
CHANGED
@@ -13,7 +13,6 @@ require_relative "cyberarm_engine/background"
|
|
13
13
|
|
14
14
|
require_relative "cyberarm_engine/objects/text"
|
15
15
|
require_relative "cyberarm_engine/objects/timer"
|
16
|
-
require_relative "cyberarm_engine/objects/multi_line_text"
|
17
16
|
|
18
17
|
require_relative "cyberarm_engine/ui/theme"
|
19
18
|
require_relative "cyberarm_engine/ui/event"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cyberarm_engine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cyberarm
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-03-
|
11
|
+
date: 2019-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gosu
|
@@ -90,7 +90,6 @@ files:
|
|
90
90
|
- lib/cyberarm_engine/game_state.rb
|
91
91
|
- lib/cyberarm_engine/lib/bounding_box.rb
|
92
92
|
- lib/cyberarm_engine/lib/vector.rb
|
93
|
-
- lib/cyberarm_engine/objects/multi_line_text.rb
|
94
93
|
- lib/cyberarm_engine/objects/text.rb
|
95
94
|
- lib/cyberarm_engine/objects/timer.rb
|
96
95
|
- lib/cyberarm_engine/ui/border_canvas.rb
|
@@ -1,67 +0,0 @@
|
|
1
|
-
module CyberarmEngine
|
2
|
-
class MultiLineText
|
3
|
-
attr_accessor :options, :x, :y, :width, :height
|
4
|
-
|
5
|
-
def initialize(text, options={})
|
6
|
-
@texts = []
|
7
|
-
text.split("\n").each_with_index do |line, i|
|
8
|
-
_options = options
|
9
|
-
_options[:y]+=_options[:size]
|
10
|
-
@texts << Text.new(line, _options)
|
11
|
-
end
|
12
|
-
@options = options
|
13
|
-
@x = @texts.first ? @texts.first.x : 0
|
14
|
-
@y = @texts.first ? @texts.first.y : 0
|
15
|
-
@width = 0
|
16
|
-
@height = 0
|
17
|
-
calculate_boundry
|
18
|
-
end
|
19
|
-
|
20
|
-
def draw
|
21
|
-
@texts.each(&:draw)
|
22
|
-
end
|
23
|
-
|
24
|
-
def text
|
25
|
-
string = ""
|
26
|
-
@texts.each {|t| string << t.text}
|
27
|
-
return string
|
28
|
-
end
|
29
|
-
|
30
|
-
def text=(text)
|
31
|
-
|
32
|
-
if text.lines.count < @texts.count
|
33
|
-
range = ((@texts.count - @text.lines.count)-1)..@texts.count-1
|
34
|
-
p range
|
35
|
-
@texts.slice!(range)
|
36
|
-
end
|
37
|
-
|
38
|
-
text.split("\n").each_with_index do |line, i|
|
39
|
-
if @texts[i]
|
40
|
-
@texts[i].text = line
|
41
|
-
else
|
42
|
-
@texts << Text.new(line, @options)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
self.y = @y
|
47
|
-
calculate_boundry
|
48
|
-
end
|
49
|
-
|
50
|
-
def x=(int)
|
51
|
-
@x = int
|
52
|
-
@texts.each {|t| t.x = int}
|
53
|
-
end
|
54
|
-
|
55
|
-
def y=(int)
|
56
|
-
@y = int
|
57
|
-
@texts.each_with_index {|t, i| t.y=int+(i*t.size)}
|
58
|
-
end
|
59
|
-
|
60
|
-
def calculate_boundry
|
61
|
-
@width = 0
|
62
|
-
@height= 0
|
63
|
-
@texts.each {|t| @width = t.width if t.width > @width}
|
64
|
-
@texts.each {|t| @height+=t.height}
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|