Module: Engine::Debugging
- Defined in:
- lib/engine/debugging.rb
Class Method Summary collapse
-
.breakpoint(&block) ⇒ Object
Hit a breakpoint within the context of where the breakpoint is defined, assuming a block is passed with a ‘binding.pry` (or an alternative debugger), otherwise hit a breakpoint within this method.
- .debug_opengl_call ⇒ Object
- .print_opengl_version ⇒ Object
Class Method Details
.breakpoint(&block) ⇒ Object
Hit a breakpoint within the context of where the breakpoint is defined, assuming a block is passed with a ‘binding.pry` (or an alternative debugger), otherwise hit a breakpoint within this method.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/engine/debugging.rb', line 8 def self.breakpoint(&block) orig_fullscreen = Window.full_screen? if orig_fullscreen Window.set_to_windowed GLFW.PollEvents # Required to trigger the switch from fullscreen to windowed within this breakpoint end orig_cursor_mode = Cursor.get_input_mode Cursor.enable block_given? ? yield : binding.pry Cursor.restore_input_mode(orig_cursor_mode) Window.set_to_full_screen if orig_fullscreen Window.focus_window # Reset the time, otherwise delta_time will be off for the next frame, and teleporting occurs @time = Time.now end |
.debug_opengl_call ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/engine/debugging.rb', line 27 def self.debug_opengl_call errors = [] until GL.GetError == 0; end yield until (error = GL.GetError) == 0 errors += error.to_s(16) end end |
.print_opengl_version ⇒ Object
36 37 38 39 |
# File 'lib/engine/debugging.rb', line 36 def self.print_opengl_version puts "OpenGL Version: #{GL.GetString(GL::VERSION)}" puts "GLSL Version: #{GL.GetString(GL::SHADING_LANGUAGE_VERSION)}" end |