From d09fec941b6135bde92dcc2fba2b9de75f47dc8e Mon Sep 17 00:00:00 2001 From: Amaryllis Kulla Date: Tue, 2 Nov 2021 05:54:38 +0100 Subject: [PATCH] Add Graphics#resize_window Does what you would expect. Arguments are not bound-checked! --- binding-mri/graphics-binding.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/binding-mri/graphics-binding.cpp b/binding-mri/graphics-binding.cpp index aa58102..2c5351c 100644 --- a/binding-mri/graphics-binding.cpp +++ b/binding-mri/graphics-binding.cpp @@ -20,6 +20,7 @@ */ #include "graphics.h" +#include "eventthread.h" #include "sharedstate.h" #include "binding-util.h" #include "binding-types.h" @@ -195,6 +196,18 @@ RB_METHOD(graphicsPlayMovie) return Qnil; } +RB_METHOD(graphicsResizeWindow) +{ + RB_UNUSED_PARAM; + + int width, height; + rb_get_args(argc, argv, "ii", &width, &height RB_ARG_END); + + shState->eThread().requestWindowResize(width, height); + + return Qnil; +} + DEF_GRA_PROP_I(FrameRate) DEF_GRA_PROP_I(FrameCount) DEF_GRA_PROP_I(Brightness) @@ -252,4 +265,6 @@ void graphicsBindingInit() INIT_GRA_PROP_BIND( Fullscreen, "fullscreen" ); INIT_GRA_PROP_BIND( ShowCursor, "show_cursor" ); + + _rb_define_module_function(module, "resize_window", graphicsResizeWindow); }