Finish lecture 82: Implement the World class
Signed-off-by: Daniel Henry <iamdanhenry@gmail.com>
This commit is contained in:
34
LightYearsEngine/include/framework/Application.h
Normal file
34
LightYearsEngine/include/framework/Application.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
#include <SFML/Graphics.hpp>
|
||||
#include "framework/Core.h"
|
||||
|
||||
namespace ly {
|
||||
|
||||
class World;
|
||||
class Application {
|
||||
public:
|
||||
Application();
|
||||
void Run();
|
||||
|
||||
template<typename WorldType>
|
||||
weak<World> LoadWorld() {
|
||||
shared<WorldType> newWorld{ new WorldType{this} };
|
||||
currentWorld = newWorld;
|
||||
currentWorld->BeginPlayInternal();
|
||||
return newWorld;
|
||||
}
|
||||
private:
|
||||
void TickInternal(float deltaTime);
|
||||
void RenderInternal();
|
||||
|
||||
virtual void Render();
|
||||
virtual void Tick(float deltaTime);
|
||||
|
||||
sf::RenderWindow mWindow;
|
||||
float mTargetFrameRate;
|
||||
sf::Clock mTickClock;
|
||||
|
||||
shared<World> currentWorld;
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user