4 Commits

5 changed files with 19 additions and 8 deletions

View File

@@ -5,7 +5,7 @@ module CyberarmEngine
SONGS = {}
attr_accessor :show_cursor
attr_reader :current_state, :last_frame_time
attr_reader :last_frame_time
def self.now
Gosu.milliseconds

View File

@@ -3,7 +3,8 @@ module CyberarmEngine
include Common
attr_accessor :image, :angle, :position, :velocity, :center_x, :center_y, :scale_x, :scale_y,
:color, :alpha, :mode, :options, :paused, :radius, :last_position
:color, :mode, :options, :paused, :radius, :last_position
attr_reader :alpha
def initialize(options={})
if options[:auto_manage] || options[:auto_manage] == nil
$window.current_state.add_game_object(self)
@@ -141,7 +142,7 @@ module CyberarmEngine
self.angle%=360
end
def alpha=int # 0-255
def alpha=(int) # 0-255
@alpha = int
@alpha = 255 if @alpha > 255
@color = Gosu::Color.rgba(@color.red, @color.green, @color.blue, int)

View File

@@ -49,11 +49,17 @@ module CyberarmEngine
return temp
end
# returns whether both bounding boxes intersect
# returns whether bounding box intersects other
def intersect?(other)
(@min.x <= other.max.x && @max.x >= other.min.x) &&
(@min.y <= other.max.y && @max.y >= other.min.y) &&
(@min.z <= other.max.z && @max.z >= other.min.z)
if other.is_a?(Ray)
other.intersect?(self)
elsif other.is_a?(BoundingBox)
(@min.x <= other.max.x && @max.x >= other.min.x) &&
(@min.y <= other.max.y && @max.y >= other.min.y) &&
(@min.z <= other.max.z && @max.z >= other.min.z)
else
raise "Unknown collider: #{other.class}"
end
end
# does this bounding box envelop other bounding box? (inclusive of border)

View File

@@ -21,6 +21,10 @@ module CyberarmEngine
@@shaders.dig(name).is_a?(Shader)
end
def self.get(name)
@@shaders.dig(name)
end
def self.active_shader
@active_shader
end

View File

@@ -1,4 +1,4 @@
module CyberarmEngine
NAME = "InDev"
VERSION = "0.10.1"
VERSION = "0.10.2"
end