|
#include <conio.h> #include <stdio.h> #include <string.h> #include <math.h> #include "glib.h"
#define RD 20 /* RD : radius of ball_screen */ #define XP 24 /* XP : expand view in monitor */ #define LR 0 #define UD 1
void chg3_2(int v[ ][2], double ob[ ][3], double sp[ ], double ag[ ] ); void graph(int p[ ][2]); void mov_obj(double obj[ ][3], int mov[ ] ); void mvrt_s(char k, double *sp, double sp_m, double *ag, double ag_m);
int dr=-1; main(){ int pt[8][2]={ }, col=3; char key=NULL; double spos_mov=16, ang_mov=0.1; double ang_sline[2]={ }; double obj1[ ][3]={{ 25, 25, 150}, { 25, -25, 150}, {-25, -25, 150}, {-25, 25, 150}, { 25, 25, 190}, { 25, -25, 190}, {-25, -25, 190}, {-25, 25, 190}}; double spos[3]={ 0, 0, 5 }; int mov1[3]={ };
puts("\x1b[2J"); /* clear screen */ puts("\x1b[>1h");/* funk-key off */ graphinit(); setcolor(col);
chg3_2(pt, obj1, spos, ang_sline); graph(pt); printf(" move L&R on [4],[6] \n move U&D on [8],[2] \n"); printf(" move F&B on [7],[0] \n"); printf(" speed up on [x] \n"); printf(" speed down on [z] \n"); printf(" rot U&D on U&D-arrow-keys \n"); printf(" rot L&R on L&R-arrow-keys \n"); printf("exit on [Q] \n");
while(key!='q' && key!='Q' && obj1[4][2]+mov1[2]-spos[2]>0.0 ) { key=getch(); mvrt_s( key, spos, spos_mov, ang_sline, ang_mov); mov_obj( obj1, mov1 ); chg3_2(pt, obj1, spos, ang_sline); gcls(); graph(pt);
}
}
void graph(int p[ ][2]) { int i; for(i=0; i<3; i++){ line( p[i][0], p[i][1], p[i+1][0], p[i+1][1]); line( p[i+4][0], p[i+4][1], p[i+5][0], p[i+5][1]); } for(i=0; i<4; i++) line( p[i+4][0], p[i+4][1], p[i][0], p[i][1] ); line( p[3][0], p[3][1], p[0][0], p[0][1] ); line( p[7][0], p[7][1], p[4][0], p[4][1] ); return; }
|