mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-08-04 22:15:33 +02: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());
|
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_METHOD(graphicsWait)
|
||||||
{
|
{
|
||||||
RB_UNUSED_PARAM;
|
RB_UNUSED_PARAM;
|
||||||
|
@ -383,6 +397,8 @@ void graphicsBindingInit()
|
||||||
|
|
||||||
_rb_define_module_function(module, "width", graphicsWidth);
|
_rb_define_module_function(module, "width", graphicsWidth);
|
||||||
_rb_define_module_function(module, "height", graphicsHeight);
|
_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, "wait", graphicsWait);
|
||||||
_rb_define_module_function(module, "fadeout", graphicsFadeout);
|
_rb_define_module_function(module, "fadeout", graphicsFadeout);
|
||||||
_rb_define_module_function(module, "fadein", graphicsFadein);
|
_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::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) {
|
void Graphics::resizeScreen(int width, int height) {
|
||||||
p->threadData->rqWindowAdjust.wait();
|
p->threadData->rqWindowAdjust.wait();
|
||||||
p->checkResize(true);
|
p->checkResize(true);
|
||||||
|
|
|
@ -58,6 +58,8 @@ public:
|
||||||
|
|
||||||
int width() const;
|
int width() const;
|
||||||
int height() const;
|
int height() const;
|
||||||
|
int displayWidth() const;
|
||||||
|
int displayHeight() const;
|
||||||
void resizeScreen(int width, int height);
|
void resizeScreen(int width, int height);
|
||||||
void resizeWindow(int width, int height, bool center=false);
|
void resizeWindow(int width, int height, bool center=false);
|
||||||
void drawMovieFrame(const THEORAPLAY_VideoFrame* video, Bitmap *videoBitmap);
|
void drawMovieFrame(const THEORAPLAY_VideoFrame* video, Bitmap *videoBitmap);
|
||||||
|
|
Loading…
Add table
Reference in a new issue