mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-12-27 02:31:00 +00:00
gr-sim: add rotate demo
This commit is contained in:
parent
cef9b0c106
commit
63e9d91e6b
28
gr-sim/rotate_wipe/Makefile
Normal file
28
gr-sim/rotate_wipe/Makefile
Normal file
@ -0,0 +1,28 @@
|
||||
CC = gcc
|
||||
CFLAGS = -Wall -O2 -I.. -g
|
||||
LFLAGS = -lm
|
||||
|
||||
SDL_LIBS= `sdl-config --libs`
|
||||
SDL_INCLUDE= `sdl-config --cflags`
|
||||
GR_SIM = ../gr-sim.a
|
||||
|
||||
all: rotate
|
||||
|
||||
|
||||
####
|
||||
#demo_title.c: ../gr-utils/png2rle ../tfv/demo.png
|
||||
# ../gr-utils/png2rle c ../tfv/demo.png demo_rle > demo_title.c
|
||||
|
||||
|
||||
####
|
||||
|
||||
rotate: rotate.o $(GR_SIM)
|
||||
$(CC) $(LFLAGS) $(SDL_LIBS) -o rotate rotate.o $(GR_SIM)
|
||||
|
||||
rotate.o: rotate.c demo_title.c
|
||||
$(CC) $(CFLAGS) -c rotate.c
|
||||
|
||||
####
|
||||
|
||||
clean:
|
||||
rm -f *~ *.o rotate
|
53
gr-sim/rotate_wipe/demo_title.c
Normal file
53
gr-sim/rotate_wipe/demo_title.c
Normal file
@ -0,0 +1,53 @@
|
||||
unsigned char demo_rle[]={
|
||||
0x28, /* ysize=40 */
|
||||
0xAF,0x00,0xA7,0xCC,0x40,0xA0,0x21,0x00,0xA4,0x04,0xCC,0xCC,0x44,
|
||||
0xA0,0x11,0x00,0xFF,0x6F,0xA3,0xFF,0x6F,0xFF,0x2F,
|
||||
0xFF,0x6F,0x6F,0xFF,0x2F,0x2F,0xFF,0x50,0xA3,0x00,
|
||||
0xC0,0xCC,0x4C,0x44,0x00,0xFF,0x6F,0x6F,
|
||||
0xFF,0x2F,0x2F,0x6F,0xA3,0xFF,0x6F,0xFF,0x2F,
|
||||
0xFF,0xFF,0x50,0xFF,0x66,0xF6,0x6F,0xF6,
|
||||
0x66,0x22,0xFF,0x22,0x66,0xFF,0x66,
|
||||
0x22,0x2F,0xFF,0x55,0x00,0x00,0xC0,0xCC,
|
||||
0x4C,0x44,0x00,0x00,0xFF,0x66,0xFF,0x66,
|
||||
0x22,0x2F,0x66,0xF6,0x6F,0xF6,0x66,
|
||||
0x22,0xFF,0x22,0xFF,0x55,0xFF,0x66,
|
||||
0xA3,0xFF,0x66,0x22,0xFF,0x22,0x66,0xFF,
|
||||
0x66,0x22,0xFF,0xFF,0x55,0x00,0xC0,0xCC,
|
||||
0x4C,0x44,0xA3,0x00,0xFF,0x66,0xFF,0x66,
|
||||
0x22,0xF2,0x66,0xA3,0xFF,0x66,0x22,0xFF,
|
||||
0x22,0xFF,0x55,0xFF,0xF6,0xA3,0xFF,0xF6,
|
||||
0xFF,0xF2,0xFF,0xF6,0xF6,0xFF,0xF2,0xF2,0xFF,
|
||||
0x55,0x00,0xCC,0xCC,0x44,0xA4,0x00,0xFF,0xF6,0xF6,
|
||||
0xFF,0xF2,0xF2,0xF6,0xA3,0xFF,0xF6,0xFF,0xF2,
|
||||
0xFF,0xFF,0x55,0x00,0xAF,0x05,0x00,0xCC,0xCC,0x44,
|
||||
0xA5,0x00,0xAF,0x05,0xA3,0x00,0xA8,0x80,0xA6,0x00,0xCC,0xCC,0x44,
|
||||
0xA0,0x17,0x00,0x88,0x88,0xA4,0x28,0xB8,0x28,0xA3,0x20,0xA4,0x00,
|
||||
0x04,0x04,0xA0,0x18,0x00,0x88,0x22,0xFB,0x0B,0x22,
|
||||
0xB2,0x22,0xFB,0x0B,0x22,0x00,0x00,0x60,
|
||||
0x76,0xA0,0x14,0x00,0x10,0xA5,0x00,0x88,0xA4,0xB2,0x3B,
|
||||
0x32,0xB2,0x02,0x02,0x00,0x60,0x76,0x07,
|
||||
0xA0,0x11,0x00,0x10,0x00,0x10,0x11,0x01,0xA4,0x00,
|
||||
0x88,0x55,0xA5,0xBB,0xA3,0x00,0x60,0x76,0x07,
|
||||
0xA6,0x00,0xD0,0x0D,0x00,0xD0,0x0D,0x00,
|
||||
0xD0,0xA5,0x00,0x11,0xA8,0x00,0x88,0x85,0xA3,0xBB,
|
||||
0xB1,0x0B,0x00,0x0D,0xD0,0x76,0x07,
|
||||
0xA5,0x00,0xD0,0xDD,0xD0,0xD0,0xDD,0xD0,0xD0,0xDD,
|
||||
0xD0,0xA3,0x00,0x01,0x01,0x11,0x01,0x01,0xA5,0x00,0x80,
|
||||
0x88,0x98,0xB8,0xB3,0xB3,0xB0,0x30,0x33,
|
||||
0xF3,0xFF,0xFD,0xA3,0xF0,0xA3,0x00,0xDD,0xA7,0xBB,
|
||||
0xDD,0xA4,0x00,0x10,0x11,0x10,0xA6,0x00,0x88,
|
||||
0xA3,0x99,0x9B,0xBB,0xBB,0x9B,0x93,0x00,0xFF,0xFF,
|
||||
0xF7,0xF0,0xFF,0xFF,0x70,0x00,0xDD,0xBB,
|
||||
0xBF,0xB0,0xBB,0xBF,0xB0,0xBB,0xDD,
|
||||
0xA3,0x00,0x10,0xA3,0x11,0x10,0xA5,0x00,0x08,0x99,
|
||||
0xB9,0xA6,0x99,0x80,0xA3,0x8F,0xFF,0xFF,0x0F,0x07,
|
||||
0x00,0xDD,0xDB,0xBB,0x3B,0x33,0xBB,0xBB,
|
||||
0xDB,0xDD,0xA3,0x00,0x01,0x01,0x11,0x01,0x01,0xA6,0x00,
|
||||
0x99,0xBB,0xA4,0x99,0x09,0x80,0xA4,0xFF,0xF7,
|
||||
0x0F,0xA3,0x00,0xDD,0xDD,0xA5,0xBB,0xDD,0xDD,0xA5,0x00,0x11,
|
||||
0xA8,0x00,0x99,0xBB,0xA3,0xB9,0x99,0x88,0xA5,0xFF,
|
||||
0xA5,0x00,0x0D,0x00,0xBB,0xA3,0xB1,0xBB,0x00,
|
||||
0x0D,0xA4,0x00,0xBB,0xBB,0xA7,0x00,0x99,0x99,0xA4,0x9B,0xFB,
|
||||
0xA6,0xFF,0xA8,0x00,0xBB,0xBB,0xA6,0x00,0x20,0x22,0x2B,
|
||||
0x0B,0xA6,0x00,0x90,0xA5,0x99,0xF9,0xA7,0xFF,0xA5,0x00,
|
||||
0x20,0xA6,0x22,0xA3,0x20,0x22,0x22,0x02,0xA6,0x00,0xA1, };
|
82
gr-sim/rotate_wipe/rotate.c
Normal file
82
gr-sim/rotate_wipe/rotate.c
Normal file
@ -0,0 +1,82 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "gr-sim.h"
|
||||
#include "tfv_utils.h"
|
||||
#include "tfv_zp.h"
|
||||
|
||||
#include "demo_title.c"
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
int xx,yy,ch,color,x2,y2;
|
||||
double h,theta,dx,dy,theta2,thetadiff,nx,ny;
|
||||
|
||||
|
||||
grsim_init();
|
||||
gr();
|
||||
|
||||
// clear_screens();
|
||||
|
||||
ram[DRAW_PAGE]=PAGE0;
|
||||
clear_bottom();
|
||||
ram[DRAW_PAGE]=PAGE1;
|
||||
clear_bottom();
|
||||
ram[DRAW_PAGE]=PAGE2;
|
||||
clear_bottom();
|
||||
|
||||
|
||||
// clear_bottom(PAGE0);
|
||||
// clear_bottom(PAGE1);
|
||||
// clear_bottom(PAGE2);
|
||||
|
||||
// grsim_unrle(demo_rle,0x400);
|
||||
grsim_unrle(demo_rle,0xc00);
|
||||
|
||||
// gr_copy_to_current(0xc00);
|
||||
// page_flip();
|
||||
// gr_copy_to_current(0xc00);
|
||||
// page_flip();
|
||||
|
||||
ram[DRAW_PAGE]=PAGE0;
|
||||
|
||||
thetadiff=0;
|
||||
|
||||
while(1) {
|
||||
grsim_update();
|
||||
|
||||
ch=repeat_until_keypressed();
|
||||
if (ch=='q') break;
|
||||
|
||||
for(yy=0;yy<40;yy++) {
|
||||
for(xx=0;xx<40;xx++) {
|
||||
dx=(xx-20);
|
||||
dy=(yy-20);
|
||||
h=sqrt((dx*dx)+(dy*dy));
|
||||
theta=atan2(dy,dx);
|
||||
|
||||
theta2=theta+thetadiff;
|
||||
nx=h*cos(theta2);
|
||||
ny=h*sin(theta2);
|
||||
|
||||
x2=nx+20;
|
||||
y2=ny+20;
|
||||
if ((x2<0) || (x2>39)) color=0;
|
||||
else if ((y2<0) || (y2>39)) color=0;
|
||||
else color=scrn_page(x2,y2,PAGE2);
|
||||
|
||||
color_equals(color);
|
||||
plot(xx,yy);
|
||||
}
|
||||
}
|
||||
thetadiff-=(3.14/8.0);
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user