Fixed compilation errors and window closing issue on linux

This commit is contained in:
KiritoDv 2022-05-19 15:45:16 -05:00
commit 4f1e4d312b
4 changed files with 9 additions and 5 deletions

View file

@ -156,6 +156,7 @@ static struct {
Atom atom_wm_delete_window;
bool is_fullscreen;
bool is_running = true;
void (*on_fullscreen_changed)(bool is_now_fullscreen);
int keymap[256];
@ -399,7 +400,7 @@ static void gfx_glx_set_keyboard_callbacks(bool (*on_key_down)(int scancode), bo
}
static void gfx_glx_main_loop(void (*run_one_game_iter)(void)) {
while (1) {
while (glx.is_running) {
run_one_game_iter();
}
}
@ -440,7 +441,7 @@ static void gfx_glx_handle_events(void) {
}
}
if (xev.type == ClientMessage && (Atom)xev.xclient.data.l[0] == glx.atom_wm_delete_window) {
exit(0);
glx.is_running = false;
}
}
}

View file

@ -33,8 +33,8 @@
#else
#include <SDL2/SDL.h>
#include <GL/glew.h>
#define GL_GLEXT_PROTOTYPES 1
#include <SDL2/SDL_opengles2.h>
// #define GL_GLEXT_PROTOTYPES 1
// #include <SDL2/SDL_opengles2.h>
#endif
#include "gfx_cc.h"

View file

@ -255,8 +255,9 @@ static void gfx_sdl_onkeyup(int scancode) {
}
static void gfx_sdl_handle_events(void) {
#ifdef __SWITCH__
Ship::Switch::Update();
#endif
SDL_Event event;
while (SDL_PollEvent(&event)) {
SohImGui::EventImpl event_impl;

View file

@ -61,7 +61,9 @@ extern "C" int AudioPlayer_GetDesiredBuffered(void);
// C->C++ Bridge
extern "C" void InitOTR() {
#ifdef __SWITCH__
Ship::Switch::Init();
#endif
OTRGlobals::Instance = new OTRGlobals();
auto t = OTRGlobals::Instance->context->GetResourceManager()->LoadFile("version");