5.3P.rtf - require'rubygems require'gosu module ZOrder BACKGROUND MIDDLE TOP =*0.2 end WIN_WIDTH = 640 WIN_HEIGHT = 400 class DemoWindow < Gosu:Window

5.3P.rtf - require'rubygems require'gosu module ZOrder...

This preview shows page 1 - 3 out of 3 pages.

require 'rubygems' require 'gosu' module ZOrder BACKGROUND, MIDDLE, TOP = *0..2 end WIN_WIDTH = 640 WIN_HEIGHT = 400 class DemoWindow < Gosu::Window def initialize super(WIN_WIDTH, WIN_HEIGHT, false) @background = Gosu::Color::WHITE @button_font = Gosu::Font.new(20) @info_font = Gosu::Font.new(20) @locs = [60,60] end def draw Gosu.draw_rect(0, 0, WIN_WIDTH, WIN_HEIGHT, @background, ZOrder::BACKGROUND, mode=:default) Gosu.draw_rect(50, 50, 100, 50, Gosu::Color::GREEN, ZOrder::MIDDLE, mode=:default) @button_font.draw("Click me", 60, 60, ZOrder::TOP, 1.0, 1.0, Gosu::Color::BLACK) @info_font.draw("mouse_x: #{@locs[0]}", 20, 200, ZOrder::MIDDLE, 1.0, 1.0,

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture