Sha256: 39516cf9ee95503d7be315ccb4f8b1a7b971b5adf1583e93452eee9e88c245e2

Contents?: true

Size: 736 Bytes

Versions: 2

Compression:

Stored size: 736 Bytes

Contents

require 'gosu'
require 'orange_zest'

include OrangeZest

WIDTH = 640
HEIGHT = 480

class ClearScreen < Component
  def draw
    Gosu.draw_rect(0, 0, WIDTH, HEIGHT, Gosu::Color::WHITE)
  end
end

class BouncingBall < Entity
  IMAGE = Gosu::Image.new(File.join(__dir__, "res", "ball.png"))

  include UI::Tooltip

  def initialize(**kw)
    super(animations: { normal: Animation.static(IMAGE) }, **kw)
    @tooltip = "Hello"
  end

  def draw
    super
    draw_tooltip
  end
end

class Game < OrangeZest::Window
  def initialize
    super WIDTH, HEIGHT

    UI.default_font = Gosu::Font.new(16, name: "Arial")

    ClearScreen.new.register
    BouncingBall.new(position: Point.new(50, 50)).register
  end
end

# Let's go!
Game.new.show

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
orange_zest-0.2.0 examples/ui.rb
orange_zest-0.1.0 examples/ui.rb