physics
E. Almqvist 3 years ago
parent 84c3d6ad26
commit 13044cdb82
  1. 16
      src/lib/ui.rb

@ -102,6 +102,12 @@ class MainMenu < UI
def initialize(window, show=false)
super window, 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, 99
@show = show
@playbtn = Button.new(self.window, self, "Play", self.window.fonts[:button])
@playbtn.x, @playbtn.y = self.width/2 - @playbtn.width/2, self.height/2 - @playbtn.height/2
@quitbtn = Button.new(self.window, self, "Quit", self.window.fonts[:button])
@quitbtn.x, @quitbtn.y = self.width/2 - @quitbtn.width/2, @quitbtn.height + @playbtn.y + 16
end
def quit_game
@ -115,14 +121,8 @@ class MainMenu < UI
titletext = "Hohmann Miner"
titlewidth = self.window.fonts[:title].text_width(titletext)
self.draw_text(titletext, self.window.fonts[:title], self.width/2 - titlewidth/2, self.height/4)
playbtn = Button.new(self.window, self, "Play", self.window.fonts[:button])
playbtn.x, playbtn.y = self.width/2 - playbtn.width/2, self.height/2 - playbtn.height/2
playbtn.render
quitbtn = Button.new(self.window, self, "Quit", self.window.fonts[:button])
quitbtn.x, quitbtn.y = self.width/2 - quitbtn.width/2, quitbtn.height + playbtn.y + 16
quitbtn.render
@playbtn.render
@quitbtn.render
end
end
end

Loading…
Cancel
Save