Update SandboxLayer.h
This commit is contained in:
parent
aaf1bbfe74
commit
cf888cfbe0
1 changed files with 7 additions and 5 deletions
|
@ -11,12 +11,14 @@ private:
|
||||||
glm::vec2 m_Direction;
|
glm::vec2 m_Direction;
|
||||||
float m_Speed = 1.2f;
|
float m_Speed = 1.2f;
|
||||||
|
|
||||||
Light::Camera m_Camera;
|
std::shared_ptr<Light::Camera> m_Camera;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SandboxLayer(const std::string& name)
|
SandboxLayer(const std::string& name)
|
||||||
: Light::Layer(name), m_Camera(glm::vec2(0.0f), 800.0f / 600.0f, 1.0f), m_Direction(glm::vec2(0.0f, 0.0f))
|
: Light::Layer(name), m_Direction(glm::vec2(0.0f, 0.0f))
|
||||||
{
|
{
|
||||||
|
m_Camera = std::make_shared<Light::Camera>(glm::vec2(0.0f), 800.0f / 600.0f, 1.0f);
|
||||||
|
|
||||||
Light::ResourceManager::LoadTexture("awesomeface", "res/Textures/awesomeface.png");
|
Light::ResourceManager::LoadTexture("awesomeface", "res/Textures/awesomeface.png");
|
||||||
m_AwesomefaceTexture = Light::ResourceManager::GetTexture("awesomeface");
|
m_AwesomefaceTexture = Light::ResourceManager::GetTexture("awesomeface");
|
||||||
|
|
||||||
|
@ -32,8 +34,8 @@ public:
|
||||||
|
|
||||||
void OnRender() override
|
void OnRender() override
|
||||||
{
|
{
|
||||||
m_Camera.CalculateProjection();
|
m_Camera->CalculateProjection();
|
||||||
m_Camera.CalculateView();
|
m_Camera->CalculateView();
|
||||||
|
|
||||||
Light::Renderer::BeginScene(m_Camera);
|
Light::Renderer::BeginScene(m_Camera);
|
||||||
|
|
||||||
|
@ -76,7 +78,7 @@ public:
|
||||||
|
|
||||||
void OnUpdate(float deltaTime) override
|
void OnUpdate(float deltaTime) override
|
||||||
{
|
{
|
||||||
m_Camera.Move(m_Direction * m_Speed * deltaTime);
|
m_Camera->Move(m_Direction * m_Speed * deltaTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue