Exemplo n.º 1
0
bool Application::OnUpdate()
{
	//System Update
	m_pMouse->Update();
	m_pKeyboard->Update();
	m_pCamera->Update();
	m_pGameTime->Update();

	//m_fRot += PI * GameTime::GetTimeElapsed();
	//m_pScene->SetRotateY(m_fRot);

	m_pScene->Update();

	if(m_pKeyboard->IsKeyPressed(KEY_1))
	{
		m_pParent->DetachChild(m_pChild);
	}
	else if(m_pKeyboard->IsKeyPressed(KEY_2))
	{
		m_pParent->AttachChild(m_pChild);
	}

	m_pChild->Update();

	DX11Camera::FreeLookCamera(m_pCamera,10.0f);
	//m_pCamera->LookAt(D3DXVECTOR3(0,0,0));

	

	//Window Update
	return m_pWindow->Tick();
}
Exemplo n.º 2
0
bool Application::OnCreate(const char* a_sCmdLine)
{
	Utilities::ConsoleShow(true);

	//System
	m_pWindow = Window::Create("Ichor Window",1024,768);
	m_pRenderer = DX11Renderer::Create(m_pWindow);
	m_pGameTime = GameTime::Create();

	//Input
	m_pKeyboard = Keyboard::Create();
	m_pMouse = Mouse::Create();
	m_pWindow->AttachMouse(m_pMouse);

	//Camera
	DX11Frustrum oFustrum;
	oFustrum.m_fFieldOfView = ((F32)PI_HALF / 2.0f);
	oFustrum.m_fScreenAspect = ((F32)m_pWindow->GetWidth() / (F32)m_pWindow->GetHeight());
	oFustrum.m_fNear = 0.01f;
	oFustrum.m_fFar = 100.0f;

	m_pCamera = DX11Camera::Create(oFustrum);
	m_pCamera->SetTranslate(0.0f,0.0f,-10.0f);

	struct sData
	{
		char cInitial;
		int iVal;
		float fVal;
		double dVal;
		long long llVal;
		char cVal;
	};

	sData* fDelta = new sData;
			
	//Shaders
	m_pShaderProp = ShaderProperty::Create("./Data/Shaders/Base.hlsl");
	m_pShaderProp->AddCBuffer("Matrix",fDelta,sizeof(sData),0);

	//OBJECTS

	//Scene
	m_pScene = new Node("Scene");
	
	//Cube
	m_pParent = dynamic_cast<Mesh*>(CreateCube());
	m_pParent->AttachProperty(m_pShaderProp);
	m_pParent->SetTranslate(1,0,0);

	m_pChild = dynamic_cast<Mesh*>(m_pParent->Clone());
	m_pChild->SetTranslate(-5,0,0);

	m_pParent->Update();
	m_pChild->Update();

	//Parenting
	m_pScene->AttachChild(m_pParent);
	m_pParent->AttachChild(m_pChild);
	

	m_fRot = 0.0f;

	return true;
}