Example #1
0
//=============================================================================
// Render game items
//=============================================================================
void Game::renderGame()
{
    const int BUF_SIZE = 20;
    static char buffer[BUF_SIZE];

    //start rendering
    if (SUCCEEDED(graphics->beginScene()))
    {
        render();           // call render() in derived object

        graphics->spriteBegin();    // begin drawing sprites
        if(fpsOn)           // if fps display requested
        {
            // convert fps to string
            _snprintf_s(buffer, BUF_SIZE, "fps %d ", (int)fps);
            dxFont.print(buffer,GAME_WIDTH-100,GAME_HEIGHT-28);
        }
        graphics->spriteEnd();      // end drawing sprites

        console->draw();    // console is drawn here so it appears on top of game

        messageDialog->draw();  // dialog is drawn on top
        inputDialog->draw();    // dialog is drawn on top

        //stop rendering
        graphics->endScene();
    }
    handleLostGraphicsDevice();

    //display the back buffer on the screen
    graphics->showBackbuffer();
}
Example #2
0
//=============================================================================
// Render game items
//=============================================================================
void Game::renderGame()
{
    //start rendering
    if (SUCCEEDED(graphics->beginScene()))
    {
        render();           // call render() in derived object

        //stop rendering
        graphics->endScene();
    }
    handleLostGraphicsDevice();

    //display the back buffer on the screen
    graphics->showBackbuffer();
}
Example #3
0
// ==================================================================
// ゲームアイテムをレンダー
// ==================================================================
void Game::renderGame()
{
	// レンダリングを開始
	if(SUCCEEDED(graphics->beginScene()))
	{
		// renderは、継承したクラス側で記述する必要のある純粋仮想関数です
		render();  // 派生クラスのrender()を呼び出す

		// レンダリングを終了
		graphics->endScene();
	}
	handleLostGraphicsDevice();

	// バックバッファを画面に表示
	graphics->showBackbuffer();
}
Example #4
0
//=============================================================================
// Render game items
//=============================================================================
void Game::renderGame()
{
    //start rendering
    if (SUCCEEDED(graphics->beginScene()))
    {
        // render is a pure virtual function that must be provided in the
        // inheriting class.
        render();               // call render in derived class

        //stop rendering
        graphics->endScene();
    }
    handleLostGraphicsDevice();

    //display the back buffer on the screen
    graphics->showBackbuffer();
}
Example #5
0
void Game::renderGame()
{
	//Begin a DirectX scene
	if (SUCCEEDED(graphics_->beginScene()))
	{
		//Render is a pure virtual function that must be provided in the
		//inheriting class.
		render(); //Call render in derived class
		graphics_->endScene();

	}

	handleLostGraphicsDevice();

	//Display the backbuffer on the screen
	graphics_->showBackbuffer();
}
Example #6
0
//=============================================================================
// Render game items
// ゲームアイテムをレンダー P139
//=============================================================================
void Game::renderGame()
{
    //start rendering
	// レンダリングを開始
    if (SUCCEEDED(graphics->beginScene()))
    {
        render();           // call render() in derived object
							// 派生クラスのrender()を呼び出す

        //stop rendering
		// レンダリング終了
        graphics->endScene();
    }
    handleLostGraphicsDevice();

    //display the back buffer on the screen
	// バックバッファを画面に表示
    graphics->showBackbuffer();
}
Example #7
0
//=============================================================================
// Render game items
//=============================================================================
void Game::renderGame()
{
    //start rendering
    if (SUCCEEDED(graphics->beginScene()))
    {
        render();           // call render() in derived object

		// added - KJB - display fps
		//strcpy_s(fpsStr,"FPS: ");
		//_itoa((int)fps,fpsStr+5,10); // convert FPS to string
		//graphics->DrawTextString(10,10,fpsStr);  // display the string

		int mouseX = input->getMouseX();
		int mouseY = input->getMouseY();

		// added to display mouse SCREEN position
		
		

		//added to display mouse MAP position
		/*strcpy_s(mouseMapStr,"Mouse MAP at (");
		itoa(mouseX-offsetX,mouseMapStr + strlen(mouseMapStr),10);
		strcat_s(mouseMapStr,",");
		itoa(mouseY-offsetY,mouseMapStr + strlen(mouseMapStr),10);
		strcat_s(mouseMapStr,")");
		graphics->DrawTextString(10,35,mouseMapStr);  // display the string 
		*/

		stringstream ss;
		
		ss << "Current State: " << currentState,mapStr + strlen(mapStr);
		//graphics->DrawTextString(10,440, ss.str().c_str());  // display the string
		ss.str(std::string()); // Clears the string stream.

		//pause message
		if(paused)
		{
			ss << "PAUSED - Hit [SPACE] to continue.";
			graphics->DrawTextString(200, 300, ss.str().c_str());
			ss.str(std::string()); // Clears the string stream.
		}

		if(currentState == START)
		{
			if(instructions == 0)
			{
				ss << "Press Up or Down for instructions" << "\n" << "Press Space to Start";
				graphics->DrawTextString(10, GAME_HEIGHT / 2 + 180, D3DCOLOR_ARGB(255, 139, 0, 0), ss.str().c_str());
				ss.str(std::string()); // Clears the string stream.

				ss << "By JP, DD, MSP, JL, RC";
				graphics->DrawTextString(410, GAME_HEIGHT - 30, D3DCOLOR_ARGB(255, 139, 0, 0), ss.str().c_str());
				ss.str(std::string()); // Clears the string stream.
			}
			else if (instructions == 1)
			{
				ss << "Instructions:";
				graphics->DrawTextString(50, 25, D3DCOLOR_ARGB(255, 155, 255, 255), ss.str().c_str());
				ss.str(std::string());
				/*ss << "Open and close the menu with M" << "\n" << "Move around with WASD" << "\n" << "Left click or press A to select a tile" << "\n" << "T to switch elemental tile." << "\n" << "1 and 2 to pull and push enemies" << "\n" << "Defeat the enemies to advance" << "\n" << "Escape will quit the game" << "\n\n" << "Fire increases Strength" << "\n" << "Earth increases Defense" << "\n" << "Wind increases Speed" << "\n" << "Water can be used to HEAL" ;*/
				
				ss << "Keyboard Controls for overworld:" << endl;
				ss << "WASD control movement." << endl;
				ss << "Arrow keys control the menu." << endl;
				ss << "Push and pull are overworld abilities." << endl;
				ss << "Activate push and pull with 1 and 2" << endl;
				ss << "Right click a tile to grow a terrain feature." << endl;
				ss << "Shift right click a tile to remove a terrain feature." << endl;
				ss << "Press M to toggle and disable the menu." << endl;
				ss << "Clicking a tile changes the element of that tile" << endl;
				ss << "Press T with the menu open to cycle through the tiles." << endl;
				ss << "Y button switches the element you can create." << endl << endl;
				ss << "Controls for Battle:" << endl;
				ss << "Select a movement option and then a combat option." << endl;
				ss << "Exit flees the battle." << endl;
				ss << "Water improves healing, earth improves defense,\nFire improves offense and wind improves speed." << endl;

				graphics->DrawTextString(50, 50, D3DCOLOR_ARGB(255, 255, 255, 255), ss.str().c_str());
				ss.str(std::string()); // Clears the string stream.
			}
			else if (instructions == 2)
			{
				//if (input->getControllerState(0)->connected)
				//{

				ss << "Instructions:";
				graphics->DrawTextString(50, 25, D3DCOLOR_ARGB(255, 155, 255, 255), ss.str().c_str());
				ss.str(std::string());
					ss << "Gamepad Controls for overworld:" << endl;
					ss << "Left thumbstick moves the player." << endl;
					ss << "Right thumbstick moves the camera / cursor." << endl;
					ss << "Left bumper pulls nearby enemies." << endl;
					ss << "Right bumper pushes nearby enemies." << endl;
					ss << "Right trigger + A increases tile feature." << endl;
					ss << "Right trigger + B decreases tile feature." << endl;
					ss << "B button held down and DPad button changes direction." << endl;
					ss << "Left trigger + A increases generates battlemap" << endl;
					ss << "A button changes element of selected tile ." << endl;
					ss << "Y button switches the element you can create." << endl << endl;
					ss << "Controls for Battle:" << endl;
					ss << "Left Thumbstick and DPad change menu options." << endl;
					ss << "Right Thumbstick moves tile cursor." << endl;
					ss << "A selects menu option." << endl;
					graphics->DrawTextString(50, 50, D3DCOLOR_ARGB(255, 255, 255, 255), ss.str().c_str());
					ss.str(std::string()); // Clears the string stream.
				//}
			}
		}
		if(currentState == OVERWORLD || currentState == BATTLE)
		{
			ss << "Mouse SCREEN at (" << mouseX << "," << mouseY << ")";;
			//graphics->DrawTextString(10, 10, ss.str().c_str());  // display the string
			ss.str(std::string()); // Clears the string stream.

			//added to display the position of the screen origin RELATIVE TO THE MAP
			//**NOTE - the offset is negated because Bierre wants the vector FROM the map origin TO the screen origin. If we want the opposite, we simply take out the negative signs.**
			ss << "Map Offset (" << -offsetX << "," << -offsetY << ")";
			//graphics->DrawTextString(10, 35, ss.str().c_str());  // display the string
			ss.str(std::string()); // Clears the string stream.

			ss << "Current Element: " << currentElement;
			//graphics->DrawTextString(10, 60, ss.str().c_str());
			ss.str(std::string()); // Clears the string stream.

			ss << "Focused Tile: (" << focusedTileX << "," << focusedTileY << ")";
			//graphics->DrawTextString(10, 110, ss.str().c_str());
			ss.str(std::string()); // Clears the string stream.
		}
		if(currentState == BATTLE)
		{
			if(currentTurn == 1)
			{
				ss << "Current Turn: Player";
			}
			else
			{
				ss << "Current Turn: " << currentTurn;
			}
			graphics->DrawTextString(10, 10, ss.str().c_str());
			ss.str(std::string()); // Clears the string stream.

			ss << "Backspace - To overworld";
			graphics->DrawTextString(10, 35, ss.str().c_str());
			ss.str(std::string()); // Clears the string stream.
			
			//ss << "S: " << player->

		}

        //stop rendering
        graphics->endScene();
    }
    handleLostGraphicsDevice();

    //display the back buffer on the screen
    graphics->showBackbuffer();
}