mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-03-28 14:56:22 +01:00
Add Graphics.display_width & Graphics.display_height
This commit is contained in:
parent
c41967268c
commit
6007c45c8a
3 changed files with 30 additions and 0 deletions
|
@ -164,6 +164,20 @@ RB_METHOD(graphicsHeight)
|
|||
return rb_fix_new(shState->graphics().height());
|
||||
}
|
||||
|
||||
RB_METHOD(graphicsDisplayWidth)
|
||||
{
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
return rb_fix_new(shState->graphics().displayWidth());
|
||||
}
|
||||
|
||||
RB_METHOD(graphicsDisplayHeight)
|
||||
{
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
return rb_fix_new(shState->graphics().displayHeight());
|
||||
}
|
||||
|
||||
RB_METHOD(graphicsWait)
|
||||
{
|
||||
RB_UNUSED_PARAM;
|
||||
|
@ -383,6 +397,8 @@ void graphicsBindingInit()
|
|||
|
||||
_rb_define_module_function(module, "width", graphicsWidth);
|
||||
_rb_define_module_function(module, "height", graphicsHeight);
|
||||
_rb_define_module_function(module, "display_width", graphicsDisplayWidth);
|
||||
_rb_define_module_function(module, "display_height", graphicsDisplayHeight);
|
||||
_rb_define_module_function(module, "wait", graphicsWait);
|
||||
_rb_define_module_function(module, "fadeout", graphicsFadeout);
|
||||
_rb_define_module_function(module, "fadein", graphicsFadein);
|
||||
|
|
|
@ -1330,6 +1330,18 @@ int Graphics::width() const { return p->scRes.x; }
|
|||
|
||||
int Graphics::height() const { return p->scRes.y; }
|
||||
|
||||
int Graphics::displayWidth() const {
|
||||
SDL_DisplayMode dm{};
|
||||
SDL_GetCurrentDisplayMode(SDL_GetWindowDisplayIndex(shState->sdlWindow()), &dm);
|
||||
return dm.w / p->backingScaleFactor;
|
||||
}
|
||||
|
||||
int Graphics::displayHeight() const {
|
||||
SDL_DisplayMode dm{};
|
||||
SDL_GetCurrentDisplayMode(SDL_GetWindowDisplayIndex(shState->sdlWindow()), &dm);
|
||||
return dm.h / p->backingScaleFactor;
|
||||
}
|
||||
|
||||
void Graphics::resizeScreen(int width, int height) {
|
||||
p->threadData->rqWindowAdjust.wait();
|
||||
p->checkResize(true);
|
||||
|
|
|
@ -58,6 +58,8 @@ public:
|
|||
|
||||
int width() const;
|
||||
int height() const;
|
||||
int displayWidth() const;
|
||||
int displayHeight() const;
|
||||
void resizeScreen(int width, int height);
|
||||
void resizeWindow(int width, int height, bool center=false);
|
||||
void drawMovieFrame(const THEORAPLAY_VideoFrame* video, Bitmap *videoBitmap);
|
||||
|
|
Loading…
Add table
Reference in a new issue