Module: GLFW

Defined in:
lib/engine/glfw.rb

Constant Summary collapse

TRUE =

GLFW boolean constants

1
FALSE =
0
CONTEXT_VERSION_MAJOR =

Window hints

0x00022002
CONTEXT_VERSION_MINOR =
0x00022003
OPENGL_FORWARD_COMPAT =
0x00022006
OPENGL_PROFILE =
0x00022008
DECORATED =
0x00020005
AUTO_ICONIFY =
0x00020006
OPENGL_CORE_PROFILE =

OpenGL profiles

0x00032001
DONT_CARE =

Special value for “don’t care”

-1
CURSOR =

Cursor input mode

0x00033001
CURSOR_NORMAL =
0x00034001
CURSOR_HIDDEN =
0x00034002
CURSOR_DISABLED =
0x00034003
GLFWvidmode =

GLFWvidmode struct for video mode handling Matches the C struct layout:

int width, height, redBits, greenBits, blueBits, refreshRate
Fiddle::Importer.struct([
  'int width',
  'int height',
  'int redBits',
  'int greenBits',
  'int blueBits',
  'int refreshRate'
])

Class Method Summary collapse

Class Method Details

.create_callback(type, &block) ⇒ Object

create_callback is now a no-op that just returns the proc The native extension handles Ruby procs directly



147
148
149
# File 'lib/engine/glfw.rb', line 147

def create_callback(type, &block)
  block
end

.CreateWindow(width, height, title, monitor, share) ⇒ Object



57
58
59
# File 'lib/engine/glfw.rb', line 57

def CreateWindow(width, height, title, monitor, share)
  GLFWNative.create_window(width, height, title, monitor, share)
end

.DestroyWindow(window) ⇒ Object



61
62
63
# File 'lib/engine/glfw.rb', line 61

def DestroyWindow(window)
  GLFWNative.destroy_window(window)
end

.FocusWindow(window) ⇒ Object



89
90
91
# File 'lib/engine/glfw.rb', line 89

def FocusWindow(window)
  GLFWNative.focus_window(window)
end

.GetFramebufferSize(window, width_buf, height_buf) ⇒ Object



97
98
99
# File 'lib/engine/glfw.rb', line 97

def GetFramebufferSize(window, width_buf, height_buf)
  GLFWNative.get_framebuffer_size(window, width_buf, height_buf)
end

.GetInputMode(window, mode) ⇒ Object



141
142
143
# File 'lib/engine/glfw.rb', line 141

def GetInputMode(window, mode)
  GLFWNative.get_input_mode(window, mode)
end

.GetPrimaryMonitorObject



125
126
127
# File 'lib/engine/glfw.rb', line 125

def GetPrimaryMonitor
  GLFWNative.get_primary_monitor
end

.GetVideoMode(monitor) ⇒ Object



129
130
131
# File 'lib/engine/glfw.rb', line 129

def GetVideoMode(monitor)
  GLFWNative.get_video_mode(monitor)
end

.GetVideoModes(monitor, count_buf) ⇒ Object



133
134
135
# File 'lib/engine/glfw.rb', line 133

def GetVideoModes(monitor, count_buf)
  GLFWNative.get_video_modes(monitor, count_buf)
end

.InitObject



49
50
51
# File 'lib/engine/glfw.rb', line 49

def Init
  GLFWNative.init
end

.load_lib(path) ⇒ Object



45
46
47
# File 'lib/engine/glfw.rb', line 45

def load_lib(path)
  GLFWNative.load_lib(path)
end

.MakeContextCurrent(window) ⇒ Object



93
94
95
# File 'lib/engine/glfw.rb', line 93

def MakeContextCurrent(window)
  GLFWNative.make_context_current(window)
end

.PollEventsObject



101
102
103
# File 'lib/engine/glfw.rb', line 101

def PollEvents
  GLFWNative.poll_events
end

.SetCursorPosCallback(window, callback) ⇒ Object



117
118
119
# File 'lib/engine/glfw.rb', line 117

def SetCursorPosCallback(window, callback)
  GLFWNative.set_cursor_pos_callback(window, callback)
end

.SetInputMode(window, mode, value) ⇒ Object



137
138
139
# File 'lib/engine/glfw.rb', line 137

def SetInputMode(window, mode, value)
  GLFWNative.set_input_mode(window, mode, value)
end

.SetKeyCallback(window, callback) ⇒ Object



113
114
115
# File 'lib/engine/glfw.rb', line 113

def SetKeyCallback(window, callback)
  GLFWNative.set_key_callback(window, callback)
end

.SetMouseButtonCallback(window, callback) ⇒ Object



121
122
123
# File 'lib/engine/glfw.rb', line 121

def SetMouseButtonCallback(window, callback)
  GLFWNative.set_mouse_button_callback(window, callback)
end

.SetWindowAttrib(window, attrib, value) ⇒ Object



69
70
71
# File 'lib/engine/glfw.rb', line 69

def SetWindowAttrib(window, attrib, value)
  GLFWNative.set_window_attrib(window, attrib, value)
end

.SetWindowMonitor(window, monitor, xpos, ypos, width, height, refresh_rate) ⇒ Object



77
78
79
# File 'lib/engine/glfw.rb', line 77

def SetWindowMonitor(window, monitor, xpos, ypos, width, height, refresh_rate)
  GLFWNative.set_window_monitor(window, monitor, xpos, ypos, width, height, refresh_rate)
end

.SetWindowShouldClose(window, value) ⇒ Object



85
86
87
# File 'lib/engine/glfw.rb', line 85

def SetWindowShouldClose(window, value)
  GLFWNative.set_window_should_close(window, value)
end

.SetWindowTitle(window, title) ⇒ Object



73
74
75
# File 'lib/engine/glfw.rb', line 73

def SetWindowTitle(window, title)
  GLFWNative.set_window_title(window, title)
end

.SwapBuffers(window) ⇒ Object



105
106
107
# File 'lib/engine/glfw.rb', line 105

def SwapBuffers(window)
  GLFWNative.swap_buffers(window)
end

.SwapInterval(interval) ⇒ Object



109
110
111
# File 'lib/engine/glfw.rb', line 109

def SwapInterval(interval)
  GLFWNative.swap_interval(interval)
end

.TerminateObject



53
54
55
# File 'lib/engine/glfw.rb', line 53

def Terminate
  GLFWNative.terminate
end

.WindowHint(hint, value) ⇒ Object



65
66
67
# File 'lib/engine/glfw.rb', line 65

def WindowHint(hint, value)
  GLFWNative.window_hint(hint, value)
end

.WindowShouldClose(window) ⇒ Object



81
82
83
# File 'lib/engine/glfw.rb', line 81

def WindowShouldClose(window)
  GLFWNative.window_should_close(window)
end