Added Effect Labels (switchable) + rotozoom effect
This commit is contained in:
parent
cfdba88829
commit
db45c8e839
|
@ -27,11 +27,14 @@ set(SOURCES
|
|||
src/effects/firecube.cpp
|
||||
src/effects/morphfire.cpp
|
||||
src/effects/linemorph.cpp
|
||||
src/effects/rotozoom.cpp
|
||||
)
|
||||
|
||||
set(ASSETS_cg
|
||||
assets-cg/fontmatrix.png
|
||||
assets-cg/fontlabel.png
|
||||
assets-cg/bglens.png
|
||||
assets-cg/tile.png
|
||||
)
|
||||
|
||||
fxconv_declare_assets(${ASSETS_cg} WITH_METADATA)
|
||||
|
|
6
TODO.txt
6
TODO.txt
|
@ -4,6 +4,10 @@ To Add a Spline Morphing Effect with Fire
|
|||
|
||||
To Add a High Velocity Blur Effect
|
||||
|
||||
Check if the G90+E is powerful enough for Rotozoom / Tunnel Effect
|
||||
[Done = OK] Check if the G90+E is powerful enough for Rotozoom
|
||||
|
||||
Check if the G90+E is powerful enough for Tunnel Effect
|
||||
|
||||
Check if the G90+E is powerful enough for Liquid Metal / True Metaballs Effect
|
||||
|
||||
Check if the G90+E is powerful enough for Bump Mapping Effet + pick a good image for that effect
|
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
|
@ -4,9 +4,21 @@ fontmatrix.png:
|
|||
charset: print
|
||||
grid.size: 9x14
|
||||
|
||||
fontlabel.png:
|
||||
type: font
|
||||
name: font_label
|
||||
charset: print
|
||||
grid.size: 10x13
|
||||
grid.padding: 0
|
||||
grid.border: 0
|
||||
proportional: true
|
||||
|
||||
bglens.png:
|
||||
type: bopti-image
|
||||
profile: p8
|
||||
name: bglens
|
||||
|
||||
|
||||
tile.png:
|
||||
type: bopti-image
|
||||
profile: p8
|
||||
name: tilerotozoom
|
Binary file not shown.
After Width: | Height: | Size: 56 KiB |
|
@ -9,6 +9,7 @@
|
|||
|
||||
/* EFFECT #1 : PLASMA EFFECT */
|
||||
|
||||
char *plasma_text( void );
|
||||
void plasma_init( bopti_image_t *screen );
|
||||
void plasma_update( bopti_image_t *screen, float dt );
|
||||
void plasma_render( bopti_image_t *screen );
|
||||
|
@ -17,6 +18,7 @@ void plasma_deinit( bopti_image_t *screen );
|
|||
|
||||
/* EFFECT #2 : MORPHING EFFECT : FROM SPHERE TO TORUS */
|
||||
|
||||
char *morph_text( void );
|
||||
void morph_init( bopti_image_t *screen );
|
||||
void morph_update( bopti_image_t *screen, float dt );
|
||||
void morph_render( bopti_image_t *screen );
|
||||
|
@ -25,6 +27,7 @@ void morph_deinit( bopti_image_t *screen );
|
|||
|
||||
/* EFFECT #3 : MATRIX EFFECT */
|
||||
|
||||
char *matrix_text( void );
|
||||
void matrix_init( bopti_image_t *screen );
|
||||
void matrix_update( bopti_image_t *screen, float dt );
|
||||
void matrix_render( bopti_image_t *screen );
|
||||
|
@ -33,6 +36,7 @@ void matrix_deinit( bopti_image_t *screen );
|
|||
|
||||
/* EFFECT #4 : LENS EFFECT */
|
||||
|
||||
char *lens_text( void );
|
||||
void lens_init( bopti_image_t *screen );
|
||||
void lens_update( bopti_image_t *screen, float dt );
|
||||
void lens_render( bopti_image_t *screen );
|
||||
|
@ -41,6 +45,7 @@ void lens_deinit( bopti_image_t *screen );
|
|||
|
||||
/* EFFECT #5 : CUBEFIRE EFFECT */
|
||||
|
||||
char *firecube_text( void );
|
||||
void firecube_init( bopti_image_t *screen );
|
||||
void firecube_update( bopti_image_t *screen, float dt );
|
||||
void firecube_render( bopti_image_t *screen );
|
||||
|
@ -48,19 +53,30 @@ void firecube_deinit( bopti_image_t *screen );
|
|||
void Blur( bopti_image_t *screen );
|
||||
void drawline(bopti_image_t *screen, int x1, int y1, int x2, int y2, uint8_t color);
|
||||
|
||||
/* EFFECT #2 : MORPHING EFFECT : FROM SPHERE TO TORUS */
|
||||
/* EFFECT #6 : MORPHING EFFECT WITH FIRE : FROM SPHERE TO TORUS */
|
||||
|
||||
char *morphfire_text( void );
|
||||
void morphfire_init( bopti_image_t *screen );
|
||||
void morphfire_update( bopti_image_t *screen, float dt );
|
||||
void morphfire_render( bopti_image_t *screen );
|
||||
void morphfire_deinit( bopti_image_t *screen );
|
||||
|
||||
|
||||
/* EFFECT #2 : MORPHING EFFECT : FROM SPHERE TO TORUS */
|
||||
/* EFFECT #7 : MORPHING EFFECT : BOUNCING LINE ON SCREEN */
|
||||
|
||||
char *linemorph_text( void );
|
||||
void linemorph_init( bopti_image_t *screen );
|
||||
void linemorph_update( bopti_image_t *screen, float dt );
|
||||
void linemorph_render( bopti_image_t *screen );
|
||||
void linemorph_deinit( bopti_image_t *screen );
|
||||
|
||||
|
||||
/* EFFECT #8 : ROTOZOOM EFFECT */
|
||||
|
||||
char *rotozoom_text( void );
|
||||
void rotozoom_init( bopti_image_t *screen );
|
||||
void rotozoom_update( bopti_image_t *screen, float dt );
|
||||
void rotozoom_render( bopti_image_t *screen );
|
||||
void rotozoom_deinit( bopti_image_t *screen );
|
||||
|
||||
#endif
|
||||
|
|
|
@ -164,4 +164,12 @@ void firecube_render( bopti_image_t *screen )
|
|||
void firecube_deinit( bopti_image_t *screen )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
char firecube_TextToRender[100] = "Mesmerizing Rotating & Burning Cube > _\0";
|
||||
|
||||
char *firecube_text( void )
|
||||
{
|
||||
return firecube_TextToRender;
|
||||
}
|
|
@ -99,4 +99,12 @@ void lens_render( bopti_image_t *screen )
|
|||
void lens_deinit( bopti_image_t *screen )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
char lens_TextToRender[100] = "Classical Lens Magnification > _\0";
|
||||
|
||||
char *lens_text( void )
|
||||
{
|
||||
return lens_TextToRender;
|
||||
}
|
|
@ -79,4 +79,12 @@ void linemorph_render( bopti_image_t *screen )
|
|||
void linemorph_deinit( bopti_image_t *screen )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
char linemorph_TextToRender[100] = "Simple Blured & Bouncing Line > _\0";
|
||||
|
||||
char *linemorph_text( void )
|
||||
{
|
||||
return linemorph_TextToRender;
|
||||
}
|
|
@ -95,4 +95,12 @@ void matrix_render( bopti_image_t *screen )
|
|||
void matrix_deinit( bopti_image_t *screen )
|
||||
{
|
||||
free( strips );
|
||||
}
|
||||
|
||||
|
||||
char matrix_TextToRender[100] = "Enter The Matrix > _\0";
|
||||
|
||||
char *matrix_text( void )
|
||||
{
|
||||
return matrix_TextToRender;
|
||||
}
|
|
@ -138,4 +138,12 @@ void morph_render( bopti_image_t *screen )
|
|||
void morph_deinit( bopti_image_t *screen )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
char morph_TextToRender[100] = "Dot-Based Shapes Morphing > _\0";
|
||||
|
||||
char *morph_text( void )
|
||||
{
|
||||
return morph_TextToRender;
|
||||
}
|
|
@ -161,4 +161,12 @@ void morphfire_render( bopti_image_t *screen )
|
|||
void morphfire_deinit( bopti_image_t *screen )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
char morphfire_TextToRender[100] = "Morphing & Blur > _\0";
|
||||
|
||||
char *morphfire_text( void )
|
||||
{
|
||||
return morphfire_TextToRender;
|
||||
}
|
|
@ -82,4 +82,12 @@ void plasma_render( bopti_image_t *screen )
|
|||
void plasma_deinit( bopti_image_t *screen )
|
||||
{
|
||||
free( aSin );
|
||||
}
|
||||
|
||||
|
||||
char plasma_TextToRender[100] = "Plasma Sinusoids > _\0";
|
||||
|
||||
char *plasma_text( void )
|
||||
{
|
||||
return plasma_TextToRender;
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
#include "effects.h"
|
||||
|
||||
#include <num/num.h>
|
||||
#include "../utilities/fast_trig.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <gint/rtc.h>
|
||||
|
||||
|
||||
extern bopti_image_t tilerotozoom;
|
||||
|
||||
static int roto[256];
|
||||
static int roto2[256];
|
||||
|
||||
unsigned path = 0;
|
||||
unsigned zpath = 0;
|
||||
|
||||
|
||||
void rotozoom_init( bopti_image_t *screen )
|
||||
{
|
||||
image_copy_palette( &tilerotozoom, screen, -1 );
|
||||
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
float rad = (float)i * 1.41176 * 0.0174532;
|
||||
float c = sin(rad);
|
||||
roto[i] = (int) ((c + 0.8) * 4096.0);
|
||||
roto2[i] = (int) ((2.0 * c) * 4096.0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void draw_tile(bopti_image_t *screen, int stepx, int stepy, int zoom)
|
||||
{
|
||||
int8_t *image = (int8_t *)screen->data;
|
||||
int8_t *texture = (int8_t *)tilerotozoom.data;
|
||||
int x, y, i, j, xd, yd, a, b, sx, sy;
|
||||
sx = sy = 0;
|
||||
xd = (stepx * zoom) >> 12;
|
||||
yd = (stepy * zoom) >> 12;
|
||||
|
||||
for (j = 0; j < MAXHEIGHT; j++)
|
||||
{
|
||||
x = sx; y = sy;
|
||||
for (i = 0; i < screen->stride; i++)
|
||||
{
|
||||
a = x >> 12 & 255;
|
||||
b = y >> 12 & 255;
|
||||
*image++ = texture[b * tilerotozoom.stride + a];
|
||||
x += xd; y += yd;
|
||||
}
|
||||
sx -= yd; sy += xd;
|
||||
}
|
||||
}
|
||||
|
||||
void rotozoom_update( bopti_image_t *screen, [[Maybe_unused]] float dt )
|
||||
{
|
||||
draw_tile( screen, roto[path], roto[(path + 128) & 255], roto2[zpath]);
|
||||
|
||||
path = (path - 1) & 255;
|
||||
zpath = (zpath + 1) & 255;
|
||||
}
|
||||
|
||||
|
||||
void rotozoom_render( bopti_image_t *screen )
|
||||
{
|
||||
dimage(0,0,screen);
|
||||
}
|
||||
|
||||
|
||||
void rotozoom_deinit( bopti_image_t *screen )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
char rotozoom_TextToRender[100] = "Classical Amiga-Like Rotozoom > _\0";
|
||||
|
||||
char *rotozoom_text( void )
|
||||
{
|
||||
return rotozoom_TextToRender;
|
||||
}
|
32
src/main.cpp
32
src/main.cpp
|
@ -22,20 +22,24 @@
|
|||
|
||||
#include "effects/effects.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
|
||||
#define TOTAL_NB_EFFECT 7
|
||||
#define TOTAL_NB_EFFECT 8
|
||||
typedef void (*PtrToFunc)( bopti_image_t * );
|
||||
typedef void (*PtrToFuncDt)( bopti_image_t *, float );
|
||||
typedef char* (*PtrTextFunc)( void );
|
||||
|
||||
PtrToFunc Effects_Init[] = { &linemorph_init, &plasma_init, &morph_init, &lens_init, &firecube_init, &matrix_init, &morphfire_init };
|
||||
PtrToFuncDt Effects_Update[] = { &linemorph_update, &plasma_update, &morph_update, &lens_update, &firecube_update, &matrix_update, &morphfire_update };
|
||||
PtrToFunc Effects_Render[] = { &linemorph_render, &plasma_render, &morph_render, &lens_render, &firecube_render, &matrix_render, &morphfire_render };
|
||||
PtrToFunc Effects_DeInit[] = { &linemorph_deinit, &plasma_deinit, &morph_deinit, &lens_deinit, &firecube_deinit, &matrix_deinit, &morphfire_deinit };
|
||||
PtrTextFunc Effect_Text[] = { &rotozoom_text, &linemorph_text, &plasma_text, &morph_text, &lens_text, &firecube_text, &matrix_text, &morphfire_text };
|
||||
PtrToFunc Effects_Init[] = { &rotozoom_init, &linemorph_init, &plasma_init, &morph_init, &lens_init, &firecube_init, &matrix_init, &morphfire_init };
|
||||
PtrToFuncDt Effects_Update[] = { &rotozoom_update, &linemorph_update, &plasma_update, &morph_update, &lens_update, &firecube_update, &matrix_update, &morphfire_update };
|
||||
PtrToFunc Effects_Render[] = { &rotozoom_render, &linemorph_render, &plasma_render, &morph_render, &lens_render, &firecube_render, &matrix_render, &morphfire_render };
|
||||
PtrToFunc Effects_DeInit[] = { &rotozoom_deinit, &linemorph_deinit, &plasma_deinit, &morph_deinit, &lens_deinit, &firecube_deinit, &matrix_deinit, &morphfire_deinit };
|
||||
int current_effect = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
#if(MORE_RAM)
|
||||
static kmalloc_arena_t extended_ram = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0,0,0,0,0,0 };
|
||||
static kmalloc_arena_t *_uram;
|
||||
|
@ -53,7 +57,7 @@ bool skip_intro = false;
|
|||
bool screenshot = false;
|
||||
bool record = false;
|
||||
bool showFPS = false;
|
||||
|
||||
bool showName = true;
|
||||
|
||||
bool choosePrevious = false;
|
||||
bool chooseNext = false;
|
||||
|
@ -69,7 +73,7 @@ prof_t perf_update, perf_render;
|
|||
|
||||
|
||||
extern font_t font_matrix;
|
||||
|
||||
extern font_t font_label;
|
||||
|
||||
|
||||
bopti_image_t *screen;
|
||||
|
@ -165,16 +169,23 @@ void FreeMoreRAM( void )
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void Initialise( void )
|
||||
{
|
||||
(*Effects_Init[ current_effect ])( screen );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void Render( void )
|
||||
{
|
||||
(*Effects_Render[ current_effect ])( screen );
|
||||
|
||||
if (showName)
|
||||
{
|
||||
dfont( &font_label );
|
||||
dprint( 10, 205, C_WHITE, "%s", (*Effect_Text[current_effect])() );
|
||||
}
|
||||
}
|
||||
|
||||
static void Update( [[maybe_unused]] float dt )
|
||||
|
@ -194,6 +205,7 @@ static void GetInputs( [[maybe_unused]] float dt )
|
|||
if (Keyboard.IsKeyPressed(MYKEY_EXIT)) {exitToOS = true; };
|
||||
|
||||
if (Keyboard.IsKeyPressedEvent(MYKEY_F3)) showFPS = !showFPS;
|
||||
if (Keyboard.IsKeyPressedEvent(MYKEY_F4)) showName = !showName;
|
||||
|
||||
if ((Keyboard.IsKeyPressedEvent(MYKEY_F1) || choosePrevious) && current_effect>=1)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue