Merge pull request 'add a function to disconnect all input listeners, call this function every time a scene is loaded exclusively' (#15) from input-reset into main
Reviewed-on: #15main
commit
6649d769c2
|
@ -189,3 +189,7 @@ int input_get_mousedown(int mousebtn) {
|
||||||
uint32_t mask = SDL_BUTTON(mousebtn);
|
uint32_t mask = SDL_BUTTON(mousebtn);
|
||||||
return (SDL_GetMouseState(NULL, NULL) & mask) != 0;
|
return (SDL_GetMouseState(NULL, NULL) & mask) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void input_disconnect_all() {
|
||||||
|
g_key_listeners_endptr = g_key_listeners;
|
||||||
|
}
|
||||||
|
|
|
@ -30,6 +30,8 @@ extern void input_init();
|
||||||
extern void update_input();
|
extern void update_input();
|
||||||
extern void input_notify_event(SDL_Event event);
|
extern void input_notify_event(SDL_Event event);
|
||||||
|
|
||||||
|
extern void input_disconnect_all();
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "scene.h"
|
#include "scene.h"
|
||||||
|
|
||||||
#include "ctype.h"
|
#include "ctype.h"
|
||||||
|
#include "input.h"
|
||||||
#include "stdint.h"
|
#include "stdint.h"
|
||||||
#include "stddef.h"
|
#include "stddef.h"
|
||||||
#include "stdlib.h"
|
#include "stdlib.h"
|
||||||
|
@ -200,6 +201,7 @@ int _validate_scene(FILE* file) {
|
||||||
void load_scene(const char* filename) {
|
void load_scene(const char* filename) {
|
||||||
FILE* file = fopen(filename, "r");
|
FILE* file = fopen(filename, "r");
|
||||||
if(_validate_scene(file)) {
|
if(_validate_scene(file)) {
|
||||||
|
input_disconnect_all();
|
||||||
world_clear();
|
world_clear();
|
||||||
_parse_scene(file);
|
_parse_scene(file);
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
|
Loading…
Reference in New Issue