Anvil Engine
Loading...
Searching...
No Matches
CGame.h
Go to the documentation of this file.
1#pragma once
2#include "IGame.h"
3#include "AMath.h"
4#include "AnvilCamera.h"
5#include <vector>
6
7class AEntity;
9
10class CGame : public IGame
11{
12public:
13 CGame() = default;
14 virtual ~CGame() = default;
15
16 virtual void OnInit(AEngine* engine) override;
17 virtual void OnUpdate(float dt) override;
18 virtual void OnShutdown() override;
19
20 virtual glm::mat4 GetViewMatrix() override {
21 return m_camera ? m_camera->GetViewMatrix() : glm::mat4(1.0f);
22 }
23
24private:
25 AEntity* m_playerEntity = nullptr;
26 AEntity* m_crate = nullptr;
27
28 RigidBodyComponent* m_playerRB = nullptr;
29 ACamera* m_camera = nullptr;
30
31 bool m_firstMouse = true;
32 float m_lastX = 400.0f;
33 float m_lastY = 300.0f;
34};
35extern "C" __declspec(dllexport) IGame* CreateGame() {
36 return new CGame();
37}
float dt
Definition Main.cpp:10
__declspec(dllexport) IGame *CreateGame()
Definition CGame.h:35
Definition AnvilCamera.h:15
The main engine class that manages the application lifecycle, rendering, entities,...
Definition AEngine.h:25
Represents an entity in the game engine with position, rotation, scale and components.
Definition AEntity.h:16
Definition CGame.h:11
virtual glm::mat4 GetViewMatrix() override
Definition CGame.h:20
virtual void OnUpdate(float dt) override
Update function called every frame to handle game logic and player movement.
Definition CGame.cpp:52
virtual void OnShutdown() override
Definition CGame.cpp:120
virtual ~CGame()=default
CGame()=default
virtual void OnInit(AEngine *engine) override
Initialize the game scene with entities, physics, and camera.
Definition CGame.cpp:18
Definition IGame.h:8
Definition RigidBodyComponent.h:11