cyberarm_engine 0.3.0 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1a107f38b291492d95d048693aec005c4dcf3dc73f601ea300ac952ede787bf2
4
- data.tar.gz: 1b5a80bb6ba87d35ca5231be6b559020c404e34a48e2c7bda5770f3f83faad72
3
+ metadata.gz: b8e3c0d7b4d22d0ed567dd1a1a710d5623e7d9f6e358a00d637f4965a37fbc68
4
+ data.tar.gz: db5e38d2bec4a4b6b8f1d5686b3bf5ab655bf07fb96939e04a833f42757404fd
5
5
  SHA512:
6
- metadata.gz: 6f7f836d5b1471a9251735593c5a61e44bcbabe126ff1ef4c92a28b626a8395bfcc8201a6428587b981c30a212485e3d715a4658d28b5697ed84af5ce694e460
7
- data.tar.gz: a75b1b1260d4e5d4a3ad762d29a39c8bb412d0c786c7368ad331f96400aa9970992573d22746b96fc3f7c177443850f0b4a9f5429295da6ed80c38d64b52e08e
6
+ metadata.gz: 4db0dfbe6039d8a96b92c8503e3bfa31138507769790071439f4400a08faf3edcdbdb8f99d4bbc30e8cf13235d0435ab86162a12115b02413b73b39e33a3a40a
7
+ data.tar.gz: 135412df0ee1186b953020a4e55c5ff8324250aaced8182283ed8799d28ba073da1119fc241694618a9bd23ab1125ae52ea88698d89ecca14b9d0cbe2619c557
@@ -48,6 +48,12 @@ module CyberarmEngine
48
48
  end
49
49
  end
50
50
 
51
+ def opacity(color, ratio = 1.0)
52
+ alpha = 255 * ratio
53
+
54
+ return Gosu::Color.rgba(color.red, color.green, color.blue, alpha)
55
+ end
56
+
51
57
  def get_asset(path, hash, klass)
52
58
  asset = nil
53
59
  hash.detect do |_asset, instance|
@@ -2,9 +2,23 @@ module CyberarmEngine
2
2
  class BoundingBox
3
3
  attr_accessor :min, :max
4
4
 
5
- def initialize(minx = 0, miny = 0, minz = 0, maxx = 0, maxy = 0, maxz = 0)
6
- @min = Vector.new(minx, miny, minz)
7
- @max = Vector.new(maxx, maxy, maxz)
5
+ def initialize(*args)
6
+ case args.size
7
+ when 0
8
+ @min = Vector.new(0, 0, 0)
9
+ @max = Vector.new(0, 0, 0)
10
+ when 2
11
+ @min = args.first.clone
12
+ @max = args.last.clone
13
+ when 4
14
+ @min = Vector.new(args[0], args[1], 0)
15
+ @max = Vector.new(args[2], args[3], 0)
16
+ when 6
17
+ @min = Vector.new(args[0], args[1], args[2])
18
+ @max = Vector.new(args[3], args[4], args[5])
19
+ else
20
+ raise "Invalid number of arguments! Got: #{args.size}, expected: 0, 2, 4, or 6."
21
+ end
8
22
  end
9
23
 
10
24
  def ==(other)
@@ -31,7 +31,7 @@ module CyberarmEngine
31
31
  end
32
32
 
33
33
  # Performs math operation, excluding @weight
34
- def operator(function, other)
34
+ private def operator(function, other)
35
35
  if other.is_a?(Numeric)
36
36
  Vector.new(
37
37
  @x.send(:"#{function}", other),
@@ -1,4 +1,4 @@
1
1
  module CyberarmEngine
2
2
  NAME = "InDev"
3
- VERSION = "0.3.0"
3
+ VERSION = "0.4.0"
4
4
  end
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.3.0
4
+ version: 0.4.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-04-30 00:00:00.000000000 Z
11
+ date: 2019-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gosu