Exemplo n.º 1
0
void DemoScreenByeBye::Start()
{
	//"Goodnight, Gracie."
	TextActor *t = new TextActor("Console", "That's all we've got in the demo app.");
	t->SetPosition(0, 3.5);
	t->SetAlignment(TXT_Center);
	TextActor *t2 = new TextActor("Console", "Make sure to check out the documentation -- there are lots of other features.\n\nhttp://angel-engine.googlecode.com");
	t2->SetPosition(0, 2);
	t2->SetAlignment(TXT_Center);
	TextActor *t3 = new TextActor("Console", "Press Esc to exit.");
	t3->SetPosition(0, -1);
	t3->SetAlignment(TXT_Center);

	theWorld.Add(t);
	theWorld.Add(t2);
	theWorld.Add(t3);






	//Demo housekeeping below this point. 
	#pragma region Demo housekeeping
	TextActor *fileLoc = new TextActor("ConsoleSmall", "DemoScreenByeBye.cpp");
	fileLoc->SetPosition(MathUtil::ScreenToWorld(5, 763));
	fileLoc->SetColor(.3f, .3f, .3f);
	theWorld.Add(fileLoc);
	_objects.push_back(fileLoc);
	_objects.push_back(t);
	_objects.push_back(t2);
	_objects.push_back(t3);
	#pragma endregion
}
void DemoScreenControllerInstructions::Start()
{
	//Some TextActors warning you of the hazards to come. 
	String explanation = "These next two screens show how we get input from an Xbox 360 controller";
	explanation += "\n\nIf you don't have or don't care about the controller, ";
	explanation += "\nthey'll be a little boring. Feel free to skip.";
	TextActor *t = new TextActor("Console", explanation);
	t->SetPosition(0, 3.5);
	t->SetAlignment(TXT_Center);

	theWorld.Add(t);






	//Demo housekeeping below this point. 
	#pragma region Demo housekeeping
	TextActor *fileLoc = new TextActor("ConsoleSmall", "DemoScreenControllerInstructions.cpp");
	fileLoc->SetPosition(MathUtil::ScreenToWorld(5, 763));
	fileLoc->SetColor(.3f, .3f, .3f);
	theWorld.Add(fileLoc);
	_objects.push_back(fileLoc);
	_objects.push_back(t);
	#pragma endregion
}
Exemplo n.º 3
0
void DemoScreenPathfinding::Start()
{
	//Set up our obstacle course
	theWorld.LoadLevel("maze");
	
	//Create the bounding box that will limit the pathfinding search area
	BoundingBox bounds(Vector2(-20, -20), Vector2(20, 20));
	
	//Create our pathfinding graph. In our 2D worlds, this is a relatively fast
	// operation -- you shouldn't be doing it every frame, but recalculating every
	// so often if your world has changed is not inappropriate. 
	theSpatialGraph.CreateGraph(
		0.75f, //The size of the entity you want to pathfind (so the generator
		       //  can know how small a space can be and still have it fit.)
		bounds //The search area
	);
	
	//Create a MazeFinder (class definition below), and put him in the bottom
	//  left corner of the maze
	MazeFinder *mf = new MazeFinder();
	mf->SetPosition(-11.5, -8);
	theWorld.Add(mf);
	
	//Send him to the upper right, watch him scurry
	mf->GoTo(Vector2(11.5, 8));
	
	
	
	//Demo housekeeping below this point. 
	#pragma region Demo housekeeping
	String description = "This little dude is pathfinding through the area.";
	description += "\n\nClick the mouse to give him a new target.";
	description += "\n\nPress [B] to see the pathfinding graph.";
	TextActor *t = new TextActor("Console", description);
	t->SetAlignment(TXT_Center);
	t->SetPosition(0.0f, -5.0f);
	theWorld.Add(t);
	TextActor *fileLoc = new TextActor("ConsoleSmall", "DemoScreenPathfinding.cpp");
	fileLoc->SetPosition(MathUtil::ScreenToWorld(5, 763));
	fileLoc->SetColor(.3f, .3f, .3f);
	theWorld.Add(fileLoc);
	_objects.push_back(fileLoc);
	_objects.push_back(t);
	_objects.push_back(mf);
	ActorSet walls = theTagList.GetObjectsTagged("maze_wall");
	ActorSet::iterator it = walls.begin();
	while (it != walls.end())
	{
		_objects.push_back(*it);
		it++;
	}
	#pragma endregion
}
Exemplo n.º 4
0
   virtual void Start()
   {
      if( theTTTGame.GetTurn() == Invalid )
         m_square.SetColor( Color3f(0,0,1) );
      else if( theTTTGame.GetTurn() == X )
         m_square.SetColor( Color3f(1,0,0) );
      else
         m_square.SetColor( Color3f(0,1,0) );
      theWorld.Add( &m_square );
		
		TextActor *actor = new TextActor("Console", "Press SPACE to restart");
		actor->SetColor(0,0,0);
		actor->SetPosition(-6, 9);
		actor->SetAlignment(TXT_Center);
		theWorld.Add(actor,3);
		m_objects.push_back(actor);
   }
Exemplo n.º 5
0
   virtual void Start()
   {
	   Vector2 fULCorner = MathUtil::ScreenToWorld(0, 0);
	   Vector2 fLRCorner = MathUtil::ScreenToWorld(m_screenWidth, m_screenHeight);
	   Vector2 scrnDims( fabs(fLRCorner.X) + fabs(fULCorner.X), fabs(fLRCorner.Y) + fabs(fULCorner.Y) );

	   float multiplier = 0.8f;
	   float minGridDim = multiplier * MIN(scrnDims.X, scrnDims.Y);

	   float cellSize = minGridDim / float(m_gridSize);	
      theTTTGame.StartGame(cellSize, m_gridSize);    
		theTTTGame.setPlayer1Type(PLAYER1_IS_AI);
		theTTTGame.setPlayer2Type(PLAYER2_IS_AI);
		
		TextActor *actor = new TextActor("Console", "Press SPACE to restart");
		actor->SetColor(0,0,0);
		actor->SetPosition(-6, 9);
		actor->SetAlignment(TXT_Center);
		theWorld.Add(actor,3);
		m_objects.push_back(actor);
   }
Exemplo n.º 6
0
void DemoScreenInstructions::Start()
{
	//Just some text actors to give instructions. Nothing much to see here. 
	TextActor *t = new TextActor("Console", "This demo is designed to be super simple. Maybe too much so.");
	t->SetPosition(0, 3.5);
	t->SetAlignment(TXT_Center);
	TextActor *t2 = new TextActor("Console", "Each example is self-contained within the file shown at the bottom left.");
	t2->SetPosition(0, 2);
	t2->SetAlignment(TXT_Center);
	TextActor *t3 = new TextActor("Console", "The files are pretty thoroughly commented, so check them out to see how we do things.");
	t3->SetPosition(0, 0.5);
	t3->SetAlignment(TXT_Center);
	TextActor *t4 = new TextActor("Console", "Press [A] on the 360 Controller to go to the next example, and Back to go back.");
	t4->SetPosition(0, -3.5);
	t4->SetAlignment(TXT_Center);

	theWorld.Add(t);
	theWorld.Add(t2);
	theWorld.Add(t3);
	theWorld.Add(t4);





	//Demo housekeeping below this point. 
	#pragma region Demo housekeeping
	TextActor *fileLoc = new TextActor("ConsoleSmall", "DemoScreenInstructions.cpp");
	fileLoc->SetPosition(MathUtil::ScreenToWorld(5, 763));
	fileLoc->SetColor(.3f, .3f, .3f);
	theWorld.Add(fileLoc);
	_objects.push_back(fileLoc);
	_objects.push_back(t);
	_objects.push_back(t2);
	_objects.push_back(t3);
	_objects.push_back(t4);
	#pragma endregion
}
Exemplo n.º 7
0
void DemoScreenStart::Start()
{
	//TextActors, oddly enough, let you display text!
	TextActor *t = new TextActor("Console", "Welcome to Angel. This is a quick demo of what we can do.");
	t->SetPosition(0, 3.5);
	t->SetAlignment(TXT_Center);
	TextActor *t2 = new TextActor("Console", "(press [A] on the 360 controller or space bar to continue)");
	t2->SetPosition(0, 2);
	t2->SetAlignment(TXT_Center);

	theWorld.Add(t);
	theWorld.Add(t2);

	//Demo housekeeping below this point. 
	#pragma region Demo housekeeping
	TextActor *fileLoc = new TextActor("ConsoleSmall", "DemoScreenStart.cpp");
	fileLoc->SetPosition(MathUtil::ScreenToWorld(5, 763));
	fileLoc->SetColor(.3f, .3f, .3f);
	theWorld.Add(fileLoc);
	_objects.push_back(fileLoc);
	_objects.push_back(t);
	_objects.push_back(t2);
	#pragma endregion
}