Start working on ScreenResizer

This commit is contained in:
Inori 2019-08-03 12:33:35 -04:00 committed by Inori
parent 88cdb903fa
commit fd248709e3
2 changed files with 283 additions and 279 deletions

View file

@ -221,9 +221,10 @@ void graphicsBindingInit()
INIT_GRA_PROP_BIND( FrameRate, "frame_rate" );
INIT_GRA_PROP_BIND( FrameCount, "frame_count" );
#ifndef USE_ESSENTIALS_FIXES
if (rgssVer >= 2)
{
#endif
_rb_define_module_function(module, "width", graphicsWidth);
_rb_define_module_function(module, "height", graphicsHeight);
_rb_define_module_function(module, "wait", graphicsWait);
@ -233,7 +234,9 @@ void graphicsBindingInit()
_rb_define_module_function(module, "resize_screen", graphicsResizeScreen);
INIT_GRA_PROP_BIND( Brightness, "brightness" );
#ifndef USE_ESSENTIALS_FIXES
}
#endif
if (rgssVer >= 3)
{

View file

@ -4,7 +4,6 @@
#include <ruby.h>
#include <SDL.h>
#if defined(__WIN32__) && defined(USE_ESSENTIALS_FIXES)
#include <SDL_syswm.h>
#include "sharedstate.h"
#endif
@ -198,8 +197,6 @@ MiniFFI_call(int argc, VALUE *argv, VALUE self)
// It's a super janky system, but I must abide by it
SDL_SysWMinfo wm;
char *fname = RSTRING_PTR(rb_iv_get(self, "_funcname"));
#define func_is(x) !strcmp(fname, x)
#define if_func_is(x) if (func_is(x))
@ -209,15 +206,13 @@ MiniFFI_call(int argc, VALUE *argv, VALUE self)
}
else if_func_is("FindWindowEx")
{
SDL_GetWindowWMInfo(shState->sdlWindow(), &wm);
ret = (unsigned long)wm.info.win.window;
ret = 571;
}
else if_func_is("GetForegroundWindow")
{
if (SDL_GetWindowFlags(shState->sdlWindow()) & SDL_WINDOW_INPUT_FOCUS)
{
SDL_GetWindowWMInfo(shState->sdlWindow(), &wm);
ret = (unsigned long)wm.info.win.window;
ret = 571;
}
else
ret = 0;
@ -243,6 +238,12 @@ MiniFFI_call(int argc, VALUE *argv, VALUE self)
output[1] = y;
ret = true;
}
else if_func_is("SetWindowPos")
{
SDL_SetWindowSize(shState->sdlWindow(),params[4],params[5]-24);
SDL_SetWindowPosition(shState->sdlWindow(),params[2],params[3]);
return true;
}
else
{
ret = (unsigned long)ApiFunction(param);