本文整理汇总了C++中_S_Plane::fpDraw方法的典型用法代码示例。如果您正苦于以下问题:C++ _S_Plane::fpDraw方法的具体用法?C++ _S_Plane::fpDraw怎么用?C++ _S_Plane::fpDraw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类_S_Plane
的用法示例。
在下文中一共展示了_S_Plane::fpDraw方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
system("clear");
for(int i=0;i<2;i++) {
map_init(&gScreenBuf[i]);
map_new(&gScreenBuf[i],35,16);
}
map_init(&gPlayer);
map_load(&gPlayer,"plane1.dat");
Plane_init(&gPlayerObject,&gPlayer,17,10);
set_conio_terminal_mode();
acc_tick = last_tick = 0;
while(bLoop) {
//타이밍처리
clock_gettime(CLOCK_MONOTONIC,&work_timer);
double cur_tick = work_timer.tv_sec + (double)(work_timer.tv_nsec * 1e-9);
double delta_tick = cur_tick - last_tick;
last_tick = cur_tick;
//실시간입력
if(kbhit() != 0) {
char ch = getch();
if(ch == 'q') {
bLoop = 0;
puts("bye~\r");
}
//gPlayerObject.fpApply(&gPlayerObject,delta_tick,ch);
gPlayerObject.fpApply(&gPlayerObject,delta_tick,ch);
}
//타이밍계산
acc_tick += delta_tick;
if(acc_tick > 0.1) {
//puts("tick...\r");
gotoxy(0,0);
map_drawTile(&gScreenBuf[0],0,0,&gScreenBuf[1]);
gPlayerObject.fpDraw(&gPlayerObject,&gScreenBuf[1]);
//Plane_Draw(&gPlayerObject,&gScreenBuf[1]);
map_dump(&gScreenBuf[1],Default_Tilepalete);
acc_tick = 0;
}
}
return 0;
}
示例2: main
int main()
{
set_conio_terminal_mode();
acc_tick=last_tick=0;
system("clear");
for(int i =0;i<2;i++) //총알
{
map_init(&gScreenBuffer[i]);
map_new(&gScreenBuffer[i],35,16);
}
map_init(&gPlayer);
map_load(&gPlayer,"plane1.dat");
Plane_init(&gPlayerObject,&gPlayer,17,10);
double target_x,target_y;
double center_x,center_y;
center_x = 14;
center_y = 7;
target_x = 14;
target_y = 3;
double angle = 0;
while(bLoop) {
//타이밍처리
clock_gettime(CLOCK_MONOTONIC,&work_timer);
double cur_tick = work_timer.tv_sec +
(double)(work_timer.tv_nsec * 1e-9);
double delta_tick = cur_tick - last_tick;
last_tick = cur_tick;
//실시간 입력
if(kbhit() != 0) {
char ch = getch();
if(ch == 'q') {
bLoop = 0;
puts("bye~ \r");
}
//Plane_Apply(&gPlayerObject,delta_tick,ch);
gPlayerObject.fpApply(&gPlayerObject,delta_tick,ch);
}
//apply 위치
angle += (delta_tick * 45);
double tx,ty;
double rad = angle/180.0 * 3.141592;
tx = (target_x - center_x) *cos(rad) - (target_y - center_y) * sin(rad);
ty = (target_x - center_x) *sin(rad) - (target_y - center_y) * cos(rad);
tx += center_x;
ty += center_y;
//타이밍 계산
acc_tick += delta_tick;
if(acc_tick > 0.1) {
//puts("tick...\r");
gotoxy(0,0);
//map_drawTile(&gScreenBuf[0],0,0,&gScreenBuf[1]);
map_drawTile(&gScreenBuffer[0],0,0,&gScreenBuffer[1]);
map_PutTile(&gScreenBuffer[1],tx,ty,2);
map_PutTile(&gScreenBuffer[1],center_x,center_y,5);
map_PutTile(&gScreenBuffer[1],target_x,target_y,1) ;
gPlayerObject.fpDraw(&gPlayerObject,&gScreenBuffer[1]);
//gotoxy(0,0);
//Plane_Draw(&gPlayerObject,&gScreenBuf[1]);
//map_dump(&gScreenBuf[1],Default_Tilepalete);
map_dump(&gScreenBuffer[1],Default_Tilepalete);
acc_tick = 0;
}
}
return 0;
}