3205680062
Also added a required prerender function to scene and application. This function is intended to be used as a way to prepare the scene to be rendered in its current state. For that reason, the delta time and the current clock tick are not passed to it.
52 lines
953 B
C++
52 lines
953 B
C++
#pragma once
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include <glm/glm.hpp>
|
|
|
|
#include "GLFWInputManager.h"
|
|
#include "FPS.h"
|
|
|
|
// TODO: Close without rendering next frame.
|
|
|
|
using namespace glm;
|
|
|
|
class Application
|
|
{
|
|
public:
|
|
Application(int width = -1, int height = -1);
|
|
virtual ~Application() {}
|
|
|
|
int run();
|
|
|
|
const ivec2& get_screen_size() const { return m_screen_size; }
|
|
|
|
const GLFWInputManager& get_input_manager() const { return m_glfw_input_manager; }
|
|
|
|
const FPS& get_fps() const { return m_fps; }
|
|
|
|
protected:
|
|
// Called on initialization of the application (called by base_init)
|
|
virtual void init() = 0;
|
|
|
|
virtual void update(float delta_time, clock_t clock) = 0;
|
|
|
|
virtual void prerender() = 0;
|
|
|
|
virtual void render() = 0;
|
|
|
|
// Called on closing of the application (called before base_close)
|
|
virtual void close() {}
|
|
|
|
GLFWwindow* m_p_window;
|
|
|
|
const ivec2 m_screen_size;
|
|
|
|
GLFWInputManager m_glfw_input_manager;
|
|
|
|
FPS m_fps;
|
|
private:
|
|
void base_close();
|
|
};
|
|
|