From a3b4c6e651c7d2204d9583b5c25037ea0b3ab20d Mon Sep 17 00:00:00 2001 From: Cyberarm Date: Mon, 4 May 2020 11:32:17 -0500 Subject: [PATCH] Update Boot/Close to use Menu constants --- lib/states/game_states/boot.rb | 12 ++---------- lib/states/game_states/close.rb | 17 ++--------------- 2 files changed, 4 insertions(+), 25 deletions(-) diff --git a/lib/states/game_states/boot.rb b/lib/states/game_states/boot.rb index 728bcb1..50e3f07 100644 --- a/lib/states/game_states/boot.rb +++ b/lib/states/game_states/boot.rb @@ -1,14 +1,6 @@ class IMICFPS class Boot < GameState def setup - @primary_color = Gosu::Color.rgba(255, 127, 0, 200) - @accent_color = Gosu::Color.rgba(155, 27, 0, 200) - - @color_step = 10 - @transparency = 200 - @bar_size = 50 - @slope = 250 - @title = Text.new(IMICFPS::NAME, size: 100, z: 0, color: Gosu::Color.new(0xff000000), shadow: false, font: "Droid Serif") @logo = get_image(IMICFPS::GAME_ROOT_PATH + "/static/logo.png") @@ -19,10 +11,10 @@ class IMICFPS end def draw - menu_background(@primary_color, @accent_color, @color_step, @transparency, @bar_size, @slope) - fraction_left = ((Gosu.milliseconds - @start_time) / (@time_to_live - 200).to_f) + menu_background(Menu::PRIMARY_COLOR, Menu::ACCENT_COLOR, Menu::BAR_COLOR_STEP, Menu::BAR_ALPHA, Menu::BAR_SIZE, Menu::BAR_SLOPE) + if fraction_left <= 1.0 Gosu.draw_circle( window.width / 2, diff --git a/lib/states/game_states/close.rb b/lib/states/game_states/close.rb index 2cd1765..f755f00 100644 --- a/lib/states/game_states/close.rb +++ b/lib/states/game_states/close.rb @@ -1,13 +1,7 @@ class IMICFPS class Close < GameState def setup - @primary_color = Gosu::Color.rgba(255, 127, 0, 200) - @accent_color = Gosu::Color.rgba(155, 27, 0, 200) - - @color_step = 10 - @transparency = 200 - @bar_size = 50 - @slope = 250 + @slope = Menu::BAR_SLOPE @logo = get_image(IMICFPS::GAME_ROOT_PATH + "/static/logo.png") @@ -18,16 +12,9 @@ class IMICFPS end def draw - menu_background(@primary_color, @color_step, @transparency, @bar_size, @slope.round) - fraction_left = 1 - ((Gosu.milliseconds - @start_time) / (@time_to_live - 200).to_f) - Gosu.draw_quad( - 0, 0, @primary_color, - window.width, 0, @primary_color, - window.width, window.height, @accent_color, - 0, window.height, @accent_color - ) + menu_background(Menu::PRIMARY_COLOR, Menu::ACCENT_COLOR, Menu::BAR_COLOR_STEP, Menu::BAR_ALPHA, Menu::BAR_SIZE, @slope.round) Gosu.draw_circle( window.width / 2,