class Pc::Window
Public Class Methods
new()
click to toggle source
Calls superclass method
# File lib/pc/interfaces/desktop/window.rb, line 8 def initialize super 640, 480, is_fullscreen self.caption = 'Game Hall' @font = Gosu::Font.new self, Gosu::default_font_name, 20 end
Public Instance Methods
draw()
click to toggle source
This method is called after every update and whenever the OS wants the window to repaint itself.
# File lib/pc/interfaces/desktop/window.rb, line 54 def draw draw_text @alert if @alert draw_buttons @buttons if @buttons end
draw_rectangle(button)
click to toggle source
# File lib/pc/interfaces/desktop/window.rb, line 39 def draw_rectangle(button) c1, c2 = [Gosu::Color.new(0xFF1EB1FA), Gosu::Color.new(0xFF1D4DB5)] x1, x2, y1, y2 = [button[:x1], button[:x2], button[:y1], button[:y2]] z_index = 0 draw_quad x1, y1, c1, x2, y1, c1, x1, y2, c2, x2, y2, c2, z_index end
draw_text(text)
click to toggle source
# File lib/pc/interfaces/desktop/window.rb, line 35 def draw_text(text) @font.draw @alert, 200, 450, 2 # TO DO: center the text end
set_alert(message)
click to toggle source
# File lib/pc/interfaces/desktop/window.rb, line 14 def set_alert(message) @alert = message end
update()
click to toggle source
This method is called once every update_interval milliseconds while the window is being shown.
# File lib/pc/interfaces/desktop/window.rb, line 25 def update @buttons.each do |button, index| if button[:timeout] < Time.now && button[:label] == :next @buttons = nil button[:action].call break end end if @buttons end
Private Instance Methods
is_fullscreen()
click to toggle source
# File lib/pc/interfaces/desktop/window.rb, line 82 def is_fullscreen false end
needs_cursor?()
click to toggle source
- from Gosu::Window
-
Whether the system cursor should be shown
# File lib/pc/interfaces/desktop/window.rb, line 87 def needs_cursor? true end