50 lines
709 B
C++
50 lines
709 B
C++
#pragma once
|
|
|
|
#include <set>
|
|
|
|
#include "PaintDevice.h"
|
|
|
|
class Engine
|
|
{
|
|
public:
|
|
enum class ErrorCode
|
|
{
|
|
success = 0,
|
|
paint_device_not_ready
|
|
};
|
|
|
|
virtual ~Engine() = default;
|
|
|
|
ErrorCode run();
|
|
|
|
protected:
|
|
void track_key(int key);
|
|
|
|
void untrack_key(int key);
|
|
|
|
PaintDevice& paint_device()
|
|
{
|
|
return m_PaintDevice;
|
|
}
|
|
|
|
virtual bool end() const = 0;
|
|
|
|
virtual void on_button_press(
|
|
int button
|
|
) = 0;
|
|
|
|
virtual void update(
|
|
int dt
|
|
) = 0;
|
|
|
|
virtual void render(
|
|
PaintDevice& paintDevice
|
|
) = 0;
|
|
|
|
private:
|
|
void updateInput();
|
|
|
|
PaintDevice m_PaintDevice;
|
|
|
|
std::set<int> m_TrackedKeys;
|
|
}; |