示例#1
0
Entity* LevelSelectObject::AddLevel(const char * name, const char * level, const Vector2 & position, Entity* owner)
{
	Entity* entity = owner->AttachChild(EntityFactory::CreateGraphic(position, size + stroke, NULL, Vector4(0, 0, 0)));
	entity->AttachChild(EntityFactory::CreateGraphic(Vector2(0, size.y * 0.3f), Vector2(size.x, size.y * 0.4f), NULL, Vector4(1, 1, 1, 0.1f), 1));

	entity = entity->AttachChild(EntityFactory::CreateCSVGraphic(Vector2(), size, ToString("Data//Levels//", level, ".csv").c_str(), Vector4(1, 1, 1)));

	if (!string(name).empty())
	{
		entity->AttachChild(EntityFactory::CreateTextGUI(Vector2(0, size.y * 0.5f), name, 300))
			->GetComponent<TextRenderer2D>()->color.Set(0.75f, 0.75f, 0);
	}

	return entity;
}
示例#2
0
void StageGUI::Init(Entity * ent)
{
	stage = ent->GetComponent<StageManager>();

	{
		Entity* entity = EntityFactory::GenerateTextGUI(Vector2(GridWidth * 0.5f, Screen.GetProjectionHeight() * 0.55f), "", 400);
		indicator = entity->GetComponent<TextRenderer2D>();
		indicator->color.w = 0;
	}
	{
		Entity* entity = EntityFactory::GenerateTextGUI(Vector2(140, TileHeight * 0.5f), "", 200);
		timer = entity->GetComponent<TextRenderer2D>();
		timer->SetAlignCenter(false);
	}
	{
		Entity* entity = EntityFactory::GenerateTextGUI(Vector2(16, Screen.GetProjectionHeight() - TileHeight * 0.5f), "", 256);
		wave = entity->GetComponent<TextRenderer2D>();
		wave->SetAlignCenter(false);
	}
	{
		Entity* entity = EntityFactory::GenerateTextGUI(Vector2(200, Screen.GetProjectionHeight() - TileHeight * 0.5f), "", 200);
		health = entity->GetComponent<TextRenderer2D>();
		health->color.Set(1, 0, 0);
		health->SetAlignCenter(false);
	}
	{
		Entity* entity = EntityFactory::GenerateTextGUI(Vector2(300, Screen.GetProjectionHeight() - TileHeight * 0.5f), "", 200);
		gold = entity->GetComponent<TextRenderer2D>();
		gold->color.Set(1, 1, 0);
		gold->SetAlignCenter(false);
	}
	{
		Entity* entity = EntityFactory::GenerateButton(Vector2(64, TileHeight * 0.5f), Vector2(128, TileHeight), NULL, Vector3(0.5f, 0.5f, 0.5f), true);
		pause = entity->GetComponent<Button>();
		pause->SetKey(' ');
		pause->text = entity->AttachChild(EntityFactory::CreateTextGUI(Vector2(), "START", 200))->GetComponent<TextRenderer2D>();
	}
	{
		Entity* entity = EntityFactory::GenerateButton(Vector2(Screen.GetProjectionWidth() - TileWidth * 0.5f, Screen.GetProjectionHeight() - TileHeight * 0.5f), Vector2(TileWidth, TileHeight), NULL, Vector3(0.7f, 0, 0), true);
		entity->AttachChild(EntityFactory::CreateTextGUI(Vector2(), "X", 300));
		quit = entity->GetComponent<Button>();

		quitPopup = EntityFactory::GeneratePopup(Vector2(300, 150), "", 150);
	}
}
示例#3
0
void PlayState::Init()
{
	glClearColor(0.2, 0.2, 0.2, 1);

	scene = new Scene(NULL);

	Entity* entity = EntityFactory::GenerateButton(Vector2(200, 200), Vector2(200, 100), NULL, Vector3(0.5f, 0.5f, 0.5f));
	entity->AttachChild(EntityFactory::CreateTextGUI(Vector2(), "Return", 128));
	menu = entity->GetComponent<Button>();

	Resume();
}