void PasPlay::Draw(){ // 描画処理 mBackground->Draw(); // 背景 mUnitAdmin->Draw(); // ゲームオブジェクト DrawPlayerStatusBar(200); // ステータスバー if(flgWarning) { DrawWarning(); } // ワーニング BoardStatus tmpBoard; mScoreBoard->Draw(GetBoardStatus(&tmpBoard)); // スコアボード /*== ================*/ if(flgStart) { DrawStart(); } // ミッションスタート if(flgClear) { DrawClear(); } // ミッションクリア if(flgGameOver) { DrawGameOver(); } // ゲームオーバー if(flgResult) { DrawResult(); } // リザルト // DrawDebug(); }
//Output void cGame::Render() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0,(float)SCREEN_WIDTH/(float)SCREEN_HEIGHT,0.01,100); glMatrixMode(GL_MODELVIEW); DrawSky(); if(!Scene.IsInitialized) { DrawStartScreen(); } else { DrawGame(); } if (WireframeRendering) DrawWireframeGame(); if (IsGameover) DrawGameOver(); if (IsLevelUp) DrawLevelUp(); glutSwapBuffers(); UpdateFrameVariables(); }
int tetris_exec( int fdfb, int fdrc, int fdlcd, char *cfgfile ) { struct timeval tv; int x; int i; int fd; FILE *fp; char *line; char *p; if ( FBInitialize( 720, 576, 8, fdfb ) < 0 ) return -1; setup_colors(); if ( RcInitialize( fdrc ) < 0 ) return -1; /* load setup */ fp = fopen( CONFIGDIR "/games.cfg", "r" ); if ( fp ) { line=malloc(128); isalloc=1; #ifdef HAVE_CURL proxy_addr=0; proxy_user=0; #endif hscore=0; while( fgets( line, 128, fp ) ) { if ( *line == '#' ) continue; if ( *line == ';' ) continue; p=strchr(line,'\n'); if ( p ) *p=0; p=strchr(line,'='); if ( !p ) continue; *p=0; p++; #ifdef HAVE_CURL if ( !strcmp(line,"proxy") ) proxy_addr=strdup(p); else if ( !strcmp(line,"proxy_user") ) proxy_user=strdup(p); else if ( !strcmp(line,"hscore") ) hscore=strdup(p); #endif } fclose(fp); free(line); } fd = open( GAMESDIR "/tetris.hscore", O_RDONLY ); if ( fd == -1 ) { mkdir( GAMESDIR, 567 ); for( i=0; i < 8; i++ ) { strcpy(hsc[i].name,"nobody"); hsc[i].points=30; } } else { read( fd, hsc, sizeof(hsc) ); close(fd); } #ifdef HAVE_CURL if ( hscore ) { LoadHScore(); } #endif #if defined(HAVE_DBOX_HARDWARE) || defined(HAVE_SPARK_HARDWARE) || defined(HAVE_DUCKBOX_HARDWARE) Fx2ShowPig( 480, 400, 176, 144 ); #endif while( doexit != 3 ) { BoardInitialize(); DrawBoard( ); /* 0 = all */ NextItem(); #ifdef HAVE_DREAMBOX_HARDWARE Fx2ShowPig(480, 400, 176, 144 ); #endif doexit=0; while( !doexit ) { tv.tv_sec = 0; tv.tv_usec = 10000; x = select( 0, 0, 0, 0, &tv ); /* 10ms pause */ RcGetActCode( ); if ( doexit ) break; tv.tv_sec = 0; tv.tv_usec = 10000; x = select( 0, 0, 0, 0, &tv ); /* 10ms pause */ RcGetActCode( ); if ( doexit ) break; MoveSide(); if ( !FallDown() ) { RemoveCompl(); if ( !NextItem() ) doexit=1; } #if defined(USEX) || defined(HAVE_SPARK_HARDWARE) || defined(HAVE_DUCKBOX_HARDWARE) FBFlushGrafic(); #endif RcGetActCode( ); } if ( doexit != 3 ) { actcode=0xee; DrawGameOver(); #if defined(USEX) || defined(HAVE_SPARK_HARDWARE) || defined(HAVE_DUCKBOX_HARDWARE) FBFlushGrafic(); #endif doexit=0; SaveGame(); #ifdef HAVE_CURL if ( use_ihsc ) ShowIHScore(); #endif ShowHScore(hsc); Fx2PigPause(); #if defined(USEX) || defined(HAVE_SPARK_HARDWARE) || defined(HAVE_DUCKBOX_HARDWARE) FBFlushGrafic(); #endif i=0; actcode=0xee; while(( actcode != RC_OK ) && !doexit ) { tv.tv_sec = 0; tv.tv_usec = 100000; x = select( 0, 0, 0, 0, &tv ); /* 100ms pause */ RcGetActCode( ); i++; if ( i == 50 ) { FBDrawString( 190, 480, 48, "press OK for new game",GRAY,0); #if defined(USEX) || defined(HAVE_SPARK_HARDWARE) || defined(HAVE_DUCKBOX_HARDWARE) FBFlushGrafic(); #endif } } Fx2PigResume(); } } Fx2StopPig(); #if defined(HAVE_DBOX_HARDWARE) || defined(HAVE_SPARK_HARDWARE) || defined(HAVE_DUCKBOX_HARDWARE) /* fx2 */ /* buffer leeren, damit neutrino nicht rumspinnt */ realcode = RC_0; while( realcode != 0xee ) { tv.tv_sec = 0; tv.tv_usec = 300000; x = select( 0, 0, 0, 0, &tv ); /* 300ms pause */ RcGetActCode( ); } #endif RcClose(); FBClose(); /* save hscore */ fd = open( GAMESDIR "/tetris.hscore", O_CREAT|O_WRONLY, 438 ); if ( fd != -1 ) { write( fd, hsc, sizeof(hsc) ); close(fd); } if ( isalloc ) { #ifdef HAVE_CURL if ( proxy_addr ) free ( proxy_addr ); if ( proxy_user ) free ( proxy_user ); #endif if ( hscore ) free ( hscore ); } return 0; }
int snake_exec( int fdfb, int fdrc, int fdlcd, char *cfgfile ) { struct timeval tv; int x; if ( FBInitialize( 720, 576, 8, fdfb ) < 0 ) return -1; setup_colors(); if ( RcInitialize( fdrc ) < 0 ) return -1; Fx2ShowPig( 540, 449, 135, 96 ); while ( doexit != 3 ) { DrawMaze( ); /* 0 = all */ doexit=0; while ( !doexit ) { tv.tv_sec = 0; tv.tv_usec = 100000; x = select( 0, 0, 0, 0, &tv ); /* 10ms pause */ RcGetActCode( ); MoveSnake(); #if defined(USEX) || defined(HAVE_SPARK_HARDWARE) || defined(HAVE_DUCKBOX_HARDWARE) FBFlushGrafic(); #endif } FreeSnake(); if ( doexit != 3 ) { actcode=0xee; DrawFinalScore(); DrawGameOver(); #if defined(USEX) || defined(HAVE_SPARK_HARDWARE) || defined(HAVE_DUCKBOX_HARDWARE) FBFlushGrafic(); #endif doexit=0; while (( actcode != RC_OK ) && !doexit ) { tv.tv_sec = 0; tv.tv_usec = 200000; x = select( 0, 0, 0, 0, &tv ); /* 100ms pause */ RcGetActCode( ); } } } Fx2StopPig(); /* fx2 */ /* buffer leeren, damit neutrino nicht rumspinnt */ realcode = RC_0; while ( realcode != 0xee ) { tv.tv_sec = 0; tv.tv_usec = 300000; x = select( 0, 0, 0, 0, &tv ); /* 300ms pause */ RcGetActCode( ); } RcClose(); FBClose(); return 0; }
int pacman_exec( int fdfb, int fdrc, int fdlcd, char *cfgfile ) { struct timeval tv; int x; int jumplevel=-1; if ( FBInitialize( 720, 576, 8, fdfb ) < 0 ) return -1; setup_colors(); if ( RcInitialize( fdrc ) < 0 ) return -1; InitLevel( 0 ); while( doexit != 3 ) { MazeInitialize(); DrawMaze( ); /* 0 = all */ DrawFill(); DrawGhosts( ); DrawPac( ); MazePig(); doexit=0; while( !doexit ) { tv.tv_sec = 0; #ifdef HAVE_DREAMBOX_HARDWARE tv.tv_usec = 8000; #else tv.tv_usec = 1000; #endif x = select( 0, 0, 0, 0, &tv ); /* 10ms pause */ MovePac( ); MoveGhosts( ); DrawGhosts( ); DrawPac( ); #if defined(USEX) || defined(HAVE_SPARK_HARDWARE) || defined(HAVE_DUCKBOX_HARDWARE) FBFlushGrafic(); #endif RcGetActCode( ); CheckGhosts( ); } if ( doexit != 3 ) { actcode=0xee; if ( score ) DrawScore(); if ( !gametime ) DrawGameOver(); #if defined(USEX) || defined(HAVE_SPARK_HARDWARE) || defined(HAVE_DUCKBOX_HARDWARE) FBFlushGrafic(); #endif doexit=0; jumplevel=-1; while(( actcode != RC_OK ) && !doexit ) { tv.tv_sec = 0; tv.tv_usec = 100000; x = select( 0, 0, 0, 0, &tv ); /* 100ms pause */ RcGetActCode( ); if ( actcode == RC_HELP ) { while( realcode != 0xee ) RcGetActCode( ); actcode=0xee; while(( actcode == 0xee ) && !doexit ) { tv.tv_sec = 0; tv.tv_usec = 100000; x = select( 0, 0, 0, 0, &tv ); /* 100ms pause */ RcGetActCode( ); } if ( actcode <= RC_9 ) { jumplevel=actcode; actcode=RC_OK; } } } if ( gametime ) NextLevel(); else InitLevel( jumplevel ); } } Fx2StopPig(); /* fx2 */ /* buffer leeren, damit neutrino nicht rumspinnt */ realcode = RC_0; while( realcode != 0xee ) { tv.tv_sec = 0; tv.tv_usec = 300000; x = select( 0, 0, 0, 0, &tv ); /* 300ms pause */ RcGetActCode( ); } RcClose(); FBClose(); return 0; }
LRESULT CALLBACK windProc(HWND hwnd,UINT Message,WPARAM wParam,LPARAM lParam) { int i; static HDC hdc; static HDC hdcDes; static HBITMAP hBitMap[BMPS]; static BITMAP bitMap; static HINSTANCE hInstance; static HBRUSH hBrush; static RECT rectStartButton;//开始游戏按钮区 static PAINTSTRUCT ps; static POINT mouseLocation; static int x,y; hBrush = CreateSolidBrush(RGB(255,255,255)); switch (Message) { case WM_CREATE: hInstance = ((LPCREATESTRUCT)lParam)->hInstance; hBitMap[0] = LoadBitmap(hInstance,MAKEINTRESOURCE(IDB_BRICK));//墙 hBitMap[1] = LoadBitmap(hInstance,MAKEINTRESOURCE(IDB_NUMERS));//分数 hBitMap[2] = LoadBitmap(hInstance,MAKEINTRESOURCE(IDB_SCORE));//得分字样 hBitMap[3] = LoadBitmap(hInstance,MAKEINTRESOURCE(IDB_GAMELEVEL));//游戏等级字样 hBitMap[4] = LoadBitmap(hInstance,MAKEINTRESOURCE(IDB_ANIMATE));//开机动画的贴图 hBitMap[5] = LoadBitmap(hInstance,MAKEINTRESOURCE(IDB_GAMESTART));//游戏开始按钮 hBitMap[6] = LoadBitmap(hInstance,MAKEINTRESOURCE(IDB_WORDSNAKE));//snake四个英文字母 hBitMap[7] = LoadBitmap(hInstance,MAKEINTRESOURCE(IDB_SNAKE));//蛇的身体以及食物 hBitMap[8] = LoadBitmap(hInstance,MAKEINTRESOURCE(IDB_STARTCHANGE));//鼠标放在开始按钮上时改变颜色 hBitMap[9] = LoadBitmap(hInstance,MAKEINTRESOURCE(IDB_GAMEOVER));//GAMEOVER四个字母 srand((unsigned)time(NULL)); SetClientRect(hwnd,704,576); return 0; case WM_SIZE: GetClientRect(hwnd,&rectClient); rectSnake.left = rectClient.left+32; rectSnake.top = rectClient.top+32; rectSnake.bottom = rectClient.bottom-32; rectSnake.right = rectClient.left+17*32; rectStartButton.left = rectSnake.left+150; rectStartButton.right = rectStartButton.left+236; rectStartButton.top = rectSnake.bottom-100; rectStartButton.bottom = rectStartButton.top+79; return 0; case WM_KEYDOWN: switch (wParam) { case VK_SPACE: Pause = !Pause; if(Pause) { if(GameState != 1) { GameLevel = 1; GameState = 1; SnakeLength = 1; GameSpeed = 200; Snake[0].x = rectSnake.left+160;//初始化蛇头坐标信息 Snake[0].y = rectSnake.left+160; x = Snake[0].x; y = Snake[0].y; } SetTimer(hwnd,GAMETIMER,GameSpeed,NULL);//设置时间计时器 } else KillTimer(hwnd,GAMETIMER); break; case VK_ESCAPE: int result; result = MessageBox(NULL,TEXT("你确定要退出游戏吗?"),TEXT("Warning!"),MB_YESNO|MB_ICONWARNING); switch (result) { case IDYES: DestroyWindow(hwnd); break; case IDNO: break; default: break; } break; case VK_LEFT: if(MoveDirection != 2) MoveDirection = 1; return 0; case VK_RIGHT: if(MoveDirection != 1) MoveDirection = 2; return 0; case VK_UP: if(MoveDirection != 4) MoveDirection = 3; return 0; case VK_DOWN: if(MoveDirection != 3) MoveDirection = 4; return 0; } return 0; case WM_COMMAND: switch (LOWORD(wParam)) { case ID_ABOUT: DialogBox(hInstance,MAKEINTRESOURCE(IDD_DIABOUT),NULL,AboutProc); break; case ID_GAMESTART://点击菜单中的开始游戏按钮开始游戏 GameLevel = 1; GameState = 1; SnakeLength = 1; GameSpeed = 200; SetTimer(hwnd,GAMETIMER,GameSpeed,NULL);//设置时间计时器 Snake[0].x = rectSnake.left+160;//初始化蛇头坐标信息 Snake[0].y = rectSnake.left+160; x = Snake[0].x; y = Snake[0].y; Pause = TRUE; break; case ID_GAMEQUIT: KillTimer(hwnd,GAMETIMER); ReleaseDC(hwnd,hdc); DestroyWindow(hwnd); exit(0); break ; } return 0; case WM_PAINT: hdc = GetDC(hwnd); hdc = BeginPaint(hwnd, &ps); GetClientRect(hwnd,&rectClient); hdcDes = CreateCompatibleDC(hdc); Draw(hwnd,hdc,hBitMap,rectClient); if(GameState == 0) { DrawAnimate(hwnd,hdc,hBitMap,rectSnake);//开机动画 } else if(GameState == 1) { FillRect(hdc,&rectSnake,hBrush); SelectObject(hdcDes,hBitMap[7]); GetObject(hBitMap[7],sizeof(BITMAP),&bitMap); if(!food.state) BitBlt(hdc, food.foodLocation.x, food.foodLocation.y, bitMap.bmWidth, bitMap.bmHeight/2,hdcDes,0,16,SRCCOPY); for(i =0;i<SnakeLength;i++) { BitBlt(hdc, Snake[i].x, Snake[i].y, bitMap.bmWidth, bitMap.bmHeight/2,hdcDes,0,0,SRCCOPY); } } else if(GameState == 2) { DrawGameOver(hwnd,hdc,hBitMap,9); KillTimer(hwnd,GAMETIMER); } DeleteDC(hdcDes); EndPaint(hwnd,&ps); Flag = FALSE; return 0; case WM_TIMER: if(GameState == 1) { if(MoveDirection == 4) { x= x; y = y +16; } else if(MoveDirection == 3) { x = x; y = y - 16; } else if(MoveDirection == 2) { x = x+16; y = y; } else if(MoveDirection == 1) { x = x -16; y = y; } SnakeMove(x,y); InvalidateRect(hwnd,&rectSnake,FALSE); } return 0; case WM_LBUTTONDOWN: mouseLocation.x = LOWORD(lParam); mouseLocation.y = HIWORD(lParam); if(GameState == 0) { if(PtInRect(&rectStartButton,mouseLocation))//点击开始游戏按钮开始游戏 { GameLevel = 1; GameState = 1; SnakeLength = 1; GameSpeed = 200; SetTimer(hwnd,GAMETIMER,GameSpeed,NULL);//设置时间计时器 Snake[0].x = rectSnake.left+160;//初始化蛇头坐标信息 Snake[0].y = rectSnake.left+160; x = Snake[0].x; y = Snake[0].y; Pause = TRUE; } } return 0; //按钮效果实现 case WM_MOUSEMOVE: TRACKMOUSEEVENT TrackME; mouseLocation.x = LOWORD(lParam); mouseLocation.y = HIWORD(lParam); TrackME.cbSize = sizeof(TrackME); TrackME.dwFlags = TME_LEAVE | TME_HOVER; TrackME.hwndTrack = hwnd; TrackME.dwHoverTime = 1;//持续多长算HOVER TrackMouseEvent(&TrackME); if(GameState == 0) { if(PtInRect(&rectStartButton,mouseLocation)) { FillRect(hdc,&rectStartButton,hBrush); SetCursor(LoadCursor(NULL,IDC_HAND)); DrawButton(hwnd,hdc,hBitMap,rectStartButton,8); } else { FillRect(hdc,&rectStartButton,hBrush); DrawButton(hwnd,hdc,hBitMap,rectStartButton,5); } } return 0; case WM_DESTROY: PostQuitMessage(0); return 0; } return DefWindowProc(hwnd,Message,wParam,lParam); }
int mines_exec( int fdfb, int fdrc, int fdlcd, char *cfgfile ) { struct timeval tv; int x; if ( FBInitialize( 720, 576, 8, fdfb ) < 0 ) return -1; setup_colors(); if ( RcInitialize( fdrc ) < 0 ) return -1; while( doexit != 3 ) { BoardInitialize(); DrawBoard( 0 ); Fx2ShowPig( 470, 300, 176, 144 ); doexit=0; while( !doexit ) { tv.tv_sec = 0; tv.tv_usec = 10000; x = select( 0, 0, 0, 0, &tv ); /* 100ms pause */ RcGetActCode( ); MoveMouse(); #ifdef USEX FBFlushGrafic(); #endif } if ( doexit != 3 ) { actcode=0xee; if ( doexit ==2 ) DrawScore(); else DrawGameOver(); #ifdef USEX FBFlushGrafic(); #endif doexit=0; while(( actcode != RC_OK ) && !doexit ) { tv.tv_sec = 0; tv.tv_usec = 100000; x = select( 0, 0, 0, 0, &tv ); /* 100ms pause */ RcGetActCode( ); } } } Fx2StopPig(); /* fx2 */ /* buffer leeren, damit neutrino nicht rumspinnt */ realcode = RC_0; while( realcode != 0xee ) { tv.tv_sec = 0; tv.tv_usec = 300000; x = select( 0, 0, 0, 0, &tv ); /* 300ms pause */ RcGetActCode( ); } RcClose(); FBClose(); return 0; }
void CCockpit::Draw() { //--------------------------------- //描画処理 //--------------------------------- Sint32 bx=0,by=0; Sint32 wx,wy; if( m_sNowLoadingWait ) { DrawNowLoading(); } if( m_bSplash ) { DrawSplash(); } wx = 0; wy = m_sHeight; m_pRaderDamage->SetHitPoint( m_sDispHitPoint ); if( m_bArrow ) DrawArrow(WINDOW_W/2,WINDOW_H/2); if( m_bSwitch[enSwitchRader] ) m_pRaderControl->Draw(0,WINDOW_H+wy); if( m_bSwitch[enSwitchRed] ) m_pRaderDamage->DrawSekigaisen(470+24,5); //左上U.I if( m_bSwitch[enSwitchBullet] ) DrawRelord(36,36-wy); //HP表示 if( m_bSwitch[enSwitchPosition] ) m_pRaderDamage->Draw(8,10+by-wy); if( m_bSwitch[enSwitchTime] ) DrawTime(400-16,24-wy); if( m_bSwitch[enSwitchScore] ) DrawScore(400-32,8-wy); if( m_bOutogRange ) DrawOutOfArea(320,240+wy); if( m_bSwitch[enSwitchMessage] ) DrawShortMessage(64,44-wy); if( m_sBlackMask ) DrawBlackmask(); if( m_bSwitch[enSwitchDamage] ) { //DrawHitPoint(); } else { m_sDispHitPoint = 0; } if( m_sWhiteFade ) { DrawGameOver(); } // enSwitchDamage, //残りHP(ON/OFF) // enSwitchMessage, //ショートメッセージ(ON/OFF) // enSwitchBullet, //残弾数(ON/OFF) // enSwitchHigher, //敵高度表示(ON/OFF) m_pMsgWindow->Draw(6,WINDOW_H-74-m_sBlackMask*28/100); if( m_pStageClear ) m_pStageClear->Draw(); }
/** * Drawing for Gameplay Screen. */ void ScreenGameplayDrawing() { /* Draw the background. */ EnableOrtho2D(); Draw2DTexture(0, 0, textures[TEX_BACKGROUND]); DisableOrtho2D(); /* Draw the 3D background and "brick tray". */ int i, j; for(i = 0; i < BACKGROUND_H; i++) { for(j = 0; j < BACKGROUND_W; j++) { if(background[i][j] != 0) { CleanObject(); glTranslatef((j*-1)+15.5,(i*-1)+1,10); glScalef(1, 1, 1); switch(background[i][j]) { case 1: glColor4f ( score_glow, score_glow, score_glow, 1.0f ); glutSolidCube(1); break; case 2: glColor4f ( GREY_1, GREY_1, GREY_1, 1.0f ); glutSolidCube(0.95); break; case 3: glColor4f ( GREY_2, GREY_2, GREY_2, 1.0f ); glutSolidCube(0.95); break; case 4: glColor4f ( GREY_3, GREY_3, GREY_3, 1.0f ); glutSolidCube(0.95); break; } } } } /* Draw the game board. */ for(i = 0; i < GAMEBOARD_H; i++) { for(j = 0; j < GAMEBOARD_W; j++) { if(gameboard[i][j] != 0) { switch(gameboard[i][j]) { /* Stationary */ case 1: DrawBlockStationary((j*-1)+4.5,(i*-1), 0.5, 0.25, 0.035); break; case 2: DrawBlockStationary((j*-1)+4.5,(i*-1), 0.4, 0.4, 0.05); break; case 3: DrawBlockStationary((j*-1)+4.5,(i*-1), 0.45, 0.0, 0.0); break; /* Movers */ case 4: DrawBlockMoving((j*-1)+4.5,(i*-1), 0.6, 0.3, 0.05); break; case 5: DrawBlockMoving((j*-1)+4.5,(i*-1), 0.5, 0.5, 0.06); break; case 6: DrawBlockMoving((j*-1)+4.5,(i*-1), 0.55, 0.0, 0.0); break; /* Grey, gameover blocks. A special, draw them manually */ case 7: DrawBlockBackground((j*-1)+4.5,(i*-1), GREY_1, GREY_1, GREY_1); break; case 8: DrawBlockBackground((j*-1)+4.5,(i*-1), GREY_1, GREY_1, GREY_1); break; case 9: DrawBlockBackground((j*-1)+4.5,(i*-1), GREY_1, GREY_1, GREY_1); break; } } } } /* Create and draw "next brick" (ie the green one :) It is special, so draw it manually. */ CleanObject(); glTranslatef(-10.9f, 1.0f, -5.0f); /* top right position */ switch(brick_type_next) { case 0: glTranslatef( 0.25, -8.5, 10); glRotatef(theta*10,3.0, 2.5, 0.0f); break; case 1: glTranslatef( 0.5, -9.0, 10); glRotatef(theta*10,2.0, 2.5, 0.0f); break; case 2: glTranslatef( 0.5, -8.75, 10); glRotatef(theta*10,2, 2, 0.0f); break; case 3: glTranslatef( -0.3, -9.25, 10); glRotatef(theta*10,2, 2, 0.0f); break; case 4: glTranslatef( 0, -9, 10); glRotatef(theta*10,2.0, 2.0, 0.0f); break; case 5: glTranslatef( 0.15, -9.5, 10); glRotatef(theta*10,2.0, 2.5, 0.0f); break; case 6: glTranslatef( 0.0, -8.5, 10); glRotatef(theta*10,2.0, 1.5, 0.0f); break; } glScalef(1, 1, 1); for(i = 0; i < GAMEPIECE_H; i++) { glTranslatef( 0, 1, 0); for(j = 0; j < GAMEPIECE_W; j++) { glTranslatef( 1, 0, 0); if(ScanBrick(brick_type_next, 0, i, j)) { /* Draw the shell. */ glScalef(1, 1, 0.9); glColor4f ( 0.0f, 0.0f, 0.0f, 1.0f ); glutSolidCube(1.0); glScalef(1, 1, 1.1); /* Draw inner green color. */ glColor4f( 0.0f, 0.5f, 0.0f, 1.0f ); glutSolidCube(.95); } } glTranslatef( -GAMEPIECE_W, 0, 0); } /* Draw HUD (score, star rank etc). */ EnableOrtho2D(); Draw2DTexture(0, 0, textures[TEX_HEADER]); Draw2DNumberFromRight(788, 27, textures[TEX_NUMBERS], 14, 16, score); DrawStarRank(); if(game_over) DrawGameOver(); DisableOrtho2D(); }
int soko_exec( int fdfb, int fdrc, int fdlcd, char *cfgfile ) { struct timeval tv; int x; if ( FBInitialize( 720, 576, 8, fdfb ) < 0 ) return -1; setup_colors(); if ( RcInitialize( fdrc ) < 0 ) return -1; Fx2ShowPig( 540, 450, 120, 90 ); ladeVerzeichnis(); Startbildschirm(); while( doexit != 3 ) { doexit=0; BoardInitialize(); #ifdef USEX FBFlushGrafic(); #endif if ( doexit == 4 ) /* fx2 - install error: no level found */ { doexit=0; while(( actcode != RC_OK ) && !doexit ) { tv.tv_sec = 0; tv.tv_usec = 100000; x = select( 0, 0, 0, 0, &tv ); /* 100ms pause */ RcGetActCode( ); } break; } while( !doexit ) { tv.tv_sec = 0; tv.tv_usec = 10000; x = select( 0, 0, 0, 0, &tv ); /* 100ms pause */ RcGetActCode( ); MoveMouse(); } if ( doexit != 3 ) { actcode=0xee; if ( doexit ==2 ) DrawScore(); else DrawGameOver(); if (level+1 < max_level) { level++; } else { level = 0; } doexit=0; while(( actcode != RC_OK ) && !doexit ) { tv.tv_sec = 0; tv.tv_usec = 100000; x = select( 0, 0, 0, 0, &tv ); /* 100ms pause */ RcGetActCode( ); } } } Fx2StopPig(); /* fx2 */ /* buffer leeren, damit neutrino nicht rumspinnt */ realcode = RC_0; while( realcode != 0xee ) { tv.tv_sec = 0; tv.tv_usec = 300000; x = select( 0, 0, 0, 0, &tv ); /* 300ms pause */ RcGetActCode( ); } RcClose(); FBClose(); freeMem(); return 0; }
//================================================ //メインループ //================================================ void Luna::Main(long ArgNum, char *pArgStr[]) { //---------------------------------------- //全システムの開始 //---------------------------------------- if(Luna::Start() ) { //-------------------------------- //初期化処理 //-------------------------------- InitProcess(); //LunaInput::GetMouseData(&camera.Mouse); //LunaInput::GetMouseData(&camera.MouseOld); //-------------------------------- //ゲーム用ループ //-------------------------------- while(Luna::WaitForMsgLoop() ) { /*画面クリア*/ Luna3D::Clear(D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, COLOR_BLACK, 1.0f); //Luna3D::Clear(D3DCLEAR_TARGET, COLOR_WHITE); /*デバッグ画面クリア*/ // LunaDebug::Clear(); switch(g_GameMode) { case SCENE_INITIALIZE: { Initialize(); break; } case SCENE_LOGO: { //DrawLogo(); break; } case SCENE_TITLE: { DrawTitle(); break; } case SCENE_CHARSEL: { DrawCharaSelect(); break; } case SCENE_MAIN: { DrawMain(); break; } case SCENE_OPTION: { DrawOption(); break; } case SCENE_TUTOLIAL: { DrawTutorial(); break; } case SCENE_PAUSE: { DrawPause(); break; } case SCENE_PAUSEEXIT: { DrawPauseExit(); break; } case SCENE_ERROR: { DrawError(); break; } case SCENE_EXIT: { DrawExit(); break; } case SCENE_FADEIN: { Fadein(); break; } case SCENE_FADEOUT: { Fadeout(); break; } case SCENE_CONV: { Conversation(); break; } case SCENE_GAMECLEAR: { DrawGameClear(); break; } case SCENE_GAMEOVER: { DrawGameOver(); break; } case SCENE_CONTINUE: { DrawContinue(); break; } case SCENE_FINALIZE: { Finalize(); break; } } /*画面更新*/ Luna3D::Refresh(); /*デバッグ処理*/ // Debug(); } /*終了処理*/ Finalize(); } }