1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-08-11 07:34:33 +02:00

fix memory leak in UI; #15 nx clear screen right after context initialization

This commit is contained in:
XProger
2019-01-08 08:18:02 +03:00
parent a3c0099d2d
commit c01ca6d6c9
2 changed files with 21 additions and 13 deletions

View File

@@ -95,6 +95,20 @@ EGLSurface surface;
EGLContext context;
NWindow *window;
void configureResolution() {
if (appletGetOperationMode() == AppletOperationMode_Docked) {
Core::width = 1920;
Core::height = 1080;
}
else {
Core::width = 1280;
Core::height = 720;
}
int offset = 1080 - Core::height;
nwindowSetCrop(window, 0, offset, Core::width, Core::height + offset);
}
bool eglInit() {
display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
if (display == EGL_NO_DISPLAY)
@@ -144,6 +158,10 @@ bool eglInit() {
if (eglMakeCurrent(display, surface, surface, context) == EGL_FALSE)
return false;
configureResolution();
glClear(GL_COLOR_BUFFER_BIT);
eglSwapBuffers(display, surface);
return true;
}
@@ -155,19 +173,6 @@ void eglFree() {
eglReleaseThread();
}
void configureResolution() {
if (appletGetOperationMode() == AppletOperationMode_Docked) {
Core::width = 1920;
Core::height = 1080;
} else {
Core::width = 1280;
Core::height = 720;
}
int offset = 1080 - Core::height;
nwindowSetCrop(window, 0, offset, Core::width, Core::height + offset);
}
// Input
bool osJoyReady(int index) {
return index == 0;

View File

@@ -507,6 +507,9 @@ namespace UI {
}
void deinit() {
for (int i = 0; i < pickups.length; i++) {
delete pickups[i].animation;
}
pickups.clear();
}