charcoal/OpenGLEngine/Scene.h

46 lines
1.1 KiB
C
Raw Permalink Normal View History

2018-09-04 19:25:54 +00:00
#pragma once
2018-10-10 21:44:15 +00:00
#include "deps.h"
2018-09-04 19:25:54 +00:00
#include <time.h>
#include "Application.h"
2018-09-12 21:03:46 +00:00
namespace charcoal
2018-09-04 19:25:54 +00:00
{
2018-09-12 21:03:46 +00:00
class Scene
{
public:
Scene(Application& application)
: m_screen_size(application.get_screen_size()),
m_input_manager(application.get_input_manager()),
m_fps(application.get_fps())
{};
virtual ~Scene() {};
// Called when the scene is ready to be initialized
virtual void init() = 0;
// Called when the scene is going to be used
// Should allocate all graphics memory.
virtual void use() = 0;
// Called when the scene is no longer going to be used
// Should release all graphics memory
virtual void unuse() = 0;
// Called when the frame is being updated
virtual void update(float delta_time, clock_t clock) = 0;
// Called before the scene is rendered.
// Intended to prepare objects for rendering (generally by calling their prerender function)
virtual void prerender() = 0;
// Called when the frame is being rendered
virtual void render() = 0;
protected:
const ivec2& m_screen_size;
const GLFWInputManager& m_input_manager;
const FPS& m_fps;
};
}