46 lines
864 B
C
46 lines
864 B
C
|
#pragma once
|
||
|
|
||
|
#include <Windows.h>
|
||
|
|
||
|
#include "vec2.h"
|
||
|
|
||
|
#include "Window.h"
|
||
|
#include "FPS.h"
|
||
|
|
||
|
// TODO: Close without rendering next frame.
|
||
|
|
||
|
class Application
|
||
|
{
|
||
|
public:
|
||
|
Application(const char* class_name, HINSTANCE h_instance);
|
||
|
~Application();
|
||
|
|
||
|
int run();
|
||
|
protected:
|
||
|
// Called on initialization of the application (called by base_init)
|
||
|
virtual bool init() = 0;
|
||
|
|
||
|
virtual void update(float delta_time, clock_t clock) = 0;
|
||
|
|
||
|
virtual void render() = 0;
|
||
|
|
||
|
// Called on closing of the application (called before base_close)
|
||
|
virtual void close();
|
||
|
|
||
|
// The size of the window
|
||
|
ivec2 m_client_size;
|
||
|
|
||
|
// The window that is used by this application
|
||
|
Window m_window;
|
||
|
|
||
|
// The input manager for the window of this application
|
||
|
const InputManager* m_input_manager;
|
||
|
|
||
|
// The FPS counter of this application
|
||
|
FPS m_fps;
|
||
|
private:
|
||
|
bool base_init();
|
||
|
void base_close();
|
||
|
};
|
||
|
|