Sha256: fbf229579b541e85161df729769e1994a4078c2181b860f3ac50f1ff18b2cc06

Contents?: true

Size: 721 Bytes

Versions: 2

Compression:

Stored size: 721 Bytes

Contents

# from http://moriq.tdiary.net/20051006.html 
# Apollo with Ruby/SDL
require 'phi'
require 'sdl'

# Create form
form = Phi::Form.new
$terminated = false
form.on_close{ $terminated = true }
form.caption = "Ruby/SDL on Phi::Form"
# Create a panel on new form
panel = Phi::Panel.new(form)
panel.align = Phi::AL_LEFT

# Put SDL window on panel with WINDOWID hack
SDL.putenv("SDL_VIDEODRIVER=windib")
SDL.putenv("SDL_WINDOWID=#{panel.handle}")
form.show

# initialize SDL
SDL.init(SDL::INIT_VIDEO)
screen = SDL.setVideoMode(640, 480, 16, SDL::SWSURFACE)

# main loop
unless $terminated
  while event = SDL::Event2.poll
    case event
    when SDL::Event2::KeyDown, SDL::Event2::Quit
      exit
    end
  end

  sleep 0.05
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubyneat-0.3.5.alpha.3 foo/foo_sdl.rb
rubyneat-0.3.5.alpha.2 foo/foo_sdl.rb