mirror of
https://github.com/cyberarm/cyberarm_engine.git
synced 2026-03-27 22:26:12 +00:00
Reduce usages of Gosu.clip_to in Background
This commit is contained in:
@@ -21,19 +21,27 @@ module CyberarmEngine
|
||||
end
|
||||
|
||||
def draw
|
||||
Gosu.clip_to(@x, @y, @width, @height) do
|
||||
Gosu.draw_quad(
|
||||
@top_left.x, @top_left.y, @paint.top_left,
|
||||
@top_right.x, @top_right.y, @paint.top_right,
|
||||
@bottom_right.x, @bottom_right.y, @paint.bottom_right,
|
||||
@bottom_left.x, @bottom_left.y, @paint.bottom_left,
|
||||
@z
|
||||
)
|
||||
if @angle.zero?
|
||||
render
|
||||
else
|
||||
Gosu.clip_to(@x, @y, @width, @height) do
|
||||
render
|
||||
end
|
||||
end
|
||||
|
||||
debug_outline if @debug
|
||||
end
|
||||
|
||||
def render
|
||||
Gosu.draw_quad(
|
||||
@top_left.x, @top_left.y, @paint.top_left,
|
||||
@top_right.x, @top_right.y, @paint.top_right,
|
||||
@bottom_right.x, @bottom_right.y, @paint.bottom_right,
|
||||
@bottom_left.x, @bottom_left.y, @paint.bottom_left,
|
||||
@z
|
||||
)
|
||||
end
|
||||
|
||||
def update
|
||||
@top_left.x = @x
|
||||
@top_left.y = @y
|
||||
@@ -146,13 +154,3 @@ module CyberarmEngine
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Add <=> method to support Range based gradients
|
||||
# NOTE: Disabled, causes stack overflow 🙃
|
||||
# module Gosu
|
||||
# class Color
|
||||
# def <=>(_other)
|
||||
# self
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
|
||||
Reference in New Issue
Block a user