Skip to content

Commit 39fe552

Browse files
committed
Gosu: Setup and first test
1 parent b4a2933 commit 39fe552

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

Gemfile

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source "https://rubygems.org"
2+
3+
gem "gosu", "~> 1.2.0"

assets/doge_space.jpg

909 KB
Loading

main.rb

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env ruby
2+
3+
require 'gosu'
4+
5+
TILE_WIDTH = 960
6+
TILE_HEIGHT = 600
7+
8+
class Test < Gosu::Window
9+
def initialize
10+
super(TILE_WIDTH, TILE_HEIGHT)
11+
self.caption = "Hello World!"
12+
13+
@tiles = Gosu::Image.load_tiles("assets/doge_space.jpg", TILE_WIDTH, TILE_HEIGHT)
14+
end
15+
16+
def update
17+
# ...
18+
end
19+
20+
def draw
21+
tile_i = (Gosu.milliseconds / 1000) % @tiles.size
22+
@tiles[tile_i].draw(0, 0, 0)
23+
end
24+
end
25+
26+
Test.new.show

0 commit comments

Comments
 (0)