ClubEnsayos.com - Ensayos de Calidad, Tareas y Monografias
Buscar

Application Class


Enviado por   •  11 de Mayo de 2019  •  Informes  •  1.488 Palabras (6 Páginas)  •  68 Visitas

Página 1 de 6

////////////////////////////////////////////////////////////////////////////////

// Filename: applicationclass.cpp

////////////////////////////////////////////////////////////////////////////////

#include "applicationclass.h"

ApplicationClass::ApplicationClass()

{

m_Input = 0;

m_Direct3D = 0;

m_Camera = 0;

m_Terrain = 0;

m_Timer = 0;

m_Position = 0;

m_Fps = 0;

m_Cpu = 0;

m_FontShader = 0;

m_Text = 0;

m_TerrainShader = 0;

m_Light = 0;

m_projectileCount = 0;

}

ApplicationClass::ApplicationClass(const ApplicationClass& other)

{

}

ApplicationClass::~ApplicationClass()

{

}

bool ApplicationClass::Initialize(HINSTANCE hinstance, HWND hwnd, int screenWidth, int screenHeight)

{

bool result;

float cameraX, cameraY, cameraZ;

D3DXMATRIX baseViewMatrix;

char videoCard[128];

int videoMemory;

// Create the input object. The input object will be used to handle reading the keyboard and mouse input from the user.

m_Input = new InputClass;

if(!m_Input)

{

return false;

}

// Initialize the input object.

result = m_Input->Initialize(hinstance, hwnd, screenWidth, screenHeight);

if(!result)

{

MessageBox(hwnd, L"Could not initialize the input object.", L"Error", MB_OK);

return false;

}

// Create the Direct3D object.

m_Direct3D = new D3DClass;

if(!m_Direct3D)

{

return false;

}

// Initialize the Direct3D object.

result = m_Direct3D->Initialize(screenWidth, screenHeight, VSYNC_ENABLED, hwnd, FULL_SCREEN, SCREEN_DEPTH, SCREEN_NEAR);

if(!result)

{

MessageBox(hwnd, L"Could not initialize DirectX 11.", L"Error", MB_OK);

return false;

}

// Create the camera object.

m_Camera = new CameraClass;

if(!m_Camera)

{

return false;

}

// Initialize a base view matrix with the camera for 2D user interface rendering.

m_Camera->SetPosition(0.0f, 0.0f, -1.0f);

m_Camera->Render();

m_Camera->GetViewMatrix(baseViewMatrix);

// Set the initial position of the camera.

cameraX = 50.0f;

cameraY = 2.0f;

cameraZ = -7.0f;

m_Camera->SetPosition(cameraX, cameraY, cameraZ);

// Create the terrain object.

m_Terrain = new TerrainClass;

if (!m_Terrain)

{

return false;

}

// Initialize the terrain object.

int textureCount = 5;

WCHAR** filenames = new WCHAR*[textureCount];

filenames[0] = L"../Engine/data/sand.jpg";

filenames[1] = L"../Engine/data/sand_conchas.jpg";

filenames[2] = L"../Engine/data/rock.jpg";

filenames[3] = L"../Engine/data/snow.jpg";

filenames[4] = L"../Engine/data/alpha.jpg";

result = m_Terrain->Initialize(m_Direct3D->GetDevice(), "../Engine/data/heightmap.bmp", filenames, textureCount);

if (!result)

{

MessageBox(hwnd, L"Could not initialize the terrain object.", L"Error", MB_OK);

return false;

}

// Create the terrain object.

m_Water = new TerrainClass;

if (!m_Water)

{

return false;

}

// Initialize the terrain object.

textureCount = 3;

filenames

...

Descargar como (para miembros actualizados)  txt (22.4 Kb)   pdf (78.2 Kb)   docx (24.5 Kb)  
Leer 5 páginas más »
Disponible sólo en Clubensayos.com