Firstly, you'll need the Gosu Lib. found HERE!
after you have that done. Create a folder for the project. then extract the Gosu folder (somewhere thats not in the project folder) then go into the Lib folder of gosu. copy "gosu.for_1_8.so", "gosu.rb" and "fmod.dll" into your project folder.
now. open up Notepad(or a texteditor of your choice) and put this code in:
require 'gosu' class GameWindow < Gosu::Window def initialize super(640, 480, false) self.caption = "Gosu Window" end def update end def draw end end window = Gamewindow.new window.show
now save it as main.rb and run.
now i shall explain what all this does.
require 'gosu'
this allows the ruby file to use Gosu's built in classes.
class GameWindow < Gosu::Window
creates a new class defined by the Gosu::Window class, allowing you to create a window.
def initialize super(640, 480, false) self.caption = "Gosu Window" end
when the GameWindow is created, it sets up a new window of 640 width and 480 hight, with a caption of Gosu window.
window = Gamewindow.new window.show
creates a new instance of the GameWindow class, then displays it on the screen.
if there are any problems feel free to ask.
the next part of this tut will show you how to create a sprite on the screen and move it using the arrow keys .. keep a look out





MultiQuote





|