Module: Glfw

Defined in:
ext/glfw/glfw.c

Constant Summary collapse

GLFW_KEY_SPACE =

for compatibility between ruby versuins - 1.8 => 32 , 1.9 => “ ”

rb_eval_string("?\\s")
GLFW_VERSION_MAJOR =
INT2NUM(GLFW_VERSION_MAJOR)
GLFW_VERSION_MINOR =
INT2NUM(GLFW_VERSION_MINOR)
GLFW_VERSION_REVISION =
INT2NUM(GLFW_VERSION_REVISION)
GLFW_RELEASE =
INT2NUM(GLFW_RELEASE)
GLFW_PRESS =
INT2NUM(GLFW_PRESS)
GLFW_KEY_UNKNOWN =
INT2NUM(GLFW_KEY_UNKNOWN)
GLFW_KEY_SPECIAL =
INT2NUM(GLFW_KEY_SPECIAL)
GLFW_KEY_ESC =
INT2NUM(GLFW_KEY_ESC)
GLFW_KEY_F1 =
INT2NUM(GLFW_KEY_F1)
GLFW_KEY_F2 =
INT2NUM(GLFW_KEY_F2)
GLFW_KEY_F3 =
INT2NUM(GLFW_KEY_F3)
GLFW_KEY_F4 =
INT2NUM(GLFW_KEY_F4)
GLFW_KEY_F5 =
INT2NUM(GLFW_KEY_F5)
GLFW_KEY_F6 =
INT2NUM(GLFW_KEY_F6)
GLFW_KEY_F7 =
INT2NUM(GLFW_KEY_F7)
GLFW_KEY_F8 =
INT2NUM(GLFW_KEY_F8)
GLFW_KEY_F9 =
INT2NUM(GLFW_KEY_F9)
GLFW_KEY_F10 =
INT2NUM(GLFW_KEY_F10)
GLFW_KEY_F11 =
INT2NUM(GLFW_KEY_F11)
GLFW_KEY_F12 =
INT2NUM(GLFW_KEY_F12)
GLFW_KEY_F13 =
INT2NUM(GLFW_KEY_F13)
GLFW_KEY_F14 =
INT2NUM(GLFW_KEY_F14)
GLFW_KEY_F15 =
INT2NUM(GLFW_KEY_F15)
GLFW_KEY_F16 =
INT2NUM(GLFW_KEY_F16)
GLFW_KEY_F17 =
INT2NUM(GLFW_KEY_F17)
GLFW_KEY_F18 =
INT2NUM(GLFW_KEY_F18)
GLFW_KEY_F19 =
INT2NUM(GLFW_KEY_F19)
GLFW_KEY_F20 =
INT2NUM(GLFW_KEY_F20)
GLFW_KEY_F21 =
INT2NUM(GLFW_KEY_F21)
GLFW_KEY_F22 =
INT2NUM(GLFW_KEY_F22)
GLFW_KEY_F23 =
INT2NUM(GLFW_KEY_F23)
GLFW_KEY_F24 =
INT2NUM(GLFW_KEY_F24)
GLFW_KEY_F25 =
INT2NUM(GLFW_KEY_F25)
GLFW_KEY_UP =
INT2NUM(GLFW_KEY_UP)
GLFW_KEY_DOWN =
INT2NUM(GLFW_KEY_DOWN)
GLFW_KEY_LEFT =
INT2NUM(GLFW_KEY_LEFT)
GLFW_KEY_RIGHT =
INT2NUM(GLFW_KEY_RIGHT)
GLFW_KEY_LSHIFT =
INT2NUM(GLFW_KEY_LSHIFT)
GLFW_KEY_RSHIFT =
INT2NUM(GLFW_KEY_RSHIFT)
GLFW_KEY_LCTRL =
INT2NUM(GLFW_KEY_LCTRL)
GLFW_KEY_RCTRL =
INT2NUM(GLFW_KEY_RCTRL)
GLFW_KEY_LALT =
INT2NUM(GLFW_KEY_LALT)
GLFW_KEY_RALT =
INT2NUM(GLFW_KEY_RALT)
GLFW_KEY_TAB =
INT2NUM(GLFW_KEY_TAB)
GLFW_KEY_ENTER =
INT2NUM(GLFW_KEY_ENTER)
GLFW_KEY_BACKSPACE =
INT2NUM(GLFW_KEY_BACKSPACE)
GLFW_KEY_INSERT =
INT2NUM(GLFW_KEY_INSERT)
GLFW_KEY_DEL =
INT2NUM(GLFW_KEY_DEL)
GLFW_KEY_PAGEUP =
INT2NUM(GLFW_KEY_PAGEUP)
GLFW_KEY_PAGEDOWN =
INT2NUM(GLFW_KEY_PAGEDOWN)
GLFW_KEY_HOME =
INT2NUM(GLFW_KEY_HOME)
GLFW_KEY_END =
INT2NUM(GLFW_KEY_END)
GLFW_KEY_KP_0 =
INT2NUM(GLFW_KEY_KP_0)
GLFW_KEY_KP_1 =
INT2NUM(GLFW_KEY_KP_1)
GLFW_KEY_KP_2 =
INT2NUM(GLFW_KEY_KP_2)
GLFW_KEY_KP_3 =
INT2NUM(GLFW_KEY_KP_3)
GLFW_KEY_KP_4 =
INT2NUM(GLFW_KEY_KP_4)
GLFW_KEY_KP_5 =
INT2NUM(GLFW_KEY_KP_5)
GLFW_KEY_KP_6 =
INT2NUM(GLFW_KEY_KP_6)
GLFW_KEY_KP_7 =
INT2NUM(GLFW_KEY_KP_7)
GLFW_KEY_KP_8 =
INT2NUM(GLFW_KEY_KP_8)
GLFW_KEY_KP_9 =
INT2NUM(GLFW_KEY_KP_9)
GLFW_KEY_KP_DIVIDE =
INT2NUM(GLFW_KEY_KP_DIVIDE)
GLFW_KEY_KP_MULTIPLY =
INT2NUM(GLFW_KEY_KP_MULTIPLY)
GLFW_KEY_KP_SUBTRACT =
INT2NUM(GLFW_KEY_KP_SUBTRACT)
GLFW_KEY_KP_ADD =
INT2NUM(GLFW_KEY_KP_ADD)
GLFW_KEY_KP_DECIMAL =
INT2NUM(GLFW_KEY_KP_DECIMAL)
GLFW_KEY_KP_EQUAL =
INT2NUM(GLFW_KEY_KP_EQUAL)
GLFW_KEY_KP_ENTER =
INT2NUM(GLFW_KEY_KP_ENTER)
GLFW_KEY_LAST =
INT2NUM(GLFW_KEY_LAST)
GLFW_MOUSE_BUTTON_1 =
INT2NUM(GLFW_MOUSE_BUTTON_1)
GLFW_MOUSE_BUTTON_2 =
INT2NUM(GLFW_MOUSE_BUTTON_2)
GLFW_MOUSE_BUTTON_3 =
INT2NUM(GLFW_MOUSE_BUTTON_3)
GLFW_MOUSE_BUTTON_4 =
INT2NUM(GLFW_MOUSE_BUTTON_4)
GLFW_MOUSE_BUTTON_5 =
INT2NUM(GLFW_MOUSE_BUTTON_5)
GLFW_MOUSE_BUTTON_6 =
INT2NUM(GLFW_MOUSE_BUTTON_6)
GLFW_MOUSE_BUTTON_7 =
INT2NUM(GLFW_MOUSE_BUTTON_7)
GLFW_MOUSE_BUTTON_8 =
INT2NUM(GLFW_MOUSE_BUTTON_8)
GLFW_MOUSE_BUTTON_LAST =
INT2NUM(GLFW_MOUSE_BUTTON_LAST)
GLFW_MOUSE_BUTTON_LEFT =
INT2NUM(GLFW_MOUSE_BUTTON_LEFT)
GLFW_MOUSE_BUTTON_RIGHT =
INT2NUM(GLFW_MOUSE_BUTTON_RIGHT)
GLFW_MOUSE_BUTTON_MIDDLE =
INT2NUM(GLFW_MOUSE_BUTTON_MIDDLE)
GLFW_JOYSTICK_1 =
INT2NUM(GLFW_JOYSTICK_1)
GLFW_JOYSTICK_2 =
INT2NUM(GLFW_JOYSTICK_2)
GLFW_JOYSTICK_3 =
INT2NUM(GLFW_JOYSTICK_3)
GLFW_JOYSTICK_4 =
INT2NUM(GLFW_JOYSTICK_4)
GLFW_JOYSTICK_5 =
INT2NUM(GLFW_JOYSTICK_5)
GLFW_JOYSTICK_6 =
INT2NUM(GLFW_JOYSTICK_6)
GLFW_JOYSTICK_7 =
INT2NUM(GLFW_JOYSTICK_7)
GLFW_JOYSTICK_8 =
INT2NUM(GLFW_JOYSTICK_8)
GLFW_JOYSTICK_9 =
INT2NUM(GLFW_JOYSTICK_9)
GLFW_JOYSTICK_10 =
INT2NUM(GLFW_JOYSTICK_10)
GLFW_JOYSTICK_11 =
INT2NUM(GLFW_JOYSTICK_11)
GLFW_JOYSTICK_12 =
INT2NUM(GLFW_JOYSTICK_12)
GLFW_JOYSTICK_13 =
INT2NUM(GLFW_JOYSTICK_13)
GLFW_JOYSTICK_14 =
INT2NUM(GLFW_JOYSTICK_14)
GLFW_JOYSTICK_15 =
INT2NUM(GLFW_JOYSTICK_15)
GLFW_JOYSTICK_16 =
INT2NUM(GLFW_JOYSTICK_16)
GLFW_JOYSTICK_LAST =
INT2NUM(GLFW_JOYSTICK_LAST)
GLFW_WINDOW =
INT2NUM(GLFW_WINDOW)
GLFW_FULLSCREEN =
INT2NUM(GLFW_FULLSCREEN)
GLFW_OPENED =
INT2NUM(GLFW_OPENED)
GLFW_ACTIVE =
INT2NUM(GLFW_ACTIVE)
GLFW_ICONIFIED =
INT2NUM(GLFW_ICONIFIED)
GLFW_ACCELERATED =
INT2NUM(GLFW_ACCELERATED)
GLFW_RED_BITS =
INT2NUM(GLFW_RED_BITS)
GLFW_GREEN_BITS =
INT2NUM(GLFW_GREEN_BITS)
GLFW_BLUE_BITS =
INT2NUM(GLFW_BLUE_BITS)
GLFW_ALPHA_BITS =
INT2NUM(GLFW_ALPHA_BITS)
GLFW_DEPTH_BITS =
INT2NUM(GLFW_DEPTH_BITS)
GLFW_STENCIL_BITS =
INT2NUM(GLFW_STENCIL_BITS)
GLFW_REFRESH_RATE =
INT2NUM(GLFW_REFRESH_RATE)
GLFW_ACCUM_RED_BITS =
INT2NUM(GLFW_ACCUM_RED_BITS)
GLFW_ACCUM_GREEN_BITS =
INT2NUM(GLFW_ACCUM_GREEN_BITS)
GLFW_ACCUM_BLUE_BITS =
INT2NUM(GLFW_ACCUM_BLUE_BITS)
GLFW_ACCUM_ALPHA_BITS =
INT2NUM(GLFW_ACCUM_ALPHA_BITS)
GLFW_AUX_BUFFERS =
INT2NUM(GLFW_AUX_BUFFERS)
GLFW_STEREO =
INT2NUM(GLFW_STEREO)
GLFW_WINDOW_NO_RESIZE =
INT2NUM(GLFW_WINDOW_NO_RESIZE)
GLFW_FSAA_SAMPLES =
INT2NUM(GLFW_FSAA_SAMPLES)
GLFW_MOUSE_CURSOR =
INT2NUM(GLFW_MOUSE_CURSOR)
GLFW_STICKY_KEYS =
INT2NUM(GLFW_STICKY_KEYS)
GLFW_STICKY_MOUSE_BUTTONS =
INT2NUM(GLFW_STICKY_MOUSE_BUTTONS)
GLFW_SYSTEM_KEYS =
INT2NUM(GLFW_SYSTEM_KEYS)
GLFW_KEY_REPEAT =
INT2NUM(GLFW_KEY_REPEAT)
GLFW_AUTO_POLL_EVENTS =
INT2NUM(GLFW_AUTO_POLL_EVENTS)
GLFW_WAIT =
INT2NUM(GLFW_WAIT)
GLFW_NOWAIT =
INT2NUM(GLFW_NOWAIT)
GLFW_PRESENT =
INT2NUM(GLFW_PRESENT)
GLFW_AXES =
INT2NUM(GLFW_AXES)
GLFW_BUTTONS =
INT2NUM(GLFW_BUTTONS)
GLFW_NO_RESCALE_BIT =
INT2NUM(GLFW_NO_RESCALE_BIT)
GLFW_ORIGIN_UL_BIT =
INT2NUM(GLFW_ORIGIN_UL_BIT)
GLFW_BUILD_MIPMAPS_BIT =
INT2NUM(GLFW_BUILD_MIPMAPS_BIT)
GLFW_ALPHA_MAP_BIT =
INT2NUM(GLFW_ALPHA_MAP_BIT)
GLFW_INFINITY =
INT2NUM(GLFW_INFINITY)

Class Method Summary collapse

Class Method Details

.glfwCloseWindowObject

Closes window



122
123
124
125
126
# File 'ext/glfw/glfw.c', line 122

static VALUE glfw_CloseWindow(VALUE obj)
{
	glfwCloseWindow();
	return Qnil;
}

.glfwDisable(feature) ⇒ Object

Disables certain GLFW feature



785
786
787
788
789
# File 'ext/glfw/glfw.c', line 785

static VALUE glfw_Disable(VALUE obj,VALUE arg1)
{
	glfwDisable(NUM2INT(arg1));
	return Qnil;
}

.glfwEnable(feature) ⇒ Object

Enables certain GLFW feature



773
774
775
776
777
# File 'ext/glfw/glfw.c', line 773

static VALUE glfw_Enable(VALUE obj,VALUE arg1)
{
	glfwEnable(NUM2INT(arg1));
	return Qnil;
}

.glfwExtensionSupported(extension_name) ⇒ Object

Is given OpenGL extension supported ?



737
738
739
740
741
742
743
# File 'ext/glfw/glfw.c', line 737

static VALUE glfw_ExtensionSupported(VALUE obj,VALUE arg1)
{
	int ret;
	Check_Type(arg1,T_STRING);
	ret = glfwExtensionSupported(RSTRING_PTR(arg1));
	return GL_BOOL_TO_RUBY_BOOL(ret);
}

.glfwFreeImage(GLFWimage) ⇒ Object

Frees data in GLFWimage object and marks it for deletion.



675
676
677
678
679
680
681
# File 'ext/glfw/glfw.c', line 675

static VALUE glfw_FreeImage(VALUE obj,VALUE arg1)
{
	GLFWimage *img;
	Data_Get_Struct(arg1, GLFWimage, img);
	glfwFreeImage(img);
	return Qnil;
}

.glfwGetDesktopModeVidmode

Returns current desktop mode in form of instance of Vidmode class - see glfwGetVideoModes for details.

Returns:

  • (Vidmode)


320
321
322
323
324
325
# File 'ext/glfw/glfw.c', line 320

static VALUE glfw_GetDesktopMode(VALUE obj)
{
	GLFWvidmode vm;
	glfwGetDesktopMode(&vm);
	return vidmode_to_ruby(vm);	
}

.glfwGetGLVersionArray

Returns installed OpenGL version

Returns:

  • (Array)


753
754
755
756
757
758
759
760
# File 'ext/glfw/glfw.c', line 753

static VALUE glfw_GetGLVersion(VALUE obj)
{
	int major = 0;
	int minor = 0;
	int rev = 0;
	glfwGetGLVersion(&major,&minor,&rev);
	return rb_ary_new3(3,INT2NUM(major),INT2NUM(minor),INT2NUM(rev));
}

.glfwGetJoystickButtons(joystick) ⇒ Array

Returns joystick button states (which are either GLFW_PRESS or GLFW_RELEASE) or nil if given joystick is not present

Returns:

  • (Array)


458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
# File 'ext/glfw/glfw.c', line 458

static VALUE glfw_GetJoystickButtons(VALUE obj,VALUE arg1)
{
	unsigned char *buttons;
	int numbuttons;
	int count;
	int i;
	VALUE ret;

	numbuttons = glfwGetJoystickParam(NUM2INT(arg1),GLFW_BUTTONS);
	if (numbuttons<=0)
		return Qnil;

	buttons = ALLOC_N(unsigned char,numbuttons);
	count = glfwGetJoystickButtons(NUM2INT(arg1),buttons,numbuttons);
	ret = rb_ary_new2(count);
	for(i=0;i<count;++i)
		rb_ary_push(ret,INT2NUM(buttons[i]));
	xfree(buttons);
	return ret;
}

.glfwGetJoystickParamObject

.glfwGetJoystickPos(joystick) ⇒ Array

Returns joystick axes positions or nil if given joystick is not present

Returns:

  • (Array)


431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
# File 'ext/glfw/glfw.c', line 431

static VALUE glfw_GetJoystickPos(VALUE obj,VALUE arg1)
{
	float *pos;
	int numaxes;
	int count;
	int i;
	VALUE ret;

	numaxes = glfwGetJoystickParam(NUM2INT(arg1),GLFW_AXES);
	if (numaxes<=0)
		return Qnil;

	pos = ALLOC_N(float,numaxes);
	count = glfwGetJoystickPos(NUM2INT(arg1),pos,numaxes);
	ret = rb_ary_new2(count);
	for(i=0;i<count;++i)
		rb_ary_push(ret,rb_float_new(pos[i]));
	xfree(pos);
	return ret;
}

.glfwGetKey(key) ⇒ GLFW_PRESS/GLFW_RELEASE

Queries status of key ‘key’



349
350
351
352
353
354
355
356
357
# File 'ext/glfw/glfw.c', line 349

static VALUE glfw_GetKey(VALUE obj,VALUE arg1)
{
	int ret;
	if (TYPE(arg1)==T_STRING)
		ret = glfwGetKey(RSTRING_PTR(arg1)[0]);
	else
		ret = glfwGetKey(NUM2INT(arg1));
	return INT2NUM(ret);
}

.glfwGetMouseButton(button) ⇒ GLFW_PRESS/GLFW_RELEASE

Queries status of mouse button ‘button’



366
367
368
369
370
371
# File 'ext/glfw/glfw.c', line 366

static VALUE glfw_GetMouseButton(VALUE obj,VALUE arg1)
{
	int ret;
	ret = glfwGetMouseButton(NUM2INT(arg1));
	return INT2NUM(ret);
}

.glfwGetMousePosArray

Returns current mouse position

Returns:

  • (Array)


379
380
381
382
383
384
385
# File 'ext/glfw/glfw.c', line 379

static VALUE glfw_GetMousePos(VALUE obj)
{
	int xpos=0;
	int ypos=0;
	glfwGetMousePos(&xpos,&ypos);
	return rb_ary_new3(2,INT2NUM(xpos),INT2NUM(ypos));
}

.glfwGetMouseWheelObject

Returns current mouse wheel position



406
407
408
409
410
411
# File 'ext/glfw/glfw.c', line 406

static VALUE glfw_GetMouseWheel(VALUE obj)
{
	int ret;
	ret = glfwGetMouseWheel();
	return INT2NUM(ret);
}

.glfwGetNumberOfProcessorsFixnum

Returns current number of logical processors (or cores)

Returns:

  • (Fixnum)


796
797
798
799
800
801
# File 'ext/glfw/glfw.c', line 796

static VALUE glfw_GetNumberOfProcessors(VALUE obj)
{
	int ret;
	ret = glfwGetNumberOfProcessors();
	return INT2NUM(ret);
}

.glfwGetTimeFloat

Returns time (as Float) passed since last call to glfwInit or glfwSetTime

Returns:

  • (Float)


550
551
552
553
554
555
# File 'ext/glfw/glfw.c', line 550

static VALUE glfw_GetTime(VALUE obj)
{
	double time;
	time = glfwGetTime();
	return rb_float_new(time);
}

.glfwGetVersionArray

Returns GLFW library version

Returns:

  • (Array)


81
82
83
84
85
86
87
88
# File 'ext/glfw/glfw.c', line 81

static VALUE glfw_GetVersion(VALUE obj)
{
	int major = 0;
	int minor = 0;
	int rev = 0;
	glfwGetVersion(&major,&minor,&rev);
	return rb_ary_new3(3,INT2NUM(major),INT2NUM(minor),INT2NUM(rev));
}

.glfwGetVideoModesArray

Returns all supported video modes in form of array of instances of Vidmode class

Vidmode class has following attributes:

  • Width - screen width

  • Height - screen height

  • Redbits - number of bits per red channel

  • GreenBits - number of bits per green channel

  • BlueBits - number of bits per blue channel

BPP = Redbits + GreenBits + BlueBits

Returns:

  • (Array)


299
300
301
302
303
304
305
306
307
308
309
310
311
312
# File 'ext/glfw/glfw.c', line 299

static VALUE glfw_GetVideoModes(VALUE obj)
{
	GLFWvidmode modes[MAGIC];
	int count;
	int i;
	VALUE ret;

	count = glfwGetVideoModes(modes,MAGIC);
	ret = rb_ary_new2(count);
	for(i=0;i<count;++i)
		rb_ary_push(ret,vidmode_to_ruby(modes[i]));

	return ret;
}

.glfwGetWindowParam(param) ⇒ Fixnum

Returns value of window parameter ‘param’ , either as integer or boolean

Returns:

  • (Fixnum)


220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
# File 'ext/glfw/glfw.c', line 220

static VALUE glfw_GetWindowParam(VALUE obj,VALUE arg1)
{
	int param;
	int ret;
	param = NUM2INT(arg1);
	ret = glfwGetWindowParam(param);

	switch(param) {
		case GLFW_OPENED:
		case GLFW_ACTIVE:
		case GLFW_ICONIFIED:
		case GLFW_ACCELERATED:
		case GLFW_STEREO:
		case GLFW_WINDOW_NO_RESIZE:
			return GL_BOOL_TO_RUBY_BOOL(ret);
		default:
			return INT2NUM(ret);
	}
	/* not reached */
}

.glfwGetWindowSizeArray

Returns current window size

Returns:

  • (Array)


185
186
187
188
189
190
191
# File 'ext/glfw/glfw.c', line 185

static VALUE glfw_GetWindowSize(VALUE obj)
{
	int width=0;
	int height=0;
	glfwGetWindowSize(&width,&height);
	return rb_ary_new3(2,INT2NUM(width),INT2NUM(height));
}

.glfwIconifyWindowObject

.glfwInitObject

Initializes GLFW library. This function is called automatically on module load



61
62
63
64
65
# File 'ext/glfw/glfw.c', line 61

static VALUE glfw_Init(VALUE obj)
{
	/* no-op, initialized at module load */
	return Qtrue;
}

.glfwLoadMemoryTexture2D(string, flags) ⇒ Boolean

Reads raw image data from string and loads it as texture to current texturing unit

Returns:

  • (Boolean)


704
705
# File 'ext/glfw/glfw.c', line 704

static VALUE glfw_LoadMemoryTexture2D(obj,arg1,arg2)
VALUE obj,arg1,arg2;

.glfwLoadTexture2D(filename, flags) ⇒ Boolean

Reads image from file and loads it as texture to current texturing unit

Returns:

  • (Boolean)


689
690
# File 'ext/glfw/glfw.c', line 689

static VALUE glfw_LoadTexture2D(obj,arg1,arg2)
VALUE obj,arg1,arg2;

.glfwLoadTextureImage2D(GLFWimage, flags) ⇒ Boolean

Reads image from GLFWimage object and loads it as texture to current texturing unit

Returns:

  • (Boolean)


719
720
# File 'ext/glfw/glfw.c', line 719

static VALUE glfw_LoadTextureImage2D(obj,arg1,arg2)
VALUE obj,arg1,arg2;

.glfwOpenWindow(width, height, redbits, greenbits, bluebits, alphabits, depthbits, stencilbits, mode) ⇒ Object

Opens GLFW window, returns true on success



98
99
# File 'ext/glfw/glfw.c', line 98

static VALUE glfw_OpenWindow(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9)
VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9;

.glfwOpenWindowHint(target, hint) ⇒ Object

Sets additional properties for yet to be opened window



114
115
# File 'ext/glfw/glfw.c', line 114

static VALUE glfw_OpenWindowHint(obj,arg1,arg2)
VALUE obj,arg1,arg2;

.glfwPollEventsObject

Polls events



330
331
332
333
334
# File 'ext/glfw/glfw.c', line 330

static VALUE glfw_PollEvents(VALUE obj)
{
	glfwPollEvents();
	return Qnil;
}

.glfwReadImage(filename, flags) ⇒ GLFWimage?

Reads image from file and stores it as GLFWimage object

Returns:



631
632
# File 'ext/glfw/glfw.c', line 631

static VALUE glfw_ReadImage(obj,arg1,arg2)
VALUE obj,arg1,arg2;

.glfwReadMemoryImage(string, flags) ⇒ GLFWimage?

Reads image from string (containing raw image data) and stores it as GLFWimage object

Returns:



653
654
# File 'ext/glfw/glfw.c', line 653

static VALUE glfw_ReadMemoryImage(obj,arg1,arg2)
VALUE obj,arg1,arg2;

.glfwRestoreWindowObject

Restores window



208
209
210
211
212
# File 'ext/glfw/glfw.c', line 208

static VALUE glfw_RestoreWindow(VALUE obj)
{
	glfwRestoreWindow();
	return Qnil;
}

.glfwSetCharCallbackObject

.glfwSetKeyCallbackObject

.glfwSetMouseButtonCallbackObject

.glfwSetMousePos(xpos, ypos) ⇒ Object

Sets mouse position



393
394
# File 'ext/glfw/glfw.c', line 393

static VALUE glfw_SetMousePos(obj,arg1,arg2)
VALUE obj,arg1,arg2;

.glfwSetMousePosCallbackObject

.glfwSetMouseWheelPos(wheelpos) ⇒ Object

Sets mouse wheel position



419
420
421
422
423
# File 'ext/glfw/glfw.c', line 419

static VALUE glfw_SetMouseWheel(VALUE obj,VALUE arg1)
{
	glfwSetMouseWheel(NUM2INT(arg1));
	return Qnil;
}

.glfwSetMouseWheelCallbackObject

.glfwSetTime(time) ⇒ Object

Sets timer to given time (Float)



563
564
565
566
567
# File 'ext/glfw/glfw.c', line 563

static VALUE glfw_SetTime(VALUE obj,VALUE arg1)
{
	glfwSetTime(NUM2DBL(arg1));
	return Qnil;
}

.glfwSetWindowCloseCallbackObject



812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
# File 'ext/glfw/glfw.c', line 812

VALUE glfw_SetWindowCloseCallback()
/*
 * call-seq:
 *  glfwSetWindowSizeCallback( Proc(width,height) )
 *
 * Sets function to be executed at window size change. The supplied function takes two arguments,
 * representing new width and height of the window 
 */
VALUE glfw_SetWindowSizeCallback()
/*
 * call-seq:
 *  glfwSetWindowRefreshCallback( Proc() )
 *
 * Sets function to be executed at window refresh. The supplied function takes no arguments.
 */
VALUE glfw_SetWindowRefreshCallback()
/*
 * call-seq:
 *  glfwSetKeyCallback( Proc(key,action) )
 *
 * Sets function to be executed at key press or release. The supplied function takes two arguments,
 * key and action, where action is either GLFW_PRESS or GLFW_RELEASE
 */
VALUE glfw_SetKeyCallback()
/*
 * call-seq:
 *  glfwSetCharCallback( Proc(char,action) )
 *
 * Sets function to be executed every time printable character is generated by the keyboard.
 * The supplied function takes two arguments, char and action, where char is unicode character,
 * and action is either GLFW_PRESS or GLFW_RELEASE
 */
VALUE glfw_SetCharCallback()
/*
 * call-seq:
 *  glfwSetMouseButtonCallback( Proc(button,action) )
 *
 * Sets function to be executed at mouse button press or release. The supplied function takes two
 * arguments, button and action, where action is either GLFW_PRESS or GLFW_RELEASE
 */
VALUE glfw_SetMouseButtonCallback()
/*
 * call-seq:
 *  glfwSetMousePosCallback( Proc(xpos,ypos) )
 *
 * Sets function to be executed at mouse movement. The supplied function takes two arguments,
 * representing the new mouse coordinates x and y
 */
VALUE glfw_SetMousePosCallback()
/*
 * call-seq:
 *  glfwSetMouseWheelCallback( Proc(wheelpos) )
 *
 * Sets function to be executed at mouse wheel movement. The supplied function takes one argument
 * representing the new mouse wheel position
 */
VALUE glfw_SetMouseWheelCallback()
#endif

DLLEXPORT void Init_glfw()
{
	/* Let's initialize the GLFW library at module load */
	if (glfwInit()!=GL_TRUE) {
	  rb_raise(rb_eRuntimeError, "GLFW library initialization failed");
		/* not reached */
	}
	
	/* Glfw module - this module contains all functions and constants in the GLFW bindings */
	module = rb_define_module("Glfw");

	call_id = rb_intern("call");

	/*
	  GLFWimage is class which instances contains image loaded by GLFW imaging API.

	  Image data can be manually freed by calling glfwFreeImage(object)
	*/
	GLFWimage_class = rb_define_class("GLFWimage", rb_cObject);
	rb_define_method(GLFWimage_class, "Width", GLFWimage_width, 0);
	rb_define_method(GLFWimage_class, "Height", GLFWimage_height, 0);
	rb_define_method(GLFWimage_class, "Format", GLFWimage_format, 0);
	rb_define_method(GLFWimage_class, "BytesPerPixel", GLFWimage_BPP, 0);

	/* register Vidmode struct class to garbage collector */
	rb_gc_register_address(&Vidmode_class);

	/* register callback handlers to garbage collector */
	rb_gc_register_address(&WindowClose_cb_ruby_func);
	rb_gc_register_address(&WindowSize_cb_ruby_func);
	rb_gc_register_address(&WindowRefresh_cb_ruby_func);
	rb_gc_register_address(&Key_cb_ruby_func);
	rb_gc_register_address(&Char_cb_ruby_func);
	rb_gc_register_address(&MouseButton_cb_ruby_func);
	rb_gc_register_address(&MousePos_cb_ruby_func);
	rb_gc_register_address(&MouseWheel_cb_ruby_func);

	rb_global_variable(&window_title);

	/* functions */
	rb_define_module_function(module,"glfwInit", glfw_Init, 0);
	rb_define_module_function(module,"glfwTerminate", glfw_Terminate, 0);
	rb_define_module_function(module,"glfwGetVersion", glfw_GetVersion, 0);

	rb_define_module_function(module,"glfwOpenWindow", glfw_OpenWindow, 9);
	rb_define_module_function(module,"glfwOpenWindowHint", glfw_OpenWindowHint, 2);
	rb_define_module_function(module,"glfwCloseWindow", glfw_CloseWindow, 0);
	rb_define_module_function(module,"glfwSetWindowCloseCallback", glfw_SetWindowCloseCallback, 1);
	rb_define_module_function(module,"glfwSetWindowTitle", glfw_SetWindowTitle, 1);
	rb_define_module_function(module,"glfwSetWindowSize", glfw_SetWindowSize, 2);
	rb_define_module_function(module,"glfwSetWindowPos", glfw_SetWindowPos, 2);
	rb_define_module_function(module,"glfwGetWindowSize", glfw_GetWindowSize, 0);
	rb_define_module_function(module,"glfwSetWindowSizeCallback", glfw_SetWindowSizeCallback, 1);
	rb_define_module_function(module,"glfwIconifyWindow", glfw_IconifyWindow, 0);
	rb_define_module_function(module,"glfwRestoreWindow", glfw_RestoreWindow, 0);
	rb_define_module_function(module,"glfwGetWindowParam", glfw_GetWindowParam, 1);
	rb_define_module_function(module,"glfwSwapBuffers", glfw_SwapBuffers, 0);
	rb_define_module_function(module,"glfwSwapInterval", glfw_SwapInterval, 1);
	rb_define_module_function(module,"glfwSetWindowRefreshCallback", glfw_SetWindowRefreshCallback, 1);

	rb_define_module_function(module,"glfwGetVideoModes", glfw_GetVideoModes, 0);
	rb_define_module_function(module,"glfwGetDesktopMode", glfw_GetDesktopMode, 0);

	rb_define_module_function(module,"glfwPollEvents", glfw_PollEvents, 0);
	rb_define_module_function(module,"glfwWaitEvents", glfw_WaitEvents, 0);
	rb_define_module_function(module,"glfwGetKey", glfw_GetKey, 1);
	rb_define_module_function(module,"glfwGetMouseButton", glfw_GetMouseButton, 1);
	rb_define_module_function(module,"glfwGetMousePos", glfw_GetMousePos, 0);
	rb_define_module_function(module,"glfwSetMousePos", glfw_SetMousePos, 2);
	rb_define_module_function(module,"glfwGetMouseWheel", glfw_GetMouseWheel, 0);
	rb_define_module_function(module,"glfwSetMouseWheel", glfw_SetMouseWheel, 1);
	rb_define_module_function(module,"glfwSetKeyCallback", glfw_SetKeyCallback, 1);
	rb_define_module_function(module,"glfwSetCharCallback", glfw_SetCharCallback, 1);
	rb_define_module_function(module,"glfwSetMouseButtonCallback", glfw_SetMouseButtonCallback, 1);
	rb_define_module_function(module,"glfwSetMousePosCallback", glfw_SetMousePosCallback, 1);
	rb_define_module_function(module,"glfwSetMouseWheelCallback", glfw_SetMouseWheelCallback, 1);
	rb_define_module_function(module,"glfwGetJoystickParam", glfw_GetJoystickParam, 2);
	rb_define_module_function(module,"glfwGetJoystickPos", glfw_GetJoystickPos, 1);
	rb_define_module_function(module,"glfwGetJoystickButtons", glfw_GetJoystickButtons, 1);

	rb_define_module_function(module,"glfwGetTime", glfw_GetTime, 0);
	rb_define_module_function(module,"glfwSetTime", glfw_SetTime, 1);
	rb_define_module_function(module,"glfwSleep", glfw_Sleep, 1);

	rb_define_module_function(module,"glfwReadImage", glfw_ReadImage, 2);
	rb_define_module_function(module,"glfwReadMemoryImage", glfw_ReadMemoryImage, 2);
	rb_define_module_function(module,"glfwFreeImage", glfw_FreeImage, 1);
	rb_define_module_function(module,"glfwLoadTexture2D", glfw_LoadTexture2D, 2);
	rb_define_module_function(module,"glfwLoadMemoryTexture2D", glfw_LoadMemoryTexture2D, 2);
	rb_define_module_function(module,"glfwLoadTextureImage2D", glfw_LoadTextureImage2D, 2);

	rb_define_module_function(module,"glfwExtensionSupported", glfw_ExtensionSupported, 1);
	rb_define_module_function(module,"glfwGetGLVersion", glfw_GetGLVersion, 0);
	rb_define_module_function(module,"glfwEnable", glfw_Enable, 1);
	rb_define_module_function(module,"glfwDisable", glfw_Disable, 1);
	rb_define_module_function(module,"glfwGetNumberOfProcessors", glfw_GetNumberOfProcessors, 0);

	/* constants */

	/* for compatibility between ruby versuins - 1.8 => 32	, 1.9 => " " */
	rb_define_const(module, "GLFW_KEY_SPACE",  rb_eval_string("?\\s"));

	rb_define_const(module, "GLFW_VERSION_MAJOR", INT2NUM(GLFW_VERSION_MAJOR));
	rb_define_const(module, "GLFW_VERSION_MINOR", INT2NUM(GLFW_VERSION_MINOR));
	rb_define_const(module, "GLFW_VERSION_REVISION", INT2NUM(GLFW_VERSION_REVISION));
	rb_define_const(module, "GLFW_RELEASE", INT2NUM(GLFW_RELEASE));
	rb_define_const(module, "GLFW_PRESS", INT2NUM(GLFW_PRESS));
	rb_define_const(module, "GLFW_KEY_UNKNOWN", INT2NUM(GLFW_KEY_UNKNOWN));
	rb_define_const(module, "GLFW_KEY_SPECIAL", INT2NUM(GLFW_KEY_SPECIAL));
	rb_define_const(module, "GLFW_KEY_ESC", INT2NUM(GLFW_KEY_ESC));
	rb_define_const(module, "GLFW_KEY_F1", INT2NUM(GLFW_KEY_F1));
	rb_define_const(module, "GLFW_KEY_F2", INT2NUM(GLFW_KEY_F2));
	rb_define_const(module, "GLFW_KEY_F3", INT2NUM(GLFW_KEY_F3));
	rb_define_const(module, "GLFW_KEY_F4", INT2NUM(GLFW_KEY_F4));
	rb_define_const(module, "GLFW_KEY_F5", INT2NUM(GLFW_KEY_F5));
	rb_define_const(module, "GLFW_KEY_F6", INT2NUM(GLFW_KEY_F6));
	rb_define_const(module, "GLFW_KEY_F7", INT2NUM(GLFW_KEY_F7));
	rb_define_const(module, "GLFW_KEY_F8", INT2NUM(GLFW_KEY_F8));
	rb_define_const(module, "GLFW_KEY_F9", INT2NUM(GLFW_KEY_F9));
	rb_define_const(module, "GLFW_KEY_F10", INT2NUM(GLFW_KEY_F10));
	rb_define_const(module, "GLFW_KEY_F11", INT2NUM(GLFW_KEY_F11));
	rb_define_const(module, "GLFW_KEY_F12", INT2NUM(GLFW_KEY_F12));
	rb_define_const(module, "GLFW_KEY_F13", INT2NUM(GLFW_KEY_F13));
	rb_define_const(module, "GLFW_KEY_F14", INT2NUM(GLFW_KEY_F14));
	rb_define_const(module, "GLFW_KEY_F15", INT2NUM(GLFW_KEY_F15));
	rb_define_const(module, "GLFW_KEY_F16", INT2NUM(GLFW_KEY_F16));
	rb_define_const(module, "GLFW_KEY_F17", INT2NUM(GLFW_KEY_F17));
	rb_define_const(module, "GLFW_KEY_F18", INT2NUM(GLFW_KEY_F18));
	rb_define_const(module, "GLFW_KEY_F19", INT2NUM(GLFW_KEY_F19));
	rb_define_const(module, "GLFW_KEY_F20", INT2NUM(GLFW_KEY_F20));
	rb_define_const(module, "GLFW_KEY_F21", INT2NUM(GLFW_KEY_F21));
	rb_define_const(module, "GLFW_KEY_F22", INT2NUM(GLFW_KEY_F22));
	rb_define_const(module, "GLFW_KEY_F23", INT2NUM(GLFW_KEY_F23));
	rb_define_const(module, "GLFW_KEY_F24", INT2NUM(GLFW_KEY_F24));
	rb_define_const(module, "GLFW_KEY_F25", INT2NUM(GLFW_KEY_F25));
	rb_define_const(module, "GLFW_KEY_UP", INT2NUM(GLFW_KEY_UP));
	rb_define_const(module, "GLFW_KEY_DOWN", INT2NUM(GLFW_KEY_DOWN));
	rb_define_const(module, "GLFW_KEY_LEFT", INT2NUM(GLFW_KEY_LEFT));
	rb_define_const(module, "GLFW_KEY_RIGHT", INT2NUM(GLFW_KEY_RIGHT));
	rb_define_const(module, "GLFW_KEY_LSHIFT", INT2NUM(GLFW_KEY_LSHIFT));
	rb_define_const(module, "GLFW_KEY_RSHIFT", INT2NUM(GLFW_KEY_RSHIFT));
	rb_define_const(module, "GLFW_KEY_LCTRL", INT2NUM(GLFW_KEY_LCTRL));
	rb_define_const(module, "GLFW_KEY_RCTRL", INT2NUM(GLFW_KEY_RCTRL));
	rb_define_const(module, "GLFW_KEY_LALT", INT2NUM(GLFW_KEY_LALT));
	rb_define_const(module, "GLFW_KEY_RALT", INT2NUM(GLFW_KEY_RALT));
	rb_define_const(module, "GLFW_KEY_TAB", INT2NUM(GLFW_KEY_TAB));
	rb_define_const(module, "GLFW_KEY_ENTER", INT2NUM(GLFW_KEY_ENTER));
	rb_define_const(module, "GLFW_KEY_BACKSPACE", INT2NUM(GLFW_KEY_BACKSPACE));
	rb_define_const(module, "GLFW_KEY_INSERT", INT2NUM(GLFW_KEY_INSERT));
	rb_define_const(module, "GLFW_KEY_DEL", INT2NUM(GLFW_KEY_DEL));
	rb_define_const(module, "GLFW_KEY_PAGEUP", INT2NUM(GLFW_KEY_PAGEUP));
	rb_define_const(module, "GLFW_KEY_PAGEDOWN", INT2NUM(GLFW_KEY_PAGEDOWN));
	rb_define_const(module, "GLFW_KEY_HOME", INT2NUM(GLFW_KEY_HOME));
	rb_define_const(module, "GLFW_KEY_END", INT2NUM(GLFW_KEY_END));
	rb_define_const(module, "GLFW_KEY_KP_0", INT2NUM(GLFW_KEY_KP_0));
	rb_define_const(module, "GLFW_KEY_KP_1", INT2NUM(GLFW_KEY_KP_1));
	rb_define_const(module, "GLFW_KEY_KP_2", INT2NUM(GLFW_KEY_KP_2));
	rb_define_const(module, "GLFW_KEY_KP_3", INT2NUM(GLFW_KEY_KP_3));
	rb_define_const(module, "GLFW_KEY_KP_4", INT2NUM(GLFW_KEY_KP_4));
	rb_define_const(module, "GLFW_KEY_KP_5", INT2NUM(GLFW_KEY_KP_5));
	rb_define_const(module, "GLFW_KEY_KP_6", INT2NUM(GLFW_KEY_KP_6));
	rb_define_const(module, "GLFW_KEY_KP_7", INT2NUM(GLFW_KEY_KP_7));
	rb_define_const(module, "GLFW_KEY_KP_8", INT2NUM(GLFW_KEY_KP_8));
	rb_define_const(module, "GLFW_KEY_KP_9", INT2NUM(GLFW_KEY_KP_9));
	rb_define_const(module, "GLFW_KEY_KP_DIVIDE", INT2NUM(GLFW_KEY_KP_DIVIDE));
	rb_define_const(module, "GLFW_KEY_KP_MULTIPLY", INT2NUM(GLFW_KEY_KP_MULTIPLY));
	rb_define_const(module, "GLFW_KEY_KP_SUBTRACT", INT2NUM(GLFW_KEY_KP_SUBTRACT));
	rb_define_const(module, "GLFW_KEY_KP_ADD", INT2NUM(GLFW_KEY_KP_ADD));
	rb_define_const(module, "GLFW_KEY_KP_DECIMAL", INT2NUM(GLFW_KEY_KP_DECIMAL));
	rb_define_const(module, "GLFW_KEY_KP_EQUAL", INT2NUM(GLFW_KEY_KP_EQUAL));
	rb_define_const(module, "GLFW_KEY_KP_ENTER", INT2NUM(GLFW_KEY_KP_ENTER));
	rb_define_const(module, "GLFW_KEY_LAST", INT2NUM(GLFW_KEY_LAST));
	rb_define_const(module, "GLFW_MOUSE_BUTTON_1", INT2NUM(GLFW_MOUSE_BUTTON_1));
	rb_define_const(module, "GLFW_MOUSE_BUTTON_2", INT2NUM(GLFW_MOUSE_BUTTON_2));
	rb_define_const(module, "GLFW_MOUSE_BUTTON_3", INT2NUM(GLFW_MOUSE_BUTTON_3));
	rb_define_const(module, "GLFW_MOUSE_BUTTON_4", INT2NUM(GLFW_MOUSE_BUTTON_4));
	rb_define_const(module, "GLFW_MOUSE_BUTTON_5", INT2NUM(GLFW_MOUSE_BUTTON_5));
	rb_define_const(module, "GLFW_MOUSE_BUTTON_6", INT2NUM(GLFW_MOUSE_BUTTON_6));
	rb_define_const(module, "GLFW_MOUSE_BUTTON_7", INT2NUM(GLFW_MOUSE_BUTTON_7));
	rb_define_const(module, "GLFW_MOUSE_BUTTON_8", INT2NUM(GLFW_MOUSE_BUTTON_8));
	rb_define_const(module, "GLFW_MOUSE_BUTTON_LAST", INT2NUM(GLFW_MOUSE_BUTTON_LAST));
	rb_define_const(module, "GLFW_MOUSE_BUTTON_LEFT", INT2NUM(GLFW_MOUSE_BUTTON_LEFT));
	rb_define_const(module, "GLFW_MOUSE_BUTTON_RIGHT", INT2NUM(GLFW_MOUSE_BUTTON_RIGHT));
	rb_define_const(module, "GLFW_MOUSE_BUTTON_MIDDLE", INT2NUM(GLFW_MOUSE_BUTTON_MIDDLE));
	rb_define_const(module, "GLFW_JOYSTICK_1", INT2NUM(GLFW_JOYSTICK_1));
	rb_define_const(module, "GLFW_JOYSTICK_2", INT2NUM(GLFW_JOYSTICK_2));
	rb_define_const(module, "GLFW_JOYSTICK_3", INT2NUM(GLFW_JOYSTICK_3));
	rb_define_const(module, "GLFW_JOYSTICK_4", INT2NUM(GLFW_JOYSTICK_4));
	rb_define_const(module, "GLFW_JOYSTICK_5", INT2NUM(GLFW_JOYSTICK_5));
	rb_define_const(module, "GLFW_JOYSTICK_6", INT2NUM(GLFW_JOYSTICK_6));
	rb_define_const(module, "GLFW_JOYSTICK_7", INT2NUM(GLFW_JOYSTICK_7));
	rb_define_const(module, "GLFW_JOYSTICK_8", INT2NUM(GLFW_JOYSTICK_8));
	rb_define_const(module, "GLFW_JOYSTICK_9", INT2NUM(GLFW_JOYSTICK_9));
	rb_define_const(module, "GLFW_JOYSTICK_10", INT2NUM(GLFW_JOYSTICK_10));
	rb_define_const(module, "GLFW_JOYSTICK_11", INT2NUM(GLFW_JOYSTICK_11));
	rb_define_const(module, "GLFW_JOYSTICK_12", INT2NUM(GLFW_JOYSTICK_12));
	rb_define_const(module, "GLFW_JOYSTICK_13", INT2NUM(GLFW_JOYSTICK_13));
	rb_define_const(module, "GLFW_JOYSTICK_14", INT2NUM(GLFW_JOYSTICK_14));
	rb_define_const(module, "GLFW_JOYSTICK_15", INT2NUM(GLFW_JOYSTICK_15));
	rb_define_const(module, "GLFW_JOYSTICK_16", INT2NUM(GLFW_JOYSTICK_16));
	rb_define_const(module, "GLFW_JOYSTICK_LAST", INT2NUM(GLFW_JOYSTICK_LAST));
	rb_define_const(module, "GLFW_WINDOW", INT2NUM(GLFW_WINDOW));
	rb_define_const(module, "GLFW_FULLSCREEN", INT2NUM(GLFW_FULLSCREEN));
	rb_define_const(module, "GLFW_OPENED", INT2NUM(GLFW_OPENED));
	rb_define_const(module, "GLFW_ACTIVE", INT2NUM(GLFW_ACTIVE));
	rb_define_const(module, "GLFW_ICONIFIED", INT2NUM(GLFW_ICONIFIED));
	rb_define_const(module, "GLFW_ACCELERATED", INT2NUM(GLFW_ACCELERATED));
	rb_define_const(module, "GLFW_RED_BITS", INT2NUM(GLFW_RED_BITS));
	rb_define_const(module, "GLFW_GREEN_BITS", INT2NUM(GLFW_GREEN_BITS));
	rb_define_const(module, "GLFW_BLUE_BITS", INT2NUM(GLFW_BLUE_BITS));
	rb_define_const(module, "GLFW_ALPHA_BITS", INT2NUM(GLFW_ALPHA_BITS));
	rb_define_const(module, "GLFW_DEPTH_BITS", INT2NUM(GLFW_DEPTH_BITS));
	rb_define_const(module, "GLFW_STENCIL_BITS", INT2NUM(GLFW_STENCIL_BITS));
	rb_define_const(module, "GLFW_REFRESH_RATE", INT2NUM(GLFW_REFRESH_RATE));
	rb_define_const(module, "GLFW_ACCUM_RED_BITS", INT2NUM(GLFW_ACCUM_RED_BITS));
	rb_define_const(module, "GLFW_ACCUM_GREEN_BITS", INT2NUM(GLFW_ACCUM_GREEN_BITS));
	rb_define_const(module, "GLFW_ACCUM_BLUE_BITS", INT2NUM(GLFW_ACCUM_BLUE_BITS));
	rb_define_const(module, "GLFW_ACCUM_ALPHA_BITS", INT2NUM(GLFW_ACCUM_ALPHA_BITS));
	rb_define_const(module, "GLFW_AUX_BUFFERS", INT2NUM(GLFW_AUX_BUFFERS));
	rb_define_const(module, "GLFW_STEREO", INT2NUM(GLFW_STEREO));
	rb_define_const(module, "GLFW_WINDOW_NO_RESIZE", INT2NUM(GLFW_WINDOW_NO_RESIZE));
	rb_define_const(module, "GLFW_FSAA_SAMPLES", INT2NUM(GLFW_FSAA_SAMPLES));
	rb_define_const(module, "GLFW_MOUSE_CURSOR", INT2NUM(GLFW_MOUSE_CURSOR));
	rb_define_const(module, "GLFW_STICKY_KEYS", INT2NUM(GLFW_STICKY_KEYS));
	rb_define_const(module, "GLFW_STICKY_MOUSE_BUTTONS", INT2NUM(GLFW_STICKY_MOUSE_BUTTONS));
	rb_define_const(module, "GLFW_SYSTEM_KEYS", INT2NUM(GLFW_SYSTEM_KEYS));
	rb_define_const(module, "GLFW_KEY_REPEAT", INT2NUM(GLFW_KEY_REPEAT));
	rb_define_const(module, "GLFW_AUTO_POLL_EVENTS", INT2NUM(GLFW_AUTO_POLL_EVENTS));
	rb_define_const(module, "GLFW_WAIT", INT2NUM(GLFW_WAIT));
	rb_define_const(module, "GLFW_NOWAIT", INT2NUM(GLFW_NOWAIT));
	rb_define_const(module, "GLFW_PRESENT", INT2NUM(GLFW_PRESENT));
	rb_define_const(module, "GLFW_AXES", INT2NUM(GLFW_AXES));
	rb_define_const(module, "GLFW_BUTTONS", INT2NUM(GLFW_BUTTONS));
	rb_define_const(module, "GLFW_NO_RESCALE_BIT", INT2NUM(GLFW_NO_RESCALE_BIT));
	rb_define_const(module, "GLFW_ORIGIN_UL_BIT", INT2NUM(GLFW_ORIGIN_UL_BIT));
	rb_define_const(module, "GLFW_BUILD_MIPMAPS_BIT", INT2NUM(GLFW_BUILD_MIPMAPS_BIT));
	rb_define_const(module, "GLFW_ALPHA_MAP_BIT", INT2NUM(GLFW_ALPHA_MAP_BIT));
	rb_define_const(module, "GLFW_INFINITY", INT2NUM(GLFW_INFINITY));

	/* calls Glfw.glfwTerminate() at ruby exit */
	rb_set_end_proc((void *)glfw_Terminate,Qnil);
}

.glfwSetWindowPos(x, y) ⇒ Object

Sets window position



172
173
# File 'ext/glfw/glfw.c', line 172

static VALUE glfw_SetWindowPos(obj,arg1,arg2)
VALUE obj,arg1,arg2;

.glfwSetWindowRefreshCallbackObject

.glfwSetWindowSize(width, height) ⇒ Object

Sets window size



159
160
# File 'ext/glfw/glfw.c', line 159

static VALUE glfw_SetWindowSize(obj,arg1,arg2)
VALUE obj,arg1,arg2;

.glfwSetWindowSizeCallbackObject

.glfwSetWindowTitleObject



144
145
# File 'ext/glfw/glfw.c', line 144

static VALUE glfw_SetWindowTitle(obj,arg1)
VALUE obj,arg1;

.glfwSleep(time) ⇒ Object

Sleeps for given amount of time (Float)



575
576
577
578
579
# File 'ext/glfw/glfw.c', line 575

static VALUE glfw_Sleep(VALUE obj,VALUE arg1)
{
	glfwSleep(NUM2DBL(arg1));
	return Qnil;
}

.glfwSwapBuffersObject

Swaps OpenGL buffers in double-buffering mode



242
243
244
245
246
# File 'ext/glfw/glfw.c', line 242

static VALUE glfw_SwapBuffers(VALUE obj)
{
	glfwSwapBuffers();
	return Qnil;
}

.glfwSwapInterval(interval) ⇒ Object

Sets minimal number of monitor frame retraces before buffers can be swapped (a.k.a Vertical sync), 0 = off



254
255
256
257
258
# File 'ext/glfw/glfw.c', line 254

static VALUE glfw_SwapInterval(VALUE obj,VALUE arg1)
{
	glfwSwapInterval(NUM2INT(arg1));
	return Qnil;
}

.glfwTerminateObject

Terminates GLFW library. This function is called automatically on program exit



69
70
71
72
73
# File 'ext/glfw/glfw.c', line 69

static VALUE glfw_Terminate(VALUE obj)
{
	glfwTerminate();
	return Qnil;
}

.glfwWaitEventsObject

Waits for events



337
338
339
340
341
# File 'ext/glfw/glfw.c', line 337

static VALUE glfw_WaitEvents(VALUE obj)
{
	glfwWaitEvents();
	return Qnil;
}