
#include "Scene.h"
#include <DxLib.h>
#include "UI.h"

int PrepareScene(GameInformation * gi) {
	int next_scene = SCENE_PREPARE_GAME;

	//ここで読み込む
	if (gi == NULL) return SCENE_SHUTDONW;
	
	//ここで初期化を行う
	//プレイヤーの初期化
	gi->player.x = -50;
	gi->player.y = 540;
	gi->player.health = 500;
	gi->player.w = 138;
	gi->player.h = 48;
	gi->player.speed = 8;

	//敵の初期化
	clearMobs(&gi->mobs);

	//弾の初期化
	clearBullet(&gi->player.bullet);



	int count = 0;

	int ready_image = LoadGraph("media\\ready.png");
	int go_image = LoadGraph("media\\go.png");

	while (ProcessMessage() == 0 && next_scene == SCENE_PREPARE_GAME) {
		ClearDrawScreen();

		//背景を描写
		DrawGraph(0, 0, gi->rs.background, false);

		//自機登場
		if (count < 60) gi->player.x += 5;

		drawPlayer(&gi->player, &gi->rs);

		//Readyの文字表示
		if (count < 120) DrawGraph(798, 498, ready_image, true);
		else DrawGraph(830, 470, go_image, true);

		//UIの表示
		drawUI(gi, 0);

		//シーン遷移
		if (CheckHitKey(KEY_INPUT_ESCAPE)) next_scene = SCENE_SHUTDONW;
		if (count >= 180) next_scene = SCENE_GAME;

		ScreenFlip2(gi);
		count++;
	}

	DeleteGraph(ready_image);
	DeleteGraph(go_image);

	return next_scene;
}

