void Pause_Draw(struct Game* game) { game->gamestate=game->loadstate; game->loadstate=GAMESTATE_PAUSE; DrawGameState(game); game->loadstate=game->gamestate; game->gamestate=GAMESTATE_PAUSE; //al_draw_tinted_bitmap(game->pause.bitmap,al_map_rgba_f(1,1,1,0.75),0,0,0); //al_draw_bitmap(game->pause.bitmap); al_draw_filled_rectangle(0, 0, game->viewportWidth, game->viewportHeight, al_map_rgba_f(0,0,0,0.4)); al_draw_text_with_shadow(game->menu.font_title, al_map_rgb(255,255,255), game->viewportWidth*0.5, game->viewportHeight*0.05, ALLEGRO_ALIGN_CENTRE, "Cadence Throw"); al_draw_text_with_shadow(game->menu.font_subtitle, al_map_rgb(255,255,255), game->viewportWidth*0.5, game->viewportHeight*0.225, ALLEGRO_ALIGN_CENTRE, "Throwing Wifes is Magic"); DrawMenuState(game); // al_draw_filled_rectangle(0, game->viewportHeight*0.8, game->viewportWidth, game->viewportHeight, al_map_rgba_f(0,0,0,0.3)); al_draw_text_with_shadow(game->menu.font, al_map_rgb(255,255,255), game->viewportWidth*0.5, game->viewportHeight*0.82, ALLEGRO_ALIGN_CENTRE, "Your task is to save Spike by throwing your wife."); al_draw_text_with_shadow(game->menu.font, al_map_rgb(255,255,255), game->viewportWidth*0.5, game->viewportHeight*0.9, ALLEGRO_ALIGN_CENTRE, "Adjust throw power with Space button. Be careful!"); if (al_get_sample_instance_position(game->level.music)<100000) al_set_sample_instance_position(game->level.music, 150000); // UGLY AS FUUUUUUUUUUUUCK }
int StartUp::MainLoop( void ) { int atimer = 30, time; double rad_ = ( MIKAN_PI*2.0*rad / 360 ); MikanDraw->ClearScreen(); if(loadgame < gamemax) { //MikanDraw->DrawTextureScalingC( 0, system->GetWidth() / 2, system->GetHeight() / 2, 0, 160, 320, 160, 2.0 ); MikanDraw->DrawTextureRotateScaleC( 0, system->GetWidth() / 2 - 170, system->GetHeight() / 2 + 24, 390, 160, 110, 110, 2.0, rad_ ); // 歯車 MikanDraw->DrawTextureScalingC( 0, system->GetWidth() / 2, system->GetHeight() / 2, 0, 160, 320, 160, 2.0 ); MikanDraw->DrawTextureRotateScaleC( 0, system->GetWidth() / 2 - 170, system->GetHeight() / 2 + 24, 320, 160, 70, 70, 2.0, rad_ ); // e DrawGameState(); rad = ( rad + 6 ) % 360; } else if(timer < 0) { //MikanDraw->DrawTextureScalingC( 0, system->GetWidth() / 2, system->GetHeight() / 2, 0, 0, 320, 160, 2.0 ); rad = ( rad + 6 ) % 360; MikanDraw->DrawTextureRotateScaleC( 0, system->GetWidth() / 2 - 170, system->GetHeight() / 2 + 24, 390, 160, 110, 110, 2.0, rad_ ); // 歯車 MikanDraw->DrawTextureScalingC( 0, system->GetWidth() / 2, system->GetHeight() / 2, 0, 160, 320, 160, 2.0 ); MikanDraw->DrawTextureRotateScaleC( 0, system->GetWidth() / 2 - 170, system->GetHeight() / 2 + 24, 320, 160, 70, 70, 2.0, rad_ ); // e timer = 0; DrawGameState(); } else if(timer >= 0) { //MikanSystem->Join( 0 ); if(rad != 0) { DrawGameState(); rad = ( rad + 6 ) % 360; MikanDraw->DrawTextureRotateScaleC( 0, system->GetWidth() / 2 - 170, system->GetHeight() / 2 + 24, 390, 160, 110, 110, 2.0, rad_ ); // 歯車 MikanDraw->DrawTextureScalingC( 0, system->GetWidth() / 2, system->GetHeight() / 2, 0, 160, 320, 160, 2.0 ); MikanDraw->DrawTextureRotateScaleC( 0, system->GetWidth() / 2 - 170, system->GetHeight() / 2 + 24, 320, 160, 70, 70, 2.0, rad_ ); // e } else { if(mode == 1) { if(timer < atimer) { MikanDraw->DrawTextureScalingC( 0, system->GetWidth() / 2, system->GetHeight() / 2, 0, 0, 320, 160, 2.0 ); MikanDraw->SetAlpha( 0, 255 * timer / atimer ); MikanDraw->DrawTextureScalingC( 0, system->GetWidth() / 2, system->GetHeight() / 2, 320, 0, 320, 160, 2.0 ); MikanDraw->SetColor( 0, 0xFFFFFFFF ); } else if(timer < atimer * 2) { time = timer - atimer; MikanDraw->SetAlpha( 0, 255 * ( atimer - time ) / atimer ); MikanDraw->DrawTextureScalingC( 0, system->GetWidth() / 2, system->GetHeight() / 2, 320, 0, 320, 160, 2.0 ); MikanDraw->SetColor( 0, 0xFFFFFFFF ); } else { system->SetGameView( new OP() ); } ++timer; } else if(MikanInput->GetKeyNum( K_Z ) == -1) { mode = 1; } else { DrawGameState(); MikanDraw->DrawTextureRotateScaleC( 0, system->GetWidth() / 2 - 170, system->GetHeight() / 2 + 24, 390, 160, 110, 110, 2.0, 0 ); // 歯車 MikanDraw->DrawTextureScalingC( 0, system->GetWidth() / 2, system->GetHeight() / 2, 0, 160, 320, 160, 2.0 ); MikanDraw->DrawTextureRotateScaleC( 0, system->GetWidth() / 2 - 170, system->GetHeight() / 2 + 24, 320, 160, 70, 70, 2.0, 0 ); // e } } } else { //MikanDraw->DrawTextureScalingC( 0, system->GetWidth() / 2, system->GetHeight() / 2, 0, 0, 320, 160, 2.0 ); MikanDraw->DrawTextureRotateScaleC( 0, system->GetWidth() / 2 - 170, system->GetHeight() / 2 + 24, 390, 160, 110, 110, 2.0, rad_ ); // 歯車 MikanDraw->DrawTextureScalingC( 0, system->GetWidth() / 2, system->GetHeight() / 2, 0, 160, 320, 160, 2.0 ); MikanDraw->DrawTextureRotateScaleC( 0, system->GetWidth() / 2 - 170, system->GetHeight() / 2 + 24, 320, 160, 70, 70, 2.0, rad_ ); // e DrawGameState(); rad = ( rad + 6 ) % 360; } return 0; }
int main( int argc, char* argv[] ) { Initialise(ScreenWidth, ScreenHeight, false, "Space Invaders"); SetBackgroundColour(SColour(0x00, 0x00, 0x00, 0xFF)); //player settings player.SetSize(64.0f, 32.0f); player.iSpriteID = CreateSprite("./images/cannon.png", player.fWidth, player.fHeight, true); player.SetMovementExtremes(0.0f, ScreenWidth); player.SetMovementKeys(65, 68); player.x = ScreenWidth * 0.5f; player.y = 88.0f; //startPlayerTracker enemyTracker = EnemyTracker(); //create Marquee sprite iArcadeMarquee = CreateSprite("./images/Space-Invaders-Marquee.png", ScreenWidth, ScreenHeight, true); //enemy creation CreateEnemies(); enemyDirection = RIGHT; nextDirection = RIGHT; //font setting AddFont(pInvadersFont); //game state declaration GAMESTATES eCurrentState = MAIN_MENU; //Game Loop do { float fDeltaT = GetDeltaTime(); switch (eCurrentState) { case MAIN_MENU: UpdateMainMenu(); //input if (IsKeyDown(257) && !IsKeyDown(256)) { eCurrentState = GAMEPLAY; ResetEnemies(); } break; case GAMEPLAY: UpdateGameState(fDeltaT); DrawGameState(); //ChangeState if (IsKeyDown(256)) { eCurrentState = MAIN_MENU; } break; case END: break; default: break; } //clear screen ClearScreen(); } while(!FrameworkUpdate()); Shutdown(); return 0; }