diff --git a/Gemfile.lock b/Gemfile.lock index b72daa2..a6d60df 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -9,21 +9,54 @@ GIT GEM remote: https://rubygems.org/ specs: + async (1.25.2) + console (~> 1.0) + nio4r (~> 2.3) + timers (~> 4.1) + async-http (0.52.0) + async (~> 1.25) + async-io (~> 1.28) + async-pool (~> 0.2) + protocol-http (~> 0.18.0) + protocol-http1 (~> 0.12.0) + protocol-http2 (~> 0.14.0) + async-io (1.29.0) + async (~> 1.14) + async-pool (0.3.0) + async (~> 1.25) + async-websocket (0.14.0) + async-http (~> 0.51) + async-io (~> 1.23) + protocol-websocket (~> 0.7.0) + console (1.8.2) gosu (0.15.1) gosu (0.15.1-x64-mingw32) gosu_more_drawables (0.3.0) mini_portile2 (2.5.0) + nio4r (2.5.2) nokogiri (1.11.0.rc2) mini_portile2 (~> 2.5.0) nokogiri (1.11.0.rc2-x64-mingw32) ocra (1.3.11) opengl-bindings (1.6.10) + protocol-hpack (1.4.2) + protocol-http (0.18.0) + protocol-http1 (0.12.0) + protocol-http (~> 0.18) + protocol-http2 (0.14.0) + protocol-hpack (~> 1.4) + protocol-http (~> 0.18) + protocol-websocket (0.7.4) + protocol-http (~> 0.2) + protocol-http1 (~> 0.2) + timers (4.3.0) PLATFORMS ruby x64-mingw32 DEPENDENCIES + async-websocket cyberarm_engine! nokogiri (>= 1.11.0.rc1) ocra diff --git a/i-mic-fps.rb b/i-mic-fps.rb index edea256..99c1510 100644 --- a/i-mic-fps.rb +++ b/i-mic-fps.rb @@ -59,6 +59,8 @@ require_relative "lib/ui/menus/extras_menu" require_relative "lib/ui/menus/level_select_menu" require_relative "lib/ui/menus/game_pause_menu" +require_relative "lib/states/game_states/boot" +# require_relative "lib/states/game_states/close" require_relative "lib/states/game_states/game" require_relative "lib/states/game_states/loading_state" diff --git a/lib/common_methods.rb b/lib/common_methods.rb index 397be67..6e9366a 100644 --- a/lib/common_methods.rb +++ b/lib/common_methods.rb @@ -42,6 +42,46 @@ class IMICFPS def fill(color = Gosu::Color::WHITE) draw_rect(0, 0, window.width, window.height, color) end + def fill_quad(x1, y1, x2, y2, x3, y3, x4, y4, color = Gosu::Color::WHITE, z = 0, mode = :default) + draw_quad( + x1,y1, color, + x2,y2, color, + x3,y3, color, + x4,y4, color, + z, mode + ) + end + + def menu_background(color, color_step, transparency, bar_size, slope) + ((Gosu.screen_height + slope) / bar_size).times do |i| + fill_quad( + 0, i * bar_size, + 0, slope + (i * bar_size), + window.width / 2, (-slope) + (i * bar_size), + window.width / 2, i * bar_size, + Gosu::Color.rgba( + color.red - i * color_step, + color.green - i * color_step, + color.blue - i * color_step, + transparency + ), + -2 + ) + fill_quad( + window.width, i * bar_size, + window.width, slope + (i * bar_size), + window.width / 2, (-slope) + (i * bar_size), + window.width / 2, i * bar_size, + Gosu::Color.rgba( + color.red - i * color_step, + color.green - i * color_step, + color.blue - i * color_step, + transparency + ), + -2 + ) + end + end def gl_error? e = glGetError() diff --git a/lib/states/game_states/boot.rb b/lib/states/game_states/boot.rb new file mode 100644 index 0000000..5248704 --- /dev/null +++ b/lib/states/game_states/boot.rb @@ -0,0 +1,59 @@ +class IMICFPS + class Boot < GameState + require_relative "../../../../gosu_more_drawables/lib/gosu_more_drawables/draw_circle" + + def setup + @primary_color = Gosu::Color.rgba(255, 127, 0, 200) + @accent_color = Gosu::Color.rgba(155, 27, 0, 200) + + @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") + + @start_time = Gosu.milliseconds + @time_to_live = 3_000 + end + + def draw + menu_background(@primary_color, 10, 200, 50, 250) + + fraction_left = ((Gosu.milliseconds - @start_time) / (@time_to_live - 250).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 + ) + + if fraction_left <= 1.15 + Gosu.draw_circle( + window.width / 2, + window.height / 2, + @logo.width / 2, 128, Gosu::Color.new(0x11ffffff) + ) + + Gosu.draw_arc( + window.width / 2, + window.height / 2, + @logo.width / 2, fraction_left.clamp(0.0, 1.0), 128, 8, Gosu::Color.new(0x33ff8800) + ) + + @logo.draw(window.width / 2 - @logo.width / 2, window.height / 2 - @logo.height / 2, 0) + + @title.draw + + end + end + + def update + @title.x = window.width / 2 - @title.width / 2 + @title.y = 0 + + push_state(MainMenu) if Gosu.milliseconds - @start_time >= @time_to_live + end + + def button_up(id) + push_state(MainMenu) + end + end +end \ No newline at end of file diff --git a/lib/ui/menu.rb b/lib/ui/menu.rb index 12bca4d..add5879 100644 --- a/lib/ui/menu.rb +++ b/lib/ui/menu.rb @@ -31,7 +31,7 @@ class IMICFPS end def draw - draw_background + menu_background(@base_color, @color_step, @background_alpha, @size, @slope) draw_menu_box draw_menu @@ -46,27 +46,6 @@ class IMICFPS end end - def draw_background - ((Gosu.screen_height+@slope)/@size).times do |i| - fill_quad( - 0, i*@size, - 0, @slope+(i*@size), - window.width/2, (-@slope)+(i*@size), - window.width/2, i*@size, - Gosu::Color.rgba(@base_color.red-i*@color_step, @base_color.green-i*@color_step, @base_color.blue-i*@color_step, @background_alpha), - -2 - ) - fill_quad( - window.width, i*@size, - window.width, @slope+(i*@size), - window.width/2, (-@slope)+(i*@size), - window.width/2, i*@size, - Gosu::Color.rgba(@base_color.red-i*@color_step, @base_color.green-i*@color_step, @base_color.blue-i*@color_step, @background_alpha), - -2 - ) - end - end - def draw_menu_box draw_rect( window.width/4, 0, @@ -95,16 +74,6 @@ class IMICFPS @__version_text.y = window.height - (@__version_text.height + 10) end - def fill_quad(x1, y1, x2, y2, x3, y3, x4, y4, color = Gosu::Color::WHITE, z = 0, mode = :default) - draw_quad( - x1,y1, color, - x2,y2, color, - x3,y3, color, - x4,y4, color, - z, mode - ) - end - def button_up(id) if id == Gosu::MsLeft @elements.each do |e| diff --git a/lib/window.rb b/lib/window.rb index fa91cdc..30ddce7 100644 --- a/lib/window.rb +++ b/lib/window.rb @@ -34,7 +34,7 @@ class IMICFPS @config.save! end - push_state(MainMenu) + push_state(Boot) @delta_time = Gosu.milliseconds end diff --git a/static/logo.png b/static/logo.png new file mode 100644 index 0000000..3dd64df Binary files /dev/null and b/static/logo.png differ diff --git a/svg/logo.svg b/svg/logo.svg new file mode 100644 index 0000000..d7a8885 --- /dev/null +++ b/svg/logo.svg @@ -0,0 +1,128 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + I-MIC FPS + +