Mirage Source http://www.miragesource.net/forums/ |
|
Ruby and Gosu Part 1 http://www.miragesource.net/forums/viewtopic.php?f=142&t=6174 |
Page 1 of 1 |
Author: | skillzalot [ Wed Aug 26, 2009 8:03 pm ] |
Post subject: | Ruby and Gosu Part 1 |
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 |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |