diff options
| -rw-r--r-- | ext/ruby2d/ruby2d.c | 2 | ||||
| -rw-r--r-- | lib/ruby2d/window.rb | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/ext/ruby2d/ruby2d.c b/ext/ruby2d/ruby2d.c index 888c053..b44ba58 100644 --- a/ext/ruby2d/ruby2d.c +++ b/ext/ruby2d/ruby2d.c @@ -933,6 +933,7 @@ static R_VAL ruby2d_window_ext_show(R_VAL self) { char *title = RSTRING_PTR(r_iv_get(self, "@title")); int width = NUM2INT(r_iv_get(self, "@width")); int height = NUM2INT(r_iv_get(self, "@height")); + int fps_cap = NUM2INT(r_iv_get(self, "@fps_cap")); int flags = 0; // Get window flags @@ -965,6 +966,7 @@ static R_VAL ruby2d_window_ext_show(R_VAL self) { window->viewport.width = viewport_width; window->viewport.height = viewport_height; + window->fps_cap = fps_cap; window->on_key = on_key; window->on_mouse = on_mouse; window->on_controller = on_controller; diff --git a/lib/ruby2d/window.rb b/lib/ruby2d/window.rb index 686c6b0..021353d 100644 --- a/lib/ruby2d/window.rb +++ b/lib/ruby2d/window.rb @@ -25,9 +25,9 @@ module Ruby2D @fullscreen = false @highdpi = false @frames = 0 - @fps_cap = args[:fps] || 60 + @fps_cap = args[:fps_cap] || 60 @fps = @fps_cap - @vsync = args[:vsync] || true + @vsync = args[:vsync] || true @mouse_x, @mouse_y = 0, 0 @objects = [] @event_key = 0 @@ -76,6 +76,7 @@ module Ruby2D when :highdpi; @highdpi when :frames; @frames when :fps; @fps + when :fps_cap; @fps_cap when :mouse_x; @mouse_x when :mouse_y; @mouse_y when :diagnostics; @diagnostics @@ -90,6 +91,7 @@ module Ruby2D end @width = opts[:width] || @width @height = opts[:height] || @height + @fps_cap = opts[:fps_cap] || @fps_cap @viewport_width = opts[:viewport_width] || @viewport_width @viewport_height = opts[:viewport_height] || @viewport_height @resizable = opts[:resizable] || @resizable |
