From 0697cc6b53c8397b180b28f65f4f5acaa45244a5 Mon Sep 17 00:00:00 2001 From: Cyberarm Date: Fri, 1 Feb 2019 20:52:43 -0600 Subject: [PATCH] Sync --- i-mic-rts.rb | 5 +++- lib/states/boot.rb | 37 +++++++++++++--------------- lib/states/main_menu.rb | 53 ++++++++++++++++++++++++++++------------- 3 files changed, 57 insertions(+), 38 deletions(-) diff --git a/i-mic-rts.rb b/i-mic-rts.rb index f0cc01d..fc2343e 100644 --- a/i-mic-rts.rb +++ b/i-mic-rts.rb @@ -1,3 +1,5 @@ +require "base64" + begin require "cyberarm_engine" rescue LoadError @@ -14,4 +16,5 @@ class Window < CyberarmEngine::Engine end end -Window.new(Gosu.screen_width, Gosu.screen_height, true).show \ No newline at end of file +# Window.new(Gosu.screen_width, Gosu.screen_height, true).show +Window.new(Gosu.screen_width, Gosu.screen_height, false).show \ No newline at end of file diff --git a/lib/states/boot.rb b/lib/states/boot.rb index 23c0699..3077824 100644 --- a/lib/states/boot.rb +++ b/lib/states/boot.rb @@ -12,11 +12,23 @@ class Boot < CyberarmEngine::GameState @last_update = Gosu.milliseconds @update_interval = 250 + @switcher = CyberarmEngine::Timer.new(5_000) do + push_state(MainMenu) + end + + @loader = CyberarmEngine::Timer.new(250) do + split = @status.scan(".") + if split.size >= 3 + @messages_index+=1 + @messages_index = 0 unless @messages_index < @messages.size + @status = @messages[@messages_index] + else + @status = "#{@status}." + end + end + @background = Gosu::Color.new(0x007a0d71) @background_two = Gosu::Color.new(0x007b6ead) - - @boot_life = 5#_000 - @boot_started = Gosu.milliseconds end def draw @@ -52,22 +64,7 @@ class Boot < CyberarmEngine::GameState @background.alpha+=1 @background_two.alpha+=1 - if Gosu.milliseconds > @boot_started + @boot_life - push_state(MainMenu) - end - - if Gosu.milliseconds > @last_update + @update_interval - @last_update = Gosu.milliseconds - - - split = @status.scan(".") - if split.size >= 3 - @messages_index+=1 - @messages_index = 0 unless @messages_index < @messages.size - @status = @messages[@messages_index] - else - @status = "#{@status}." - end - end + @switcher.update + @loader.update end end \ No newline at end of file diff --git a/lib/states/main_menu.rb b/lib/states/main_menu.rb index e3a0b9f..9f80ddf 100644 --- a/lib/states/main_menu.rb +++ b/lib/states/main_menu.rb @@ -2,30 +2,49 @@ class MainMenu < CyberarmEngine::GameState def setup self.show_cursor = true + background 0xff7a0d71 stack do - background 0xff7a0d71 + background 0xaabada55 + flow(padding: 10, margin: 10) do - background 0xff00ff00 - # image("assets/logo_small.png") - label "I-MIC RTS", text_size: 30 - label "Main Menu", text_size: 30 - end + # background 0xff00aa00 - stack do - background Gosu::Color::RED - - label "I-MIC RTS", text_size: 10 - - button("Play") - button("About") - button("Exit") do - $window.close + stack do + # background 0xffaa0000 + # fill Gosu::Color::BLACK + button("Play") + button("About") + button("Exit") do + $window.close + end end - check_box do |check| - puts "Hello World: #{check.value}" + stack do + image("assets/logo.png", height: 256) do + pop_state + end + end + + stack do + background Gosu::Color.rgba(50, 50, 50, 200) + + label "Username" + @username = edit_line "" + label "Password" + @password = edit_line "", type: :password + + flow do + button "Log In" do + push_state(Boot) + puts "Logging in... #{@username.value}:#{Base64.encode64(@password.value)}" + end + button "Sign Up" + end end end end + + $window.width = @root_container.children.first.width.to_i + $window.height = @root_container.children.first.height.to_i end end \ No newline at end of file