Module: Hate::Core
- Defined in:
- lib/hate/core.rb
Defined Under Namespace
Modules: Callbacks
Class Method Summary collapse
- .halt ⇒ Object
- .load ⇒ Object
- .options ⇒ Object
- .quit ⇒ Object
- .run ⇒ Object
-
.time ⇒ Object
Get the current time in seconds according to GLUT_ELAPSED_TIME.
- .trapcc ⇒ Object
-
.window ⇒ Object
Grab the default OpenGL window.
Class Method Details
.halt ⇒ Object
16 17 18 19 20 21 |
# File 'lib/hate/core.rb', line 16 def self.halt @window.quit Hate::Core::Callbacks.quit puts "Goodbye!" exit end |
.load ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/hate/core.rb', line 38 def self.load # Load main.rb begin require ARGV[0] rescue LoadError require "./" + ARGV[0] end # Call #load Hate::Core::Callbacks.load end |
.options ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/hate/core.rb', line 23 def self. opts = Trollop:: do version "Hate %s (c) 2011 Brian Jones" % Hate::VERSION <<-EOS Hate 3d - A Ruby 3d Game Engine Usage: hate [options] <game main.rb> Options: EOS end Trollop::die "No main.rb specified!" if ARGV[0].nil? end |
.quit ⇒ Object
68 69 70 |
# File 'lib/hate/core.rb', line 68 def self.quit halt end |
.run ⇒ Object
50 51 52 53 54 55 56 |
# File 'lib/hate/core.rb', line 50 def self.run trapcc # Trap CTRL-C # Load cli options @window = Hate::Graphics::Window.new load # Load user game @window.start end |
.time ⇒ Object
Get the current time in seconds according to GLUT_ELAPSED_TIME.
64 65 66 |
# File 'lib/hate/core.rb', line 64 def self.time @window.time end |
.trapcc ⇒ Object
10 11 12 13 14 |
# File 'lib/hate/core.rb', line 10 def self.trapcc trap('INT') do self.halt end end |
.window ⇒ Object
Grab the default OpenGL window.
59 60 61 |
# File 'lib/hate/core.rb', line 59 def self.window @window end |