graceful shutdown method
parent
7cb2b480b3
commit
18bcc93a61
|
@ -11,6 +11,7 @@ typedef enum {
|
||||||
|
|
||||||
void game_init(game_kind play_mode, uint32_t num_viewers, int32_t seed, uint16_t chunk_size, uint16_t chunk_amount, int8_t is_dash_enabled);
|
void game_init(game_kind play_mode, uint32_t num_viewers, int32_t seed, uint16_t chunk_size, uint16_t chunk_amount, int8_t is_dash_enabled);
|
||||||
void game_shutdown();
|
void game_shutdown();
|
||||||
|
void game_request_close();
|
||||||
uint8_t game_is_running();
|
uint8_t game_is_running();
|
||||||
int8_t game_is_networked();
|
int8_t game_is_networked();
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
|
|
||||||
void platform_init();
|
void platform_init(void);
|
||||||
void platform_shutdown();
|
void platform_shutdown(void);
|
||||||
float platform_frametime();
|
void platform_request_close(void);
|
||||||
uint8_t platform_is_running();
|
float platform_frametime(void);
|
||||||
|
uint8_t platform_is_running(void);
|
||||||
|
|
||||||
float platform_zoom_get(void);
|
float platform_zoom_get(void);
|
||||||
|
|
||||||
void platform_input();
|
void platform_input(void);
|
||||||
void platform_render();
|
void platform_render(void);
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
PROF_MAIN_LOOP,
|
PROF_MAIN_LOOP,
|
||||||
|
|
||||||
PROF_WORLD_WRITE,
|
PROF_WORLD_WRITE,
|
||||||
PROF_RENDER,
|
PROF_RENDER,
|
||||||
PROF_UPDATE_SYSTEMS,
|
PROF_UPDATE_SYSTEMS,
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
#include "debug_ui.h"
|
#include "debug_ui.h"
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
|
#include "game.h"
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
ActExitGame(void) {
|
ActExitGame(void) {
|
||||||
CloseWindow();
|
game_request_close();
|
||||||
}
|
}
|
|
@ -197,3 +197,7 @@ void game_world_cleanup_entities(void) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void game_request_close() {
|
||||||
|
platform_request_close();
|
||||||
|
}
|
|
@ -17,6 +17,7 @@ uint16_t screenWidth = 1600;
|
||||||
uint16_t screenHeight = 900;
|
uint16_t screenHeight = 900;
|
||||||
float target_zoom = 4.0f;
|
float target_zoom = 4.0f;
|
||||||
float zoom_overlay_tran = 0.0f;
|
float zoom_overlay_tran = 0.0f;
|
||||||
|
bool request_shutdown;
|
||||||
|
|
||||||
#define CAM_OVERLAY_ZOOM_LEVEL 0.80f
|
#define CAM_OVERLAY_ZOOM_LEVEL 0.80f
|
||||||
|
|
||||||
|
@ -138,6 +139,10 @@ void platform_render() {
|
||||||
}
|
}
|
||||||
debug_draw();
|
debug_draw();
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
|
|
||||||
|
if (request_shutdown) {
|
||||||
|
CloseWindow();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void display_conn_status() {
|
void display_conn_status() {
|
||||||
|
@ -272,3 +277,7 @@ void do_entity_fadeinout(uint64_t key, entity_view * data) {
|
||||||
float platform_zoom_get(void) {
|
float platform_zoom_get(void) {
|
||||||
return target_zoom;
|
return target_zoom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void platform_request_close(void) {
|
||||||
|
request_shutdown = true;
|
||||||
|
}
|
Loading…
Reference in New Issue