2019-08-28 04:12:10 +00:00
|
|
|
/* for demoscene, you need a plasma effect... */
|
|
|
|
/* https://rosettacode.org/wiki/Plasma_effect */
|
|
|
|
/* https://www.bidouille.org/prog/plasma */
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <math.h>
|
|
|
|
|
|
|
|
#include "tfv_zp.h"
|
|
|
|
#include "gr-sim.h"
|
|
|
|
|
2021-01-09 06:41:44 +00:00
|
|
|
#define PI 3.14159265358979323846264338327950
|
2019-08-28 04:12:10 +00:00
|
|
|
|
|
|
|
|
2021-01-09 06:41:44 +00:00
|
|
|
#if 1
|
2019-08-28 18:53:02 +00:00
|
|
|
static unsigned char color_lookup[]={0x0, 0x0, 0x5, 0x5,
|
|
|
|
0x7, 0x7, 0xf, 0xf,
|
|
|
|
0x7, 0x7, 0x6, 0x6,
|
|
|
|
0x2, 0x2, 0x5, 0x5};
|
2021-01-09 06:41:44 +00:00
|
|
|
#else
|
2019-08-28 18:53:02 +00:00
|
|
|
|
|
|
|
static unsigned char color_lookup[]={0x0, 0x5, 0x7, 0xf,
|
|
|
|
0x7, 0x6, 0x2, 0x5,
|
|
|
|
0x0, 0x5, 0x7, 0xf,
|
|
|
|
0x7, 0x6, 0x2, 0x5};
|
|
|
|
|
2021-01-09 06:41:44 +00:00
|
|
|
#endif
|
2019-08-28 04:12:10 +00:00
|
|
|
|
2021-01-09 06:41:44 +00:00
|
|
|
static int offscreen[40][40];
|
2019-08-28 04:12:10 +00:00
|
|
|
|
|
|
|
int main(int argc, char **argv) {
|
|
|
|
|
2019-08-28 18:53:02 +00:00
|
|
|
int ch,xx,yy,col;
|
2019-08-28 04:12:10 +00:00
|
|
|
|
|
|
|
grsim_init();
|
|
|
|
|
|
|
|
gr();
|
2019-08-28 18:53:02 +00:00
|
|
|
soft_switch(MIXCLR);
|
2019-08-28 04:12:10 +00:00
|
|
|
|
2019-08-28 18:53:02 +00:00
|
|
|
clear_screens();
|
2019-08-28 04:12:10 +00:00
|
|
|
|
|
|
|
ram[DRAW_PAGE]=0x0;
|
|
|
|
|
2021-01-09 06:41:44 +00:00
|
|
|
for(yy=0;yy<40;yy++) {
|
|
|
|
for(xx=0;xx<40;xx++) {
|
2019-08-28 18:53:02 +00:00
|
|
|
|
2021-01-09 06:41:44 +00:00
|
|
|
// col = ( 32.0 + (32.0 * sin(xx / 4.0))
|
|
|
|
// + 32.0 + (32.0 * sin(yy / 4.0))
|
|
|
|
// ) / 2;
|
2019-08-28 04:12:10 +00:00
|
|
|
|
|
|
|
|
2021-01-09 06:41:44 +00:00
|
|
|
col = ( 8.0 + (8.0 * sin(xx *PI/8.0))
|
|
|
|
+ 8.0 + (8.0 * sin(yy *PI/8.0))
|
|
|
|
) / 2;
|
2019-08-28 04:12:10 +00:00
|
|
|
|
2021-01-09 06:41:44 +00:00
|
|
|
offscreen[xx][yy]=col;
|
|
|
|
}
|
|
|
|
}
|
2019-08-28 18:53:02 +00:00
|
|
|
|
2021-01-09 06:41:44 +00:00
|
|
|
while(1) {
|
|
|
|
for(yy=0;yy<40;yy++) {
|
|
|
|
for(xx=0;xx<40;xx++) {
|
|
|
|
col=offscreen[xx][yy];
|
2019-08-28 18:53:02 +00:00
|
|
|
color_equals(color_lookup[col]);
|
2021-01-09 06:41:44 +00:00
|
|
|
col++;
|
|
|
|
col&=0xf;
|
|
|
|
offscreen[xx][yy]=col;
|
2019-08-28 04:12:10 +00:00
|
|
|
plot(xx,yy);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
grsim_update();
|
|
|
|
ch=grsim_input();
|
|
|
|
if (ch=='q') exit(0);
|
2019-08-28 18:53:02 +00:00
|
|
|
|
|
|
|
if (ch==' ') {
|
|
|
|
while(1) {
|
|
|
|
ch=grsim_input();
|
|
|
|
if (ch) break;
|
|
|
|
}
|
|
|
|
}
|
2021-01-09 06:41:44 +00:00
|
|
|
usleep(200000);
|
2019-08-28 04:12:10 +00:00
|
|
|
}
|
|
|
|
|
2021-01-09 06:41:44 +00:00
|
|
|
|
2019-08-28 04:12:10 +00:00
|
|
|
return 0;
|
|
|
|
}
|