Files
number_factory/ui.rb
T

40 lines
1.1 KiB
Ruby

# Nathan Hinton
# This is the UI for the game and will contain all of the sub elements required.
# There will be three main areas that we will be in charge of. First, the
# bottom bar has the selector of item types. There will be a menu in the top
# right as well as any store things that we need/
class UI
# Setup for the UI
# @param width [Integer] Width of screen in pixels
# @param height [Integer] Height of the screen in pixels
def initialize(width, height)
@width = width
@height = height
@tool_selector = []
@toolbar_width = width / 2
@toolbar_height = height / 9
@tool_selector_image = Gosu.render(@toolbar_width, @toolbar_height) {
Gosu.draw_rect(
0,
0,
@toolbar_width,
@toolbar_height,
Gosu::Color.new(0xC0, 0xFF, 0xFF, 0xFF),
0)
Gosu::Image.from_text('tool selector', TEXT_SIZE, font: FONT_PATH).draw(TEXT_MARGIN, TEXT_MARGIN)
}
@x = (@width / 2) - (@toolbar_width / 2)
@y = @height - @toolbar_height
end
def update(mouse_x, mouse_y)
false
end
def draw()
@tool_selector_image.draw(@x, @y)
end
end