Class: Glfw::Window

Inherits:
Object
  • Object
show all
Defined in:
lib/glfw3/window.rb,
ext/glfw3/glfw3.c

Overview

A GLFW window. These contain a context, optionally one shared with other windows and generate events. Each window maintains its own event callbacks.

Wraps GLFWwindow and its associated functions, for the most part.

Event Callbacks

All window event callbacks’ first argument is the window that generated the event. These event callbacks all receive the same arguments as their GLFW C counterparts, so refer to the GLFW 3 documentation for that.

User Data

If you need to associate a particular object or value with a window, you can use its #user_data attribute to store and retreive an arbitrary object for the window. If you need to store multiple values with the window, you might set its user data object to a Hash.

Defined Under Namespace

Classes: InternalWindow

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#user_dataObject

User data attribute, can be set to any arbitrary object. Used to associate any object with the window for later retrieval.



34
35
36
# File 'lib/glfw3/window.rb', line 34

def user_data
  @user_data
end

Class Method Details

.current_contextObject

Gets the window for the current GL context in this thread.

call-seq:

current_context() -> Glfw::Window

Wraps glfwGetCurrentContext.



1468
1469
1470
1471
# File 'ext/glfw3/glfw3.c', line 1468

static VALUE rb_window_get_current_context(VALUE self)
{
  return rb_lookup_window(glfwGetCurrentContext());
}

.default_window_hintsObject

Sets the window hints to their default values. See GLFW 3 documentation for details on what those values are.

call-seq:

default_window_hints() -> self

Wraps glfwDefaultWindowHints.



559
560
561
562
563
# File 'ext/glfw3/glfw3.c', line 559

static VALUE rb_window_default_window_hints(VALUE self)
{
  glfwDefaultWindowHints();
  return self;
}

.new(*args) ⇒ Object

Creates a new window with the given parameters. If a shared window is provided, the new window will use the context of the shared window.

If GLFW fails to create the window or an error occurred, this function will return nil.

call-seq:

new(width, height, title='', monitor=nil, shared_window=nil) -> Glfw::Window or nil

Wraps glfwCreateWindow.



620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
# File 'ext/glfw3/glfw3.c', line 620

static VALUE rb_window_new(int argc, VALUE *argv, VALUE self)
{
  ID ivar_window = kRB_IVAR_WINDOW_INTERNAL;
  VALUE rb_width, rb_height, rb_title, rb_monitor, rb_share;
  VALUE rb_window;
  VALUE rb_window_data;
  VALUE rb_windows;
  GLFWwindow *window = NULL;
  int width, height;
  const char *title = "";
  GLFWmonitor *monitor = NULL;
  GLFWwindow *share = NULL;

  /* Grab arguments */
  rb_scan_args(argc, argv, "23", &rb_width, &rb_height, &rb_title, &rb_monitor, &rb_share);

  width = NUM2INT(rb_width);
  height = NUM2INT(rb_height);

  if (RTEST(rb_title)) {
    if (rb_type(rb_title) != T_STRING) {
      rb_title = rb_any_to_s(rb_title);
    }
    title = StringValueCStr(rb_title);
  }

  if (Q_IS_A(rb_monitor, s_glfw_monitor_klass)) {
    Data_Get_Struct(rb_monitor, GLFWmonitor, monitor);
  }

  if (Q_IS_A(rb_share, s_glfw_window_klass)) {
    VALUE rb_shared_window = rb_ivar_get(rb_share, ivar_window);
    Data_Get_Struct(rb_shared_window, GLFWwindow, share);
  }

  /* Create GLFW window */
  window = glfwCreateWindow(width, height, title, monitor, share);
  if (window == NULL) {
    return Qnil;
  }

  /* Allocate the window wrapper (only used to store the window pointer) */
  rb_window_data = Data_Wrap_Struct(s_glfw_window_internal_klass, 0, 0, window);
  rb_obj_call_init(rb_window_data, 0, 0);

  /* Allocate the window */
  rb_window = rb_obj_alloc(s_glfw_window_klass);

  rb_ivar_set(rb_window, ivar_window, rb_window_data);
  rb_ivar_set(rb_window, kRB_IVAR_WINDOW_KEY_CALLBACK, Qnil);
  rb_ivar_set(rb_window, kRB_IVAR_WINDOW_CHAR_CALLBACK, Qnil);
  rb_ivar_set(rb_window, kRB_IVAR_WINDOW_MOUSE_BUTTON_CALLBACK, Qnil);
  rb_ivar_set(rb_window, kRB_IVAR_WINDOW_CURSOR_POSITION_CALLBACK, Qnil);
  rb_ivar_set(rb_window, kRB_IVAR_WINDOW_CURSOR_ENTER_CALLBACK, Qnil);
  rb_ivar_set(rb_window, kRB_IVAR_WINDOW_SCROLL_CALLBACK, Qnil);
  rb_ivar_set(rb_window, kRB_IVAR_WINDOW_POSITION_CALLBACK, Qnil);
  rb_ivar_set(rb_window, kRB_IVAR_WINDOW_SIZE_CALLBACK, Qnil);
  rb_ivar_set(rb_window, kRB_IVAR_WINDOW_CLOSE_CALLBACK, Qnil);
  rb_ivar_set(rb_window, kRB_IVAR_WINDOW_REFRESH_CALLBACK, Qnil);
  rb_ivar_set(rb_window, kRB_IVAR_WINDOW_FOCUS_CALLBACK, Qnil);
  rb_ivar_set(rb_window, kRB_IVAR_WINDOW_ICONIFY_CALLBACK, Qnil);
  rb_ivar_set(rb_window, kRB_IVAR_WINDOW_FRAMEBUFFER_SIZE_CALLBACK, Qnil);

  glfwSetWindowUserPointer(window, (void *)rb_window);
  rb_obj_call_init(rb_window, 0, 0);

  /* Store the window so it can't go out of scope until explicitly destroyed. */
  rb_windows = rb_cvar_get(self, kRB_CVAR_WINDOW_WINDOWS);
  rb_hash_aset(rb_windows, INT2FIX((int)window), rb_window);

  return rb_window;
}

.unset_contextObject

Unsets the current GL context.

Wraps glfwMakeContextCurrent(NULL).



1452
1453
1454
1455
1456
# File 'ext/glfw3/glfw3.c', line 1452

static VALUE rb_window_unset_context(VALUE self)
{
  glfwMakeContextCurrent(NULL);
  return self;
}

.window_hint(target, hint) ⇒ Object

Sets a window hint to the given value.

call-seq:

window_hint(target, hint) -> self

Wraps glfwWindowHint.



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

static VALUE rb_window_window_hint(VALUE self, VALUE target, VALUE hint)
{
  glfwWindowHint(NUM2INT(target), NUM2INT(hint));
  return self;
}

.windowsObject

Returns an array of all allocated GLFW windows.

call-seq:

windows -> [Glfw::Window, ...]


67
68
69
# File 'lib/glfw3/window.rb', line 67

def self.windows
  @@__windows.values
end

Instance Method Details

#char_callback=(func) ⇒ Object



108
109
110
111
# File 'lib/glfw3/window.rb', line 108

def char_callback=(func)
  @__char_callback = func
  set_char_callback__(func.respond_to?(:call))
end

#clipboard_stringObject

Gets the system clipboard’s contents as a string. The window this is called from will request the clipboard contents.

call-seq:

clipboard_string() -> String

Wraps glfwGetClipboardString.



1380
1381
1382
1383
# File 'ext/glfw3/glfw3.c', line 1380

static VALUE rb_window_get_clipboard_string(VALUE self)
{
  return rb_str_new2(glfwGetClipboardString(rb_get_window(self)));
}

#clipboard_string=(string) ⇒ Object

Sets the system clipboard string. The window this is set for will own the given string.

call-seq:

clipboard_string=(string) -> String
clipboard_string = string -> String

Wraps glfwSetClipboardString.



1363
1364
1365
1366
1367
# File 'ext/glfw3/glfw3.c', line 1363

static VALUE rb_window_set_clipboard_string(VALUE self, VALUE string)
{
  glfwSetClipboardString(rb_get_window(self), StringValueCStr(string));
  return string;
}

#close_callback=(func) ⇒ Object



171
172
173
174
# File 'lib/glfw3/window.rb', line 171

def close_callback=(func)
  @__close_callback = func
  set_close_callback__(func.respond_to?(:call))
end

#cursor_enter_callback=(func) ⇒ Object



135
136
137
138
# File 'lib/glfw3/window.rb', line 135

def cursor_enter_callback=(func)
  @__cursor_enter_callback = func
  set_cursor_enter_callback__(func.respond_to?(:call))
end

#cursor_pos=(xy) ⇒ Object



43
44
45
# File 'lib/glfw3/window.rb', line 43

def cursor_pos=(xy)
  set_cursor_pos(*xy)
end

#cursor_position_callback=(func) ⇒ Object



126
127
128
129
# File 'lib/glfw3/window.rb', line 126

def cursor_position_callback=(func)
  @__cursor_position_callback = func
  set_cursor_position_callback__(func.respond_to?(:call))
end

#destroyObject

Destroys the window.

Wraps glfwDestroyWindow.



700
701
702
703
704
705
706
707
708
709
710
711
# File 'ext/glfw3/glfw3.c', line 700

static VALUE rb_window_destroy(VALUE self)
{
  VALUE rb_windows = Qnil;
  GLFWwindow *window = rb_get_window(self);
  if (window) {
    glfwDestroyWindow(window);
    rb_ivar_set(self, kRB_IVAR_WINDOW_INTERNAL, Qnil);
    rb_windows = rb_cvar_get(s_glfw_window_klass, kRB_CVAR_WINDOW_WINDOWS);
    rb_hash_delete(rb_windows, INT2FIX((int)window));
  }
  return self;
}

#focus_callback=(func) ⇒ Object



189
190
191
192
# File 'lib/glfw3/window.rb', line 189

def focus_callback=(func)
  @__focus_callback = func
  set_focus_callback__(func.respond_to?(:call))
end

#framebuffer_sizeObject

Gets the window context’s framebuffer size.

call-seq:

framebuffer_size -> [width, height]

Wraps glfwGetFramebufferSize.



846
847
848
849
850
851
852
# File 'ext/glfw3/glfw3.c', line 846

static VALUE rb_window_get_framebuffer_size(VALUE self)
{
  int width = 0;
  int height = 0;
  glfwGetFramebufferSize(rb_get_window(self), &width, &height);
  return rb_ary_new3(2, INT2FIX(width), INT2FIX(height));
}

#framebuffer_size_callback=(func) ⇒ Object



207
208
209
210
# File 'lib/glfw3/window.rb', line 207

def framebuffer_size_callback=(func)
  @__framebuffer_size_callback = func
  set_fbsize_callback__(func.respond_to?(:call))
end

#get_cursor_posObject Also known as: cursor_pos

Gets the last-reported cursor position in the window.

call-seq:

cursor_pos -> [x, y]

Wraps glfwGetCursorPos.



1146
1147
1148
1149
1150
1151
1152
# File 'ext/glfw3/glfw3.c', line 1146

static VALUE rb_window_get_cursor_pos(VALUE self)
{
  double xpos = 0;
  double ypos = 0;
  glfwGetCursorPos(rb_get_window(self), &xpos, &ypos);
  return rb_ary_new3(2, rb_float_new(xpos), rb_float_new(ypos));
}

#get_input_mode(mode) ⇒ Object

Gets the current value for the given input mode.

call-seq:

get_input_mode(mode) -> Fixed

Wraps glfwGetInputMode.



1085
1086
1087
1088
# File 'ext/glfw3/glfw3.c', line 1085

static VALUE rb_window_get_input_mode(VALUE self, VALUE mode)
{
  return INT2FIX(glfwGetInputMode(rb_get_window(self), NUM2INT(mode)));
}

#get_positionObject Also known as: position

Gets the windows position.

call-seq:

position -> [x, y]

Wraps glfwGetWindowPos.



776
777
778
779
780
781
782
# File 'ext/glfw3/glfw3.c', line 776

static VALUE rb_window_get_position(VALUE self)
{
  int xpos = 0;
  int ypos = 0;
  glfwGetWindowPos(rb_get_window(self), &xpos, &ypos);
  return rb_ary_new3(2, INT2FIX(xpos), INT2FIX(ypos));
}

#get_should_closeObject Also known as: should_close?

Gets the window’s should-close flag.

call-seq:

should_close? -> true or false

Wraps glfwWindowShouldClose.



723
724
725
726
727
# File 'ext/glfw3/glfw3.c', line 723

static VALUE rb_window_should_close(VALUE self)
{
  GLFWwindow *window = rb_get_window(self);
  return glfwWindowShouldClose(window) ? Qtrue : Qfalse;
}

#get_sizeObject Also known as: size

Gets the window’s size.

call-seq:

size -> [width, height]

Wraps glfwGetWindowSize.



811
812
813
814
815
816
817
# File 'ext/glfw3/glfw3.c', line 811

static VALUE rb_window_get_size(VALUE self)
{
  int width = 0;
  int height = 0;
  glfwGetWindowSize(rb_get_window(self), &width, &height);
  return rb_ary_new3(2, INT2FIX(width), INT2FIX(height));
}

#heightObject

Gets the width of the window. See also #size.



95
96
97
# File 'lib/glfw3/window.rb', line 95

def height
  size[1]
end

#hideObject

Hides the window.

Wraps glfwHideWindow.



900
901
902
903
904
# File 'ext/glfw3/glfw3.c', line 900

static VALUE rb_window_hide(VALUE self)
{
  glfwHideWindow(rb_get_window(self));
  return self;
}

#iconifyObject

Iconifies the window.

Wraps glfwIconifyWindow.



861
862
863
864
865
# File 'ext/glfw3/glfw3.c', line 861

static VALUE rb_window_iconify(VALUE self)
{
  glfwIconifyWindow(rb_get_window(self));
  return self;
}

#iconify_callback=(func) ⇒ Object



198
199
200
201
# File 'lib/glfw3/window.rb', line 198

def iconify_callback=(func)
  @__iconify_callback = func
  set_iconify_callback__(func.respond_to?(:call))
end

#key(key) ⇒ Object

Gets the last-reported state of the given keyboard key for the window.

call-seq:

key(key) -> Fixed

Wraps glfwGetKey.



1116
1117
1118
1119
# File 'ext/glfw3/glfw3.c', line 1116

static VALUE rb_window_get_key(VALUE self, VALUE key)
{
  return INT2FIX(glfwGetKey(rb_get_window(self), NUM2INT(key)));
}

#key_callback=(func) ⇒ Object



99
100
101
102
# File 'lib/glfw3/window.rb', line 99

def key_callback=(func)
  @__key_callback = func
  set_key_callback__(func.respond_to?(:call))
end

#make_context_currentObject

Makes the window’s GL context current. You will need to call this before calling any OpenGL functions. See also ::unset_context to unset a context.

Wraps glfwMakeContextCurrent(window).

# Good
window.make_context_current()
Gl.glClear(Gl::GL_COLOR_BUFFER_BIT)

# Bad
Gl.glClear(Gl::GL_COLOR_BUFFER_BIT)
window.make_context_current()

Remember to make a window’s context current before calling any OpenGL functions. A window’s GL context may only be current in one thread at a time.



1439
1440
1441
1442
1443
# File 'ext/glfw3/glfw3.c', line 1439

static VALUE rb_window_make_context_current(VALUE self)
{
  glfwMakeContextCurrent(rb_get_window(self));
  return self;
}

#monitorObject

Gets the window’s monitor.

call-seq:

monitor -> Glfw::Monitor

Wraps glfwGetWindowMonitor.



916
917
918
919
920
921
922
923
924
925
926
# File 'ext/glfw3/glfw3.c', line 916

static VALUE rb_window_get_monitor(VALUE self)
{
  GLFWmonitor *monitor = glfwGetWindowMonitor(rb_get_window(self));
  VALUE rb_monitor = Qnil;
  if (monitor != NULL) {
    /* windowed mode */
    Data_Wrap_Struct(s_glfw_monitor_klass, 0, 0, monitor);
    rb_obj_call_init(rb_monitor, 0, 0);
  }
  return rb_monitor;
}

#mouse_button(button) ⇒ Object

Gets the last-reported state of the given mouse button for the window.

call-seq:

mouse_button(key) -> Fixed

Wraps glfwGetMouseButton.



1131
1132
1133
1134
# File 'ext/glfw3/glfw3.c', line 1131

static VALUE rb_window_get_mouse_button(VALUE self, VALUE button)
{
  return INT2FIX(glfwGetMouseButton(rb_get_window(self), NUM2INT(button)));
}

#mouse_button_callback=(func) ⇒ Object



117
118
119
120
# File 'lib/glfw3/window.rb', line 117

def mouse_button_callback=(func)
  @__mouse_button_callback = func
  set_mouse_button_callback__(func.respond_to?(:call))
end

#position=(xy) ⇒ Object



53
54
55
# File 'lib/glfw3/window.rb', line 53

def position=(xy)
  set_position(*xy)
end

#position_callback=(func) ⇒ Object



153
154
155
156
# File 'lib/glfw3/window.rb', line 153

def position_callback=(func)
  @__position_callback = func
  set_window_position_callback__(func.respond_to?(:call))
end

#refresh_callback=(func) ⇒ Object



180
181
182
183
# File 'lib/glfw3/window.rb', line 180

def refresh_callback=(func)
  @__refresh_callback = func
  set_refresh_callback__(func.respond_to?(:call))
end

#restoreObject

Restores the window.

Wraps glfwRestoreWindow.



874
875
876
877
878
# File 'ext/glfw3/glfw3.c', line 874

static VALUE rb_window_restore(VALUE self)
{
  glfwRestoreWindow(rb_get_window(self));
  return self;
}

#scroll_callback=(func) ⇒ Object



144
145
146
147
# File 'lib/glfw3/window.rb', line 144

def scroll_callback=(func)
  @__scroll_callback = func
  set_scroll_callback__(func.respond_to?(:call))
end

#set_char_callback(&block) ⇒ Object



113
114
115
# File 'lib/glfw3/window.rb', line 113

def set_char_callback(&block)
  self.char_callback = block
end

#set_char_callback__Object

#set_close_callback(&block) ⇒ Object



176
177
178
# File 'lib/glfw3/window.rb', line 176

def set_close_callback(&block)
  self.close_callback = block
end

#set_close_callback__Object

#set_cursor_enter_callback(&block) ⇒ Object



140
141
142
# File 'lib/glfw3/window.rb', line 140

def set_cursor_enter_callback(&block)
  self.cursor_enter_callback = block
end

#set_cursor_enter_callback__Object

#set_cursor_pos(x, y) ⇒ Object

Sets the position of the mouse cursor relative to the client area of the window. If the window isn’t focused at the time of the call, this silently fails.

call-seq:

set_cursor_pos(x, y) -> self

Wraps glfwSetCursorPos.



1166
1167
1168
1169
1170
# File 'ext/glfw3/glfw3.c', line 1166

static VALUE rb_window_set_cursor_pos(VALUE self, VALUE x, VALUE y)
{
  glfwSetCursorPos(rb_get_window(self), NUM2DBL(x), NUM2DBL(y));
  return self;
}

#set_cursor_position_callback(&block) ⇒ Object



131
132
133
# File 'lib/glfw3/window.rb', line 131

def set_cursor_position_callback(&block)
  self.cursor_position_callback = block
end

#set_cursor_position_callback__Object

#set_fbsize_callback__Object

#set_focus_callback(&block) ⇒ Object



194
195
196
# File 'lib/glfw3/window.rb', line 194

def set_focus_callback(&block)
  self.focus_callback = block
end

#set_focus_callback__Object

#set_framebuffer_size_callback(&block) ⇒ Object



212
213
214
# File 'lib/glfw3/window.rb', line 212

def set_framebuffer_size_callback(&block)
  self.framebuffer_size_callback = block
end

#set_iconify_callback(&block) ⇒ Object



203
204
205
# File 'lib/glfw3/window.rb', line 203

def set_iconify_callback(&block)
  self.iconify_callback = block
end

#set_iconify_callback__Object

#set_input_mode(mode, value) ⇒ Object

Sets the value of the given input mode.

call-seq:

set_input_mode(mode, value) -> self

Wraps glfwSetInputMode.



1100
1101
1102
1103
1104
# File 'ext/glfw3/glfw3.c', line 1100

static VALUE rb_window_set_input_mode(VALUE self, VALUE mode, VALUE value)
{
  glfwSetInputMode(rb_get_window(self), NUM2INT(mode), NUM2INT(value));
  return self;
}

#set_key_callback(&block) ⇒ Object



104
105
106
# File 'lib/glfw3/window.rb', line 104

def set_key_callback(&block)
  self.key_callback = block
end

#set_key_callback__Object

#set_mouse_button_callback(&block) ⇒ Object



122
123
124
# File 'lib/glfw3/window.rb', line 122

def set_mouse_button_callback(&block)
  self.mouse_button_callback = block
end

#set_mouse_button_callback__Object

#set_position(x, y) ⇒ Object Also known as: move

Moves the window to a new location (sets its position).

call-seq:

set_position(x, y) -> self
move(x, y) -> self

Wraps glfwSetWindowPos.



795
796
797
798
799
# File 'ext/glfw3/glfw3.c', line 795

static VALUE rb_window_set_position(VALUE self, VALUE x, VALUE y)
{
  glfwSetWindowPos(rb_get_window(self), NUM2INT(x), NUM2INT(y));
  return self;
}

#set_position_callback(&block) ⇒ Object



158
159
160
# File 'lib/glfw3/window.rb', line 158

def set_position_callback(&block)
  self.position_callback = block
end

#set_refresh_callback(&block) ⇒ Object



185
186
187
# File 'lib/glfw3/window.rb', line 185

def set_refresh_callback(&block)
  self.refresh_callback = block
end

#set_refresh_callback__Object

#set_scroll_callback(&block) ⇒ Object



149
150
151
# File 'lib/glfw3/window.rb', line 149

def set_scroll_callback(&block)
  self.scroll_callback = block
end

#set_scroll_callback__Object

#set_should_close(value) ⇒ Object Also known as: should_close=

Sets the window’s should-close flag. Ideally, the value provided should be a boolean, though it is only tested for non-nil and -false status, so it can be anything that would yield true for !!value.

call-seq:

should_close=(value) -> value
should_close = value -> value

Wraps glfwSetWindowShouldClose.



742
743
744
745
746
747
# File 'ext/glfw3/glfw3.c', line 742

static VALUE rb_window_set_should_close(VALUE self, VALUE value)
{
  GLFWwindow *window = rb_get_window(self);
  glfwSetWindowShouldClose(window, RTEST(value) ? GL_TRUE : GL_FALSE);
  return value;
}

#set_size(width, height) ⇒ Object Also known as: resize

Sets the window’s size.

call-seq:

set_size(width, height) -> self
resize(width, height) -> self

Wraps glfwSetWindowSize.



830
831
832
833
834
# File 'ext/glfw3/glfw3.c', line 830

static VALUE rb_window_set_size(VALUE self, VALUE width, VALUE height)
{
  glfwSetWindowSize(rb_get_window(self), NUM2INT(width), NUM2INT(height));
  return self;
}

#set_size_callback(&block) ⇒ Object



167
168
169
# File 'lib/glfw3/window.rb', line 167

def set_size_callback(&block)
  self.size_callback = block
end

#set_window_position_callback__Object

#set_window_size_callback__Object

#showObject

Shows the window.

Wraps glfwShowWindow.



887
888
889
890
891
# File 'ext/glfw3/glfw3.c', line 887

static VALUE rb_window_show(VALUE self)
{
  glfwShowWindow(rb_get_window(self));
  return self;
}

#size=(wh) ⇒ Object



57
58
59
# File 'lib/glfw3/window.rb', line 57

def size=(wh)
  set_size(*wh)
end

#size_callback=(func) ⇒ Object



162
163
164
165
# File 'lib/glfw3/window.rb', line 162

def size_callback=(func)
  @__size_callback = func
  set_window_size_callback__(func.respond_to?(:call))
end

#swap_buffersObject

Swaps the front and back buffers for the window. You will typically call this at the end of your drawing routines.

Wraps glfwSwapBuffers.

loop {
  Glfw.poll_events()

  # ...

  window.swap_buffers()
}


1489
1490
1491
1492
1493
# File 'ext/glfw3/glfw3.c', line 1489

static VALUE rb_window_swap_buffers(VALUE self)
{
  glfwSwapBuffers(rb_get_window(self));
  return self;
}

#title=(new_title) ⇒ Object

Sets the window’s title.

call-seq:

title=(new_title) -> new_title
title = new_title -> new_title

Wraps glfwSetWindowTitle.



760
761
762
763
764
# File 'ext/glfw3/glfw3.c', line 760

static VALUE rb_window_set_title(VALUE self, VALUE new_title)
{
  glfwSetWindowTitle(rb_get_window(self), StringValueCStr(new_title));
  return new_title;
}

#widthObject

Gets the width of the window. See also #size.



88
89
90
# File 'lib/glfw3/window.rb', line 88

def width
  size[0]
end

#xObject

Gets the X position of the window in screen space. See also #position.



74
75
76
# File 'lib/glfw3/window.rb', line 74

def x
  position[0]
end

#yObject

Gets the Y position of the window in screen space. See also #position.



81
82
83
# File 'lib/glfw3/window.rb', line 81

def y
  position[1]
end