f1 para activar transicion backtoblack fader

main
fanta 2 weeks ago
parent ae37063f5a
commit d26bb2858c

@ -5,7 +5,7 @@
#include <SDL_image.h>
// Fanta <fanta@56k.es> 2026
// Presentator 0.1
// Presentator 0.2
// Variables
int modPlaying;
@ -13,7 +13,7 @@ char * modName = NULL;
int modVolume = 100;
int iv;
char *imgVol[] = {"res/vol100.png","res/vol090.png","res/vol080.png","res/vol070.png","res/vol060.png","res/vol050.png","res/vol040.png","res/vol030.png","res/vol020.png","res/vol010.png","res/vol000.png"};
char windowTitle[16] = "Presentator 0.1";
char windowTitle[16] = "Presentator 0.2";
int windowWidth = 1024;
int windowHeight = 768;
char * slidesIndex = "slides/index.txt";
@ -27,6 +27,8 @@ SDL_Texture *textureSlide = NULL;
SDL_Texture *textureProgressRect = NULL;
SDL_Event evento;
xmp_context ctx;
int transition_active = 0;
// Functions
int createWindow(void){
@ -105,6 +107,23 @@ int loadSlide(int nslide){
return 0;
}
int transition_BackToBlack(void){
SDL_SetRenderDrawBlendMode(render, SDL_BLENDMODE_BLEND);
SDL_Rect barra = { 0, 0, windowWidth, windowHeight };
int z;
for (z = 250; z > 0; z = z -10) {
loadSlide(actualNSlide);
refreshVolumeArea(iv);
SDL_SetRenderDrawColor(render, 0, 0, 0, z);
SDL_RenderFillRect(render, &barra);
SDL_RenderPresent(render);
}
return 0;
}
int renderAll(void){
loadSlide(actualNSlide);
refreshVolumeArea(iv);
@ -112,6 +131,8 @@ int renderAll(void){
return 0;
}
// Main
int main(int argc, char ** argv) {
createWindow();
@ -120,6 +141,10 @@ int main(int argc, char ** argv) {
refreshVolumeArea(0);
SDL_RenderPresent(render);
while (!quit) {
SDL_WaitEvent(&evento);
@ -184,12 +209,21 @@ int main(int argc, char ** argv) {
break;
case SDLK_RIGHT:
actualNSlide = actualNSlide + 1;
if (transition_active == 1 ){ transition_BackToBlack(); };
renderAll();
break;
case SDLK_LEFT:
actualNSlide = actualNSlide - 1;
if (transition_active == 1 ){ transition_BackToBlack(); };
renderAll();
break;
case SDLK_F1:
if (transition_active == 0){
transition_active = 1;
}else{
transition_active = 0;
}
break;
}
break;
}

Loading…
Cancel
Save