# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#You can contract the author at wikipediankiba@gmail.com
require "rubygame"
require "rbGooey"
include Rubygame
TTF.setup
class Menu
def initialize
@screen = Main.new
@screen.screen_set(800 , 600)
@screen.font_set("freesansbold.ttf", 16)
@screen.bgcolor = [20,70,20]
@screen.fgcolor = [200,200,200]
@text = TextMode.new(@screen)
@text.omit = false
@mouse = Mouse_input.new
@mouse.name('mouse.png')
menu
end
def mouse event
case event
when Rubygame::MouseMotionEvent
@mouse.pos(event)
when Rubygame::MouseDownEvent
activate = @mouse.check(@text.textsprite.rect)
if Integer === activate
case activate
when 1
puts"TESTING"
when 2
puts"Muahhahaha!"
end
end
end
@mouse.update
end
def menu
@text.add"TESTING"
@text.active
@text.add("Muahhahaha!")
@text.set_pos(333,200)
@text.active
@text.textrender.render_text
q = Rubygame::Queue.instance
while 1
@screen.screen.flip
q.get.each do |event|
mouse(event)
case event
when Rubygame::KeyDownEvent
case event.key
when Rubygame::K_ESCAPE
exit
when Rubygame::K_T
test
end
end
end
@mouse.update
end
end
def reponse event
case event
when Rubygame::MouseMotionEvent
@mouse.pos(event)
when Rubygame::MouseDownEvent
activate = @mouse.check(@text.textsprite.rect)
if Integer === activate
case activate
when 1
exit
when 2
@text.add"DON'T EXIT"
@text.textrender.render_text
end
end
end
@mouse.update
end
def test
@text.clear
@text.add"FDSA"
@text.set_pos(234,132)
@text.active
@text.add"JKL:"
@text.set_pos(500,800
@text.textrender.render_text
q = Rubygame::Queue.instance
while 1
@screen.screen.flip
q.get.each do |event|
reponse(event)
case event
when Rubygame::KeyDownEvent
case event.key
when Rubygame::K_ESCAPE
exit
end
end
end
end
end
end
Menu.new