mirror of
https://github.com/XProger/OpenLara.git
synced 2025-08-06 13:16:52 +02:00
#15 NX add 1080p docked mode support
This commit is contained in:
@@ -93,6 +93,7 @@ void sndFree() {
|
|||||||
EGLDisplay display;
|
EGLDisplay display;
|
||||||
EGLSurface surface;
|
EGLSurface surface;
|
||||||
EGLContext context;
|
EGLContext context;
|
||||||
|
NWindow *window;
|
||||||
|
|
||||||
bool eglInit() {
|
bool eglInit() {
|
||||||
display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
||||||
@@ -125,7 +126,10 @@ bool eglInit() {
|
|||||||
if (eglChooseConfig(display, eglAttr, &config, 1, &configCount) == EGL_FALSE)
|
if (eglChooseConfig(display, eglAttr, &config, 1, &configCount) == EGL_FALSE)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
surface = eglCreateWindowSurface(display, config, (char*)"", NULL);
|
window = nwindowGetDefault();
|
||||||
|
nwindowSetDimensions(window, 1920, 1080);
|
||||||
|
|
||||||
|
surface = eglCreateWindowSurface(display, config, (EGLNativeWindowType)window, NULL);
|
||||||
|
|
||||||
if (surface == EGL_NO_SURFACE)
|
if (surface == EGL_NO_SURFACE)
|
||||||
return false;
|
return false;
|
||||||
@@ -151,6 +155,19 @@ void eglFree() {
|
|||||||
eglReleaseThread();
|
eglReleaseThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void configureResolution() {
|
||||||
|
if (appletGetOperationMode() == AppletOperationMode_Docked) {
|
||||||
|
Core::width = 1920;
|
||||||
|
Core::height = 1080;
|
||||||
|
} else {
|
||||||
|
Core::width = 1280;
|
||||||
|
Core::height = 720;
|
||||||
|
}
|
||||||
|
|
||||||
|
nwindowSetCrop(window, 0, 0, Core::width, Core::height);
|
||||||
|
Core::y = 1080 - Core::height;
|
||||||
|
}
|
||||||
|
|
||||||
// Input
|
// Input
|
||||||
bool osJoyReady(int index) {
|
bool osJoyReady(int index) {
|
||||||
return index == 0;
|
return index == 0;
|
||||||
@@ -176,7 +193,7 @@ void joySplit(bool split) {
|
|||||||
hidSetNpadJoyAssignmentModeDual(CONTROLLER_PLAYER_2);
|
hidSetNpadJoyAssignmentModeDual(CONTROLLER_PLAYER_2);
|
||||||
hidMergeSingleJoyAsDualJoy(CONTROLLER_PLAYER_1, CONTROLLER_PLAYER_2);
|
hidMergeSingleJoyAsDualJoy(CONTROLLER_PLAYER_1, CONTROLLER_PLAYER_2);
|
||||||
|
|
||||||
if (Game::level && Game::level.players[1]) {
|
if (Game::level && Game::level->players[1]) {
|
||||||
Game::level->addPlayer(1); // add existing player == remove player
|
Game::level->addPlayer(1); // add existing player == remove player
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -291,6 +308,7 @@ int main(int argc, char* argv[]) {
|
|||||||
touchUpdate();
|
touchUpdate();
|
||||||
|
|
||||||
if (Game::update()) {
|
if (Game::update()) {
|
||||||
|
configureResolution();
|
||||||
Game::render();
|
Game::render();
|
||||||
Core::waitVBlank();
|
Core::waitVBlank();
|
||||||
eglSwapBuffers(display, surface);
|
eglSwapBuffers(display, surface);
|
||||||
|
Reference in New Issue
Block a user