Пример #1
0
void TitleScreenOutputFrame(void)
{
	DrawBackground(&BG, 0);

	HighScoreDisplayDraw(&HSD);

	for (int i = 0; i < MAX_PLAYERS; i++)
	{
		Tex t = GetControlTex(i);
		SDL_Rect dest =
		{
			SCREEN_X((i + 1) * FIELD_WIDTH / (MAX_PLAYERS + 1)) -
				t.W / 2,
			(SCREEN_HEIGHT - t.H) / 2 - SCREEN_X(PLAYER_RADIUS),
			t.W, t.H
		};
		RenderTex(t.T, NULL, &dest);
	}

	for (int i = 0; i < MAX_PLAYERS; i++)
	{
		PlayerDraw(&players[i], 0);
	}

	for (int i = 0; i < MAX_PLAYERS; i++)
	{
		BlockDraw(&blocks[i], 0);
	}

	DrawTitleImg();
	// Draw player icons if winners
	if (!Start)
	{
		const int left =
			(SCREEN_WIDTH - PLAYER_SPRITESHEET_WIDTH * winners) / 2;
		for (int i = 0; i < winners; i++)
		{
			const int playerIndex = winnerIndices[i];
			SDL_Rect src = {
				0, 0, PLAYER_SPRITESHEET_WIDTH, PLAYER_SPRITESHEET_HEIGHT
			};
			SDL_Rect dest =
			{
				left + i * PLAYER_SPRITESHEET_WIDTH,
				SCREEN_HEIGHT * 0.66f,
				src.w, src.h
			};
			RenderTex(PlayerSpritesheets[playerIndex].T, &src, &dest);
		}
	}
	SDL_Color c = { 177, 177, 177, 255 };
	TextRenderCentered(
		font, WelcomeMessage, (int)(SCREEN_HEIGHT * 0.75f), c);

	SDL_RenderPresent(Renderer);
}
Пример #2
0
void GameOutputFrame(void)
{
	const float screenYOff =
		(float)MAX(-SCREEN_HEIGHT, SCREEN_Y(camera.Y) - SCREEN_HEIGHT / 2);
	// Draw the background.
	DrawBackground(&BG, screenYOff);

	SpaceDraw(&space, screenYOff);
	PickupsDraw(Screen, screenYOff);
	ParticlesDraw(Screen, screenYOff);

	int c = 0;
	for (int i = 0; i < MAX_PLAYERS; i++)
	{
		PlayerDraw(&players[i], screenYOff);

		if (!players[i].Enabled) continue;

		// Draw each player's current score.
		char buf[17];
		sprintf(buf, "%d", players[i].Score);
		const SDL_Color white = { 255, 255, 255, 255 };
#ifdef TTF
		SDL_Surface *t = TTF_RenderText_Blended(font, buf, white);
#endif
		const int x = (c + 1) * SCREEN_WIDTH / (PlayerEnabledCount() + 1);
#ifdef TTF
		const int wHalf = (t->w + PLAYER_SPRITESHEET_WIDTH) / 2;
#else
		const int wHalf = (16 + PLAYER_SPRITESHEET_WIDTH) / 2;
#endif
		// Draw the player icon, followed by the score number
		SDL_Rect src = {
			0, 0, PLAYER_SPRITESHEET_WIDTH, PLAYER_SPRITESHEET_HEIGHT
		};
		SDL_Rect dest = { (Sint16)(x - wHalf), 0, 0, 0 };
		SDL_BlitSurface(PlayerSpritesheets[i], &src, Screen, &dest);
		// Draw score number
		dest.x = (Sint16)(x - wHalf + PLAYER_SPRITESHEET_WIDTH);
#ifdef TTF
		dest.y = (Sint16)(PLAYER_SPRITESHEET_HEIGHT - t->h) / 2;
#else
		dest.y = (Sint16)(PLAYER_SPRITESHEET_HEIGHT - 16) / 2;
#endif
		
#ifdef TTF
		SDL_BlitSurface(t, NULL, Screen, &dest);
		SDL_FreeSurface(t);
#endif

		c++;
	}

	SDL_Flip(Screen);
}
Пример #3
0
void TurnManager::Draw()
{
  map.Draw();
  boss.Draw();
 
  for (int i = 0; i < 3; i++)
  {
    player[i]->Draw();
  }
    PlayerDraw(now_player);
  
}
Пример #4
0
/*------------------------------------------------------------------------------*
| <<< ゲームメイン >>>
*------------------------------------------------------------------------------*/
void	game_main(void)
{
	d3_render_begin();
	PrintfInit();			// Printf クリアー
	Camera();				// カメラ

	switch(game.iMode)
	{
	//--- タイトル -------------------------------------------------------------
	case MODE_TITLE:
		Title(TEX_TITLE, &game.iMode, MODE_INFO, SND_OK);
		break;

	//--- 説明 ---------------------------------------------------------------
	case MODE_INFO:
		if(Title(TEX_INFO, &game.iMode, MODE_GAME, SND_OK))
		{
			PlayerInit();			// プレイヤー初期化
			EnemyInit();
			
		}
		break;

	//--- ゲーム -------------------------------------------------------------
	case MODE_GAME:
		PlayerMain();				// プレイヤーメイン
		PlayerDraw();				// プレイヤー描画
		EnemyMain();
		EnemyDraw();
		HitPointDraw(0, player->m_fHP / HP_MAX);
		HitPointDraw(1, enemy->m_fHP / HP_MAX);
		break;

	//--- ゲームオーバー -----------------------------------------------------
	case MODE_WIN:
		Title(TEX_WIN, &game.iMode, MODE_TITLE, SND_WIN_LOSE);
		break;

	//case MODE_LOSE:
		//Title(TEX_LOSE, &game.iMode, MODE_TITLE, SND_WIN_LOSE);
		//break;
	}
	PrintfFlush();							// Printf 描画
	d3_render_end();
}