Skip to content

Commit

Permalink
gif support added
Browse files Browse the repository at this point in the history
  • Loading branch information
inumakieu committed Oct 24, 2020
1 parent 14c12d1 commit 6eb7b08
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 21 deletions.
7 changes: 3 additions & 4 deletions include/giflib/CEV_gifDeflate.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ void L_gifDicoStringOutput(L_GifDico*, L_GifDicoEntry, uint8_t*, unsigned int*,
void L_gifDicoOutputRepeat(L_GifDico*, int16_t, uint8_t*, unsigned int*, unsigned int);//local
void L_gifStreamValueOutput(uint8_t, uint8_t*, unsigned int*, unsigned int);//local

char CEV_gifReadWriteErr;
int CEV_gifReadWriteErr = 0;


/***Functions Implementation**/
Expand All @@ -117,7 +117,6 @@ L_GifFile *L_gifLoadRW(SDL_RWops* file)
unsigned char
endOfFile=0;

CEV_gifReadWriteErr = 0;

/*creating new gif structure*/
gif = L_gifCreate();
Expand Down Expand Up @@ -174,7 +173,7 @@ int L_gifExtFillRW(L_GifFile *gif, SDL_RWops* file)
{/*switch file extension type*/

case 0xf9 : /*Graphics Control Extension*/
L_gifGceFillRW(&gif->gce, file);/*vérifié*/
L_gifGceFillRW(&gif->gce, file);/*v�rifi�*/
break;

/* TODO (cedric#1#): eventually to be taken into consideration but why ? */
Expand Down Expand Up @@ -431,7 +430,7 @@ int L_gifComExtFillRW(L_GifComExt *ext, SDL_RWops* file)

CEV_gifReadWriteErr++;

/*debug supprimé ici*/
/*debug supprim� ici*/
/*ext->text[temp-1]='\0';*/

if(CEV_gifReadWriteErr)
Expand Down
2 changes: 1 addition & 1 deletion include/giflib/CEV_gifDeflate.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ L_GifFile *L_gifLoadRW(SDL_RWops* file);
/*free all gif structure allocations*/
void L_gifFileFree(L_GifFile*);

extern char CEV_gifReadWriteErr;
extern int CEV_gifReadWriteErr;


#ifdef __cplusplus
Expand Down
32 changes: 18 additions & 14 deletions source/homescreen.cpp
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
#include "homescreen.h"
#include <giflib/CEV_gif.h>
#include <iostream>

homescreen::homescreen(SDL_Renderer *r) : base_screen(r){};

CEV_GifAnim *animation;
SDL_Texture *actTexture = NULL;

SDL_Rect blitPos = { 0, 0, 1280, 720 };

void homescreen::init()
{

chdir("romfs:/assets/UI/");
animation = CEV_gifAnimLoad("test.gif", renderer);

actTexture = CEV_gifTexture(animation);
CEV_gifLoopMode(animation, GIF_REPEAT_FOR);
if (animation != NULL)
{
actTexture = CEV_gifTexture(animation);
CEV_gifLoopMode(animation, GIF_REPEAT_FOR);
}
else
{
std::cout << "file did not load correctly" << '\n';
}

std::string name;
SDL_Rect temp_rect = {0, 0, 1280, 720};
Expand Down Expand Up @@ -153,11 +155,13 @@ void homescreen::update(std::vector<Title> titles, std::unordered_map<u64, SDL_T
**/

// gif wallpaper test

CEV_gifAnimAuto(animation);
SDL_RenderClear(renderer);
SDL_RenderCopy(renderer, actTexture, NULL, &blitPos);
SDL_RenderPresent(renderer);
if (animation != NULL)
{
CEV_gifAnimAuto(animation);
SDL_RenderClear(renderer);
SDL_RenderCopy(renderer, actTexture, NULL, &blitPos);
SDL_RenderPresent(renderer);
}

//SDL_RenderCopy(renderer, t, NULL, &r);
draw_top_menu();
Expand Down
7 changes: 5 additions & 2 deletions source/homescreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <SDL_image.h>
#include <switch.h>
#include <vector>
#include <giflib/CEV_gif.h>

#include "base_screen.h"
#include "main.hpp"
Expand All @@ -16,10 +17,12 @@ class homescreen : public base_screen
SDL_Rect game_info_text_pos = {0, 306, 0, 0};
int selected = 0;

homescreen(SDL_Renderer *r);
CEV_GifAnim *animation;
SDL_Texture *actTexture = NULL;


SDL_Rect blitPos = {0, 0, 1280, 720};

homescreen(SDL_Renderer *r);

void init();

Expand Down

0 comments on commit 6eb7b08

Please sign in to comment.