1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-08-11 15:45:05 +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; EGLContext context;
NWindow *window; 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() { bool eglInit() {
display = eglGetDisplay(EGL_DEFAULT_DISPLAY); display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
if (display == EGL_NO_DISPLAY) if (display == EGL_NO_DISPLAY)
@@ -144,6 +158,10 @@ bool eglInit() {
if (eglMakeCurrent(display, surface, surface, context) == EGL_FALSE) if (eglMakeCurrent(display, surface, surface, context) == EGL_FALSE)
return false; return false;
configureResolution();
glClear(GL_COLOR_BUFFER_BIT);
eglSwapBuffers(display, surface);
return true; return true;
} }
@@ -155,19 +173,6 @@ void eglFree() {
eglReleaseThread(); 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 // Input
bool osJoyReady(int index) { bool osJoyReady(int index) {
return index == 0; return index == 0;

View File

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