mirror of
https://github.com/cyberarm/i-mic-fps.git
synced 2025-12-15 15:42:35 +00:00
Updated menus, added background to Tools
This commit is contained in:
@@ -1,12 +1,21 @@
|
||||
class IMICFPS
|
||||
class Menu < IMICFPS::GameState
|
||||
PRIMARY_COLOR = Gosu::Color.rgba(255, 127, 0, 200)
|
||||
ACCENT_COLOR = Gosu::Color.rgba(155, 27, 0, 200)
|
||||
|
||||
BAR_SIZE = 50
|
||||
BAR_SLOPE = 250
|
||||
BAR_COLOR_STEP = 10
|
||||
BAR_ALPHA = 200
|
||||
|
||||
def initialize(*args)
|
||||
@elements = []
|
||||
@size = 50
|
||||
@slope = 250
|
||||
@color_step = 10
|
||||
@base_color = Gosu::Color.rgb(255, 127, 0)
|
||||
@background_alpha = 200
|
||||
@bar_size = BAR_SIZE
|
||||
@bar_slope = BAR_SLOPE
|
||||
@bar_color_step = BAR_COLOR_STEP
|
||||
@bar_alpha = BAR_ALPHA
|
||||
@primary_color = PRIMARY_COLOR
|
||||
@accent_color = ACCENT_COLOR
|
||||
window.needs_cursor = true
|
||||
|
||||
@__version_text = CyberarmEngine::Text.new("<b>#{IMICFPS::NAME}</b> v#{IMICFPS::VERSION} (#{IMICFPS::RELEASE_NAME})")
|
||||
@@ -15,7 +24,7 @@ class IMICFPS
|
||||
super(*args)
|
||||
end
|
||||
|
||||
def title(text, color = @base_color)
|
||||
def title(text, color = Gosu::Color::BLACK)
|
||||
@elements << Text.new(text, color: color, size: 100, x: 0, y: 15)
|
||||
@_title = @elements.last
|
||||
end
|
||||
@@ -31,7 +40,7 @@ class IMICFPS
|
||||
end
|
||||
|
||||
def draw
|
||||
menu_background(@base_color, @color_step, @background_alpha, @size, @slope)
|
||||
menu_background(@primary_color, @accent_color, @bar_color_step, @bar_alpha, @bar_size, @bar_slope)
|
||||
draw_menu_box
|
||||
draw_menu
|
||||
|
||||
@@ -50,7 +59,7 @@ class IMICFPS
|
||||
draw_rect(
|
||||
window.width/4, 0,
|
||||
window.width/2, window.height,
|
||||
Gosu::Color.rgba(0, 0, 0, 150),
|
||||
Gosu::Color.new(0x22222222),
|
||||
)
|
||||
end
|
||||
|
||||
@@ -62,7 +71,7 @@ class IMICFPS
|
||||
|
||||
def update
|
||||
@elements.each do |e|
|
||||
e.x = window.width / 2 - e.width / 2
|
||||
e.x = (window.width / 2 - e.width / 2).round
|
||||
e.update
|
||||
end
|
||||
|
||||
@@ -95,19 +104,17 @@ class IMICFPS
|
||||
def initialize(text, host, block)
|
||||
@text, @host, @block = text, host, block
|
||||
@color = @text.color
|
||||
@hover_color = Gosu::Color.rgb(64, 127, 255)
|
||||
@hover_color = Gosu::Color.rgb(64, 128, 255)
|
||||
@text.shadow_color= Gosu::Color::BLACK
|
||||
@text.shadow_size = 2
|
||||
@text.shadow_alpha = 100
|
||||
end
|
||||
|
||||
def update
|
||||
if @host.mouse_over?(self)
|
||||
@text.color = @hover_color
|
||||
@text.shadow_color= Gosu::Color::BLACK
|
||||
@text.shadow_size = 3
|
||||
else
|
||||
@text.color = @color
|
||||
@text.shadow_color = nil
|
||||
@text.shadow_size = 1
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user