Mirage Source

Free ORPG making software.
It is currently Thu Mar 28, 2024 9:29 pm

All times are UTC




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Ruby and Gosu Part 1
PostPosted: Wed Aug 26, 2009 8:03 pm 
Offline
Regular

Joined: Sat Sep 13, 2008 1:41 am
Posts: 97
This is part 1: How to set up and use gosu with ruby and making a window

1)download this file and install it a SciTE which comes with it http://rubyforge.org/frs/?group_id=167

2)Download gosu from http://gosu.googlecode.com/files/gosu-w ... 0.7.14.zip

3)Make a new directory where your going to make your thing and copy these for files into there. Fmod.dll, Gosu.For_1_8.so, Gosu.for_1_9.so, and gosu .rb.

4)Make a new .rb file with the following code

Code:
require 'gosu'

class GameWindow < Gosu::Window
  def initialize
    super(800, 600, false)
    self.caption = "Fareoke"
   end

end

window = GameWindow.new
window.show



you should save that as text.rb
now double click it if you did it correctly you should see a black windo with the title fareoke. Now to explain it a bit more in detail.


Code:
require 'gosu'


This tell ruby to find gosu and use it.


Code:
class GameWindow < Gosu::Window


This says you are going to be making a window using gosu.


Code:
def initialize
    super(800, 600, false)
    self.caption = "Fareoke"
   end


Def initialize starts the program. Super(800,600,False) Tells us how big the window will be.
self.caption = "Fareoke" Is the title of the window
End finishes the def.

Code:
end


that end finishes all our code
Code:
window = GameWindow.new
window.show


window = GameWindow.new that says we are making a new window
and window.show means show that window when all the other is finished.

Tune in next time to learn how to load and blit images


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group