mirror of
https://github.com/cyberarm/cyberarm_engine.git
synced 2025-12-16 05:02:34 +00:00
Misc bug fixes and improvements
This commit is contained in:
@@ -50,7 +50,8 @@ module CyberarmEngine
|
|||||||
@objects.each { |o| @vertex_count += o.vertices.size }
|
@objects.each { |o| @vertex_count += o.vertices.size }
|
||||||
|
|
||||||
start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC, :float_millisecond)
|
start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC, :float_millisecond)
|
||||||
# build_collision_tree
|
build_collision_tree
|
||||||
|
puts " Building mesh collision tree took #{((Process.clock_gettime(Process::CLOCK_MONOTONIC, :float_millisecond) - start_time) / 1000.0).round(2)} seconds"
|
||||||
end
|
end
|
||||||
|
|
||||||
def parse(parser)
|
def parse(parser)
|
||||||
@@ -177,7 +178,7 @@ module CyberarmEngine
|
|||||||
end
|
end
|
||||||
|
|
||||||
def build_collision_tree
|
def build_collision_tree
|
||||||
@aabb_tree = AABBTree.new
|
@aabb_tree = IMICFPS::AABBTree.new
|
||||||
|
|
||||||
@faces.each do |face|
|
@faces.each do |face|
|
||||||
box = BoundingBox.new
|
box = BoundingBox.new
|
||||||
|
|||||||
@@ -63,7 +63,8 @@ module CyberarmEngine
|
|||||||
def start_timing(key)
|
def start_timing(key)
|
||||||
raise "key must be a symbol!" unless key.is_a?(Symbol)
|
raise "key must be a symbol!" unless key.is_a?(Symbol)
|
||||||
if @timings[key]
|
if @timings[key]
|
||||||
warn "Only one timing per key per frame. (Timing for #{key.inspect} already exists!)"
|
# FIXME: Make it not spammy...
|
||||||
|
# warn "Only one timing per key per frame. (Timing for #{key.inspect} already exists!)"
|
||||||
@attempted_multitiming = true
|
@attempted_multitiming = true
|
||||||
@multitimings[key] = true
|
@multitimings[key] = true
|
||||||
|
|
||||||
@@ -76,7 +77,8 @@ module CyberarmEngine
|
|||||||
def end_timing(key)
|
def end_timing(key)
|
||||||
timing = @timings[key]
|
timing = @timings[key]
|
||||||
|
|
||||||
warn "Timing #{key.inspect} already ended!" if timing.end_time != -1
|
# FIXME: Make it not spammy...
|
||||||
|
# warn "Timing #{key.inspect} already ended!" if timing.end_time != -1
|
||||||
|
|
||||||
timing.end_time = Gosu.milliseconds
|
timing.end_time = Gosu.milliseconds
|
||||||
timing.duration = timing.end_time - timing.start_time
|
timing.duration = timing.end_time - timing.start_time
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ module CyberarmEngine
|
|||||||
@size = size
|
@size = size
|
||||||
@font = font_name
|
@font = font_name
|
||||||
|
|
||||||
|
invalidate_cache!
|
||||||
@textobject = check_cache(size, font_name)
|
@textobject = check_cache(size, font_name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -462,15 +462,13 @@ module CyberarmEngine
|
|||||||
if @parent && @style.fill &&
|
if @parent && @style.fill &&
|
||||||
(dimension == :width && @parent.is_a?(Flow) ||
|
(dimension == :width && @parent.is_a?(Flow) ||
|
||||||
dimension == :height && @parent.is_a?(Stack))
|
dimension == :height && @parent.is_a?(Stack))
|
||||||
return space_available_width - noncontent_width if dimension == :width && @parent.is_a?(Flow)
|
new_size = space_available_width - noncontent_width if dimension == :width && @parent.is_a?(Flow)
|
||||||
return space_available_height - noncontent_height if dimension == :height && @parent.is_a?(Stack)
|
new_size = space_available_height - noncontent_height if dimension == :height && @parent.is_a?(Stack)
|
||||||
|
|
||||||
# Handle min_width/height and max_width/height
|
|
||||||
else
|
|
||||||
return @style.send(:"min_#{dimension}") if @style.send(:"min_#{dimension}") && new_size.to_f < @style.send(:"min_#{dimension}")
|
|
||||||
return @style.send(:"max_#{dimension}") if @style.send(:"max_#{dimension}") && new_size.to_f > @style.send(:"max_#{dimension}")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return @style.send(:"min_#{dimension}") if @style.send(:"min_#{dimension}") && new_size.to_f < @style.send(:"min_#{dimension}")
|
||||||
|
return @style.send(:"max_#{dimension}") if @style.send(:"max_#{dimension}") && new_size.to_f > @style.send(:"max_#{dimension}")
|
||||||
|
|
||||||
new_size
|
new_size
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -186,6 +186,9 @@ module CyberarmEngine
|
|||||||
|
|
||||||
update_background
|
update_background
|
||||||
|
|
||||||
|
# Fixes resized container scrolled past bottom
|
||||||
|
self.scroll_top = -@scroll_position.y
|
||||||
|
|
||||||
root.gui_state.request_repaint if @width != old_width || @height != old_height
|
root.gui_state.request_repaint if @width != old_width || @height != old_height
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,8 @@ module CyberarmEngine
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
attr_reader :range, :step_size, :value
|
attr_reader :step_size, :value
|
||||||
|
attr_accessor :range, :step_size
|
||||||
|
|
||||||
def initialize(options = {}, block = nil)
|
def initialize(options = {}, block = nil)
|
||||||
super(options, block)
|
super(options, block)
|
||||||
|
|||||||
@@ -18,6 +18,15 @@ module CyberarmEngine
|
|||||||
@raw_text = text
|
@raw_text = text
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
super
|
||||||
|
|
||||||
|
if @text.textobject.name != safe_style_fetch(:font)
|
||||||
|
set_font
|
||||||
|
root.gui_state.request_recalculate
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def render
|
def render
|
||||||
# Gosu.clip_to is too expensive to always use so check if we actually need it.
|
# Gosu.clip_to is too expensive to always use so check if we actually need it.
|
||||||
if @text.width > width || @text.height > height
|
if @text.width > width || @text.height > height
|
||||||
|
|||||||
@@ -158,6 +158,8 @@ module CyberarmEngine
|
|||||||
end
|
end
|
||||||
|
|
||||||
private def child_of?(input, klass)
|
private def child_of?(input, klass)
|
||||||
|
return false unless input
|
||||||
|
|
||||||
input.ancestors.detect { |c| c == klass }
|
input.ancestors.detect { |c| c == klass }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user