require 'gosu'
class Window < Gosu::Window
def draw()
(Gosu::available_width/32).to_i.times do |x|
(Gosu::available_height/32).to_i.times do |y|
@img.draw( x*32, y*32, 1, 4, 4)
end
end
end
def update()
end
def initialize()
super Gosu::available_width, Gosu::available_height, true
@img = Gosu::Image.new("img.png", {:retro=>true})
end
end
win = Window.new()
win.show
Gosu::available_height
returns the height available for running games in *windowed* mode, so if you are on Windows, this will be the same as Gosu::screen_height
minus space for the start menu/task bar at the bottom.Gosu::screen_width
and Gosu::screen_height
instead.:retro => true
and without producing a grid effect, :tileable => true
was designed exactly for that purpose :) Hope that helps!
available_height
with screen_height
the bottom black bar dissapeared, but the top black bar is still there. Is that supposed to happen?require 'gosu'
class Window < Gosu::Window
def draw()
((Gosu::screen_width/32)+1).times do |x|
((Gosu::screen_height/32)+1).times do |y|
@img.draw( (x*32), (y*32),0,4,4)
end
end
Gosu::draw_rect(0,0,Gosu::screen_width, 32, Gosu::Color::WHITE)
end
def update()
end
def initialize()
super Gosu::screen_width, Gosu::screen_height, true
@img = Gosu::Image.new("img.png", {:retro=>true, :tileable=>true})
end
end
win = Window.new()
win.show
@img.draw( (x*32), (y*32),1,4,4)
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill