pixelfaucet/examples/sprite_example.cr

25 lines
429 B
Crystal
Raw Normal View History

2022-01-03 01:39:17 +01:00
require "../src/game"
require "../src/sprite"
module PF
class SpriteExample < Game
2022-01-07 06:06:51 +01:00
@sprite : Sprite
2022-01-03 01:39:17 +01:00
def initialize(*args, **kwargs)
super
2022-01-07 06:06:51 +01:00
@sprite = Sprite.new("./assets/pf-font.png")
2022-01-03 01:39:17 +01:00
end
def update(dt, event)
end
def draw
clear(255, 255, 255)
2022-01-07 06:06:51 +01:00
@sprite.draw_to(screen, (viewport // 2) - @sprite.size // 2)
2022-01-03 01:39:17 +01:00
end
end
end
game = PF::SpriteExample.new(200, 200, 2)
game.run!