[nostalgia/core] Add support for getting screen dimensions

This commit is contained in:
2021-03-17 21:28:06 -05:00
parent 245424cfad
commit 4796c2e0cb
3 changed files with 42 additions and 1 deletions
+22
View File
@@ -6,6 +6,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include "nostalgia/common/point.hpp"
#include <array>
#ifdef NOST_FPS_PRINT
#include <iostream>
@@ -57,4 +58,25 @@ ox::Error shutdownGfx(Context *ctx) {
return OxError(0);
}
int getScreenWidth(Context *ctx) {
auto id = ctx->windowerData<SdlImplData>();
int x = 0, y = 0;
SDL_GetWindowSize(id->window, &x, &y);
return x;
}
int getScreenHeight(Context *ctx) {
auto id = ctx->windowerData<SdlImplData>();
int x = 0, y = 0;
SDL_GetWindowSize(id->window, &x, &y);
return y;
}
common::Point getScreenSize(Context *ctx) {
auto id = ctx->windowerData<SdlImplData>();
int x = 0, y = 0;
SDL_GetWindowSize(id->window, &x, &y);
return {x, y};
}
}