|
|
|
@ -2,9 +2,8 @@
|
|
|
|
#include <xmp.h>
|
|
|
|
#include <xmp.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include <SDL_image.h>
|
|
|
|
#include <SDL_image.h>
|
|
|
|
|
|
|
|
#include <SDL_ttf.h>
|
|
|
|
|
|
|
|
|
|
|
|
// Fanta <fanta@56k.es> 2026
|
|
|
|
// Fanta <fanta@56k.es> 2026
|
|
|
|
// Presentator 0.2
|
|
|
|
// Presentator 0.2
|
|
|
|
@ -35,6 +34,7 @@ int transition_active = 0;
|
|
|
|
// Functions
|
|
|
|
// Functions
|
|
|
|
int createWindow(void){
|
|
|
|
int createWindow(void){
|
|
|
|
SDL_Init(SDL_INIT_VIDEO);
|
|
|
|
SDL_Init(SDL_INIT_VIDEO);
|
|
|
|
|
|
|
|
TTF_Init();
|
|
|
|
window = SDL_CreateWindow(windowTitle,SDL_WINDOWPOS_UNDEFINED,SDL_WINDOWPOS_UNDEFINED,windowWidth,windowHeight,SDL_WINDOW_FULLSCREEN);
|
|
|
|
window = SDL_CreateWindow(windowTitle,SDL_WINDOWPOS_UNDEFINED,SDL_WINDOWPOS_UNDEFINED,windowWidth,windowHeight,SDL_WINDOW_FULLSCREEN);
|
|
|
|
render = SDL_CreateRenderer(window, -1, 0);
|
|
|
|
render = SDL_CreateRenderer(window, -1, 0);
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
@ -90,50 +90,82 @@ int loadSlide(int nslide){
|
|
|
|
size_t len = 0;
|
|
|
|
size_t len = 0;
|
|
|
|
int nline = 1;
|
|
|
|
int nline = 1;
|
|
|
|
ssize_t read;
|
|
|
|
ssize_t read;
|
|
|
|
int slideType;
|
|
|
|
char * slideText;
|
|
|
|
char * slideName;
|
|
|
|
char * slideName;
|
|
|
|
|
|
|
|
int slideTextSize;
|
|
|
|
|
|
|
|
int slideTextRed;
|
|
|
|
|
|
|
|
int slideTextGreen;
|
|
|
|
|
|
|
|
int slideTextBlue;
|
|
|
|
|
|
|
|
int slideTextX;
|
|
|
|
|
|
|
|
int slideTextY;
|
|
|
|
|
|
|
|
char * slideFont;
|
|
|
|
|
|
|
|
|
|
|
|
fp = fopen(slidesIndex, "r");
|
|
|
|
fp = fopen(slidesIndex, "r");
|
|
|
|
while ((read = getline(&line, &len, fp)) != -1) {
|
|
|
|
while ((read = getline(&line, &len, fp)) != -1) {
|
|
|
|
if (nslide == nline){
|
|
|
|
if (nslide == nline){
|
|
|
|
actualSlide = line;
|
|
|
|
actualSlide = line;
|
|
|
|
char *token = strtok(actualSlide, ";");
|
|
|
|
char *token = strtok(actualSlide, ";");
|
|
|
|
int e;
|
|
|
|
int e;
|
|
|
|
for (e = 0; e < 2; e++) {
|
|
|
|
for (e = 0; e < 9; e++) {
|
|
|
|
if (e == 0){ slideType = atoi(token); }
|
|
|
|
if (e == 0){ slideName = token; }
|
|
|
|
if (e == 1){ slideName = token; slideName[ strlen(slideName) - 1 ] = '\0';}
|
|
|
|
if (e == 1){ slideTextSize = atoi(token); }
|
|
|
|
|
|
|
|
if (e == 2){ slideTextRed = atoi(token); }
|
|
|
|
|
|
|
|
if (e == 3){ slideTextGreen = atoi(token); }
|
|
|
|
|
|
|
|
if (e == 4){ slideTextBlue = atoi(token); }
|
|
|
|
|
|
|
|
if (e == 5){ slideTextX = atoi(token); }
|
|
|
|
|
|
|
|
if (e == 6){ slideTextY = atoi(token); }
|
|
|
|
|
|
|
|
if (e == 7){ slideFont = token; }
|
|
|
|
|
|
|
|
if (e == 8){ slideText = token; slideText[ strlen(slideText) - 1 ] = '\0'; }
|
|
|
|
token = strtok(NULL, ";");
|
|
|
|
token = strtok(NULL, ";");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
printf("%i %s\n", slideType, slideName);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
actualSlide[ strlen(actualSlide) - 1 ] = '\0';
|
|
|
|
|
|
|
|
SDL_Rect textureSlideRect = { 0, 0, windowWidth, windowHeight };
|
|
|
|
SDL_Rect textureSlideRect = { 0, 0, windowWidth, windowHeight };
|
|
|
|
IMG_Init(IMG_INIT_PNG);
|
|
|
|
IMG_Init(IMG_INIT_PNG);
|
|
|
|
if (slideType == 0){ textureSlide = IMG_LoadTexture(render, slideName); } // png
|
|
|
|
printf("%s %s\n", slideName, slideText);
|
|
|
|
if (slideType == 1){ textureSlide = IMG_LoadTexture(render, slideName); } // gif incompleto ahora mismo pero ya detectado
|
|
|
|
textureSlide = IMG_LoadTexture(render, slideName);
|
|
|
|
SDL_RenderCopy(render, textureSlide, NULL, &textureSlideRect);
|
|
|
|
SDL_RenderCopy(render, textureSlide, NULL, &textureSlideRect);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TTF_Font* font = TTF_OpenFont(slideFont, slideTextSize);
|
|
|
|
|
|
|
|
SDL_Color textColor = {slideTextRed, slideTextGreen, slideTextBlue, 255};
|
|
|
|
|
|
|
|
SDL_Surface *textSurface = TTF_RenderText_Solid(font, slideText, textColor);
|
|
|
|
|
|
|
|
SDL_Texture *textTexture = SDL_CreateTextureFromSurface(render, textSurface);
|
|
|
|
|
|
|
|
SDL_Rect textRect = {slideTextX, slideTextY, textSurface->w, textSurface->h};
|
|
|
|
|
|
|
|
SDL_RenderCopy(render, textTexture, NULL, &textRect);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
nline = nline +1;
|
|
|
|
nline = nline +1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fclose(fp);
|
|
|
|
fclose(fp);
|
|
|
|
nline = nline - 1;
|
|
|
|
nline = nline - 1;
|
|
|
|
if (line){ free(line); };
|
|
|
|
if (line){ free(line); };
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int transition_BackToBlack(void){
|
|
|
|
int transition_BackToBlack(void){
|
|
|
|
SDL_SetRenderDrawBlendMode(render, SDL_BLENDMODE_BLEND);
|
|
|
|
SDL_SetRenderDrawBlendMode(render, SDL_BLENDMODE_BLEND);
|
|
|
|
SDL_Rect barra = { 0, 0, windowWidth, windowHeight };
|
|
|
|
SDL_Rect barra = { 0, 0, windowWidth, windowHeight };
|
|
|
|
|
|
|
|
|
|
|
|
int z;
|
|
|
|
int z;
|
|
|
|
for (z = 250; z > 0; z = z -10) {
|
|
|
|
for (z = 250; z > 0; z = z -10) {
|
|
|
|
loadSlide(actualNSlide);
|
|
|
|
loadSlide(actualNSlide);
|
|
|
|
refreshVolumeArea(iv);
|
|
|
|
refreshVolumeArea(iv);
|
|
|
|
SDL_SetRenderDrawColor(render, 0, 0, 0, z);
|
|
|
|
SDL_SetRenderDrawColor(render, 0, 0, 0, z);
|
|
|
|
SDL_RenderFillRect(render, &barra);
|
|
|
|
SDL_RenderFillRect(render, &barra);
|
|
|
|
SDL_RenderPresent(render);
|
|
|
|
SDL_RenderPresent(render);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int effect_enableTransition(void){ // red blink on the volume area box
|
|
|
|
|
|
|
|
SDL_SetRenderDrawBlendMode(render, SDL_BLENDMODE_BLEND);
|
|
|
|
|
|
|
|
int z;
|
|
|
|
|
|
|
|
for (z = 250; z > 0; z = z -10) {
|
|
|
|
|
|
|
|
loadSlide(actualNSlide);
|
|
|
|
|
|
|
|
refreshVolumeArea(iv);
|
|
|
|
|
|
|
|
SDL_Rect barra = { 913, 24, 94, 12 };
|
|
|
|
|
|
|
|
SDL_SetRenderDrawColor(render, 255, 0, 0, z);
|
|
|
|
|
|
|
|
SDL_RenderFillRect(render, &barra);
|
|
|
|
|
|
|
|
SDL_RenderPresent(render);
|
|
|
|
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -158,7 +190,6 @@ int main(int argc, char ** argv) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while (!quit) {
|
|
|
|
while (!quit) {
|
|
|
|
SDL_WaitEvent(&evento);
|
|
|
|
SDL_WaitEvent(&evento);
|
|
|
|
|
|
|
|
|
|
|
|
@ -234,9 +265,11 @@ int main(int argc, char ** argv) {
|
|
|
|
case SDLK_F1:
|
|
|
|
case SDLK_F1:
|
|
|
|
if (transition_active == 0){
|
|
|
|
if (transition_active == 0){
|
|
|
|
transition_active = 1;
|
|
|
|
transition_active = 1;
|
|
|
|
|
|
|
|
effect_enableTransition();
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
|
transition_active = 0;
|
|
|
|
transition_active = 0;
|
|
|
|
}
|
|
|
|
effect_enableTransition();
|
|
|
|
|
|
|
|
};
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|