Class: RAGE::Game
Overview
Manages the overall game execution, end users only need to call run on this class.
Class Method Summary collapse
-
.draw ⇒ Object
Invoked during main game execution cycle to run through a single game draw operation.
-
.run ⇒ Object
Run game and block.
-
.wireframe_mode=(val) ⇒ Object
Set wireframe mode on / off.
Class Method Details
.draw ⇒ Object
Invoked during main game execution cycle to run through a single game draw operation
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rage/game.rb', line 18 def self.draw Window.draw Window..each { |vp| @@current_viewport = vp vp.draw # draw each location LocationsManager.instance.locations.each { |lm| lm.draw } } Window.refresh end |
.run ⇒ Object
Run game and block
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/rage/game.rb', line 35 def self.run Gl.glEnable( Gl::GL_TEXTURE_2D ) Gl.glEnable(Gl::GL_DEPTH_TEST) Gl.glEnable(Gl::GL_BLEND); Gl.glBlendFunc(Gl::GL_SRC_ALPHA, Gl::GL_ONE_MINUS_SRC_ALPHA); Gl.glDepthMask(Gl::GL_TRUE) @@wireframe_mode = false while true while event = SDL::Event2.poll InputHandler.handle event end draw sleep 0.01 end end |
.wireframe_mode=(val) ⇒ Object
Set wireframe mode on / off
59 60 61 62 |
# File 'lib/rage/game.rb', line 59 def self.wireframe_mode=(val) @@wireframe_mode= val Gl.glPolygonMode( Gl::GL_FRONT_AND_BACK, val ? Gl::GL_LINE : Gl::GL_FILL ) end |