Skip to content
Extraits de code Groupes Projets
Vérifiée Valider 93673b8d rédigé par Kubat's avatar Kubat
Parcourir les fichiers

Draw won't draw in the SDL window

parent 6f61189f
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!57Resolve "SDL2 module"
...@@ -52,15 +52,11 @@ sdl_thread__(struct lkt_thread_arg *arg) ...@@ -52,15 +52,11 @@ sdl_thread__(struct lkt_thread_arg *arg)
int w, h; int w, h;
free(arg); free(arg);
(void) self; (void) self;
RETURN_UNLESS(sdl2, "Big nope here, the sdl window pointer is NULL", NULL); RETURN_UNLESS(sdl2 && sdl2->window, "Big nope here, the sdl window pointer is NULL", NULL);
fprintf(stderr, " * Started SDL thread\n"); fprintf(stderr, " * Started SDL thread\n");
/* SDL events won't change the database, only the mpv one's will.
Do this to be able to put the SDL stuff inside a thread and don't change
to much things. */
loop: loop:
if (!SDL_PollEvent(&event)) RETURN_UNLESS(SDL_WaitEvent(&event), "Failed to wait SDL event", NULL);
sched_yield();
switch (event.type) { switch (event.type) {
case SDL_QUIT: case SDL_QUIT:
...@@ -70,8 +66,8 @@ loop: ...@@ -70,8 +66,8 @@ loop:
case SDL_WINDOWEVENT: case SDL_WINDOWEVENT:
if (event.window.event == SDL_WINDOWEVENT_EXPOSED) if (event.window.event == SDL_WINDOWEVENT_EXPOSED)
redraw = 1; redraw = 1;
break; break;
case SDL_KEYDOWN: case SDL_KEYDOWN:
if (event.key.keysym.sym == SDLK_SPACE) { if (event.key.keysym.sym == SDLK_SPACE) {
const char *cmd_pause[] = { "cycle", "pause", NULL }; const char *cmd_pause[] = { "cycle", "pause", NULL };
...@@ -81,14 +77,12 @@ loop: ...@@ -81,14 +77,12 @@ loop:
case SDL_KEYUP: case SDL_KEYUP:
if (event.key.keysym.sym == SDLK_F11) { if (event.key.keysym.sym == SDLK_F11) {
if (sdl2->is_fullscreen) { if (sdl2->is_fullscreen)
SDL_SetWindowFullscreen(sdl2->window, 0); SDL_SetWindowFullscreen(sdl2->window, 0);
sdl2->is_fullscreen = 0; else
} else {
/* May use SDL_WINDOW_FULLSCREEN_DESKTOP, need to check. */
SDL_SetWindowFullscreen(sdl2->window, SDL_WINDOW_FULLSCREEN); SDL_SetWindowFullscreen(sdl2->window, SDL_WINDOW_FULLSCREEN);
sdl2->is_fullscreen = 1; /* May use SDL_WINDOW_FULLSCREEN_DESKTOP, need to check. */
} sdl2->is_fullscreen = 1 - sdl2->is_fullscreen;
} }
break; break;
...@@ -158,9 +152,7 @@ on_mpv_render_update(void *ctx) ...@@ -158,9 +152,7 @@ on_mpv_render_update(void *ctx)
extern int extern int
module_set_function(void *arg__, void *handle__) module_set_function(void *arg__, void *handle__)
{ {
if (NULL == arg__ || handle__ == NULL) RETURN_UNLESS(arg__ && handle__, "Invalid argument", 1);
return 1;
struct lkt_win *win = (struct lkt_win *) arg__; struct lkt_win *win = (struct lkt_win *) arg__;
win->new = module_sdl2_new; win->new = module_sdl2_new;
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter