Finished lecture 82

Signed-off-by: Daniel Henry <iamdanhenry@gmail.com>
This commit is contained in:
2025-09-02 09:32:30 -05:00
parent 7d2cd86fd4
commit c545d800d2
7 changed files with 149 additions and 92 deletions

View File

@@ -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