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

Cleaning, nothing is showing in the window

parent 61df93a2
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!57Resolve "SDL2 module"
......@@ -129,22 +129,6 @@ module_sdl2_new(struct lkt_win *const win)
return false;
struct module_sdl2_window *sdl2 = win->window;
mpv_render_param params[] = {
{ MPV_RENDER_PARAM_API_TYPE, MPV_RENDER_API_TYPE_OPENGL },
{
MPV_RENDER_PARAM_OPENGL_INIT_PARAMS, &(mpv_opengl_init_params)
{
.get_proc_address = get_proc_address_mpv,
}
},
{
MPV_RENDER_PARAM_ADVANCED_CONTROL, &(int)
{
1
}
},
{0}
};
if (sdl2 == NULL) {
sdl2 = calloc(1, sizeof(struct module_sdl2_window));
......@@ -168,35 +152,55 @@ module_sdl2_new(struct lkt_win *const win)
sdl2->glcontext = SDL_GL_CreateContext(sdl2->window);
if (!sdl2->glcontext)
goto error;
}
/* Init mpv here */
if (init_mpv__(&sdl2->mpv))
goto error;
/* Init mpv here */
if (init_mpv__(&sdl2->mpv))
goto error;
/* Init opengl with mpv and sdl2 */
if (mpv_render_context_create(&sdl2->mpv_gl, sdl2->mpv, params) < 0)
goto error;
mpv_render_param params[] = {
{ MPV_RENDER_PARAM_API_TYPE, MPV_RENDER_API_TYPE_OPENGL },
{
MPV_RENDER_PARAM_OPENGL_INIT_PARAMS, &(mpv_opengl_init_params)
{
.get_proc_address = get_proc_address_mpv,
}
},
{
MPV_RENDER_PARAM_ADVANCED_CONTROL, &(int)
{
1
}
},
{0}
};
fprintf(stderr, " * Successfully created the SDL2 window\n");
wakeup_on_mpv_render_update = SDL_RegisterEvents(1);
wakeup_on_mpv_events = SDL_RegisterEvents(1);
if (wakeup_on_mpv_render_update == (Uint32) - 1 || wakeup_on_mpv_events == (Uint32) - 1)
goto error;
/* Init mpv_gl here */
if (init_mpv_gl__(sdl2->mpv, &sdl2->mpv_gl, params))
goto error;
mpv_set_wakeup_callback(sdl2->mpv, on_mpv_events, NULL);
mpv_render_context_set_update_callback(sdl2->mpv_gl, on_mpv_render_update, NULL);
if (sdl2->mpv == NULL && init_mpv__(&sdl2->mpv))
goto error;
/* Init mpv_gl here */
if (sdl2->mpv_gl == NULL) {
mpv_render_param params[] = { { MPV_RENDER_PARAM_API_TYPE, MPV_RENDER_API_TYPE_OPENGL }, {
MPV_RENDER_PARAM_OPENGL_INIT_PARAMS, &(mpv_opengl_init_params)
{
.get_proc_address = get_proc_address_mpv,
}
},
{
MPV_RENDER_PARAM_ADVANCED_CONTROL, &(int)
{
1
}
},
{0}
};
if (init_mpv_gl__(sdl2->mpv, &sdl2->mpv_gl, params))
goto error;
}
if (sdl2->mpv == NULL && init_mpv__(&sdl2->mpv))
goto error;
if (sdl2->mpv_gl == NULL && init_mpv_gl__(sdl2->mpv, &sdl2->mpv_gl, params))
goto error;
SDL_SetWindowTitle(sdl2->window, "Lektord");
SDL_DisableScreenSaver();
win->window = sdl2;
......
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