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