implement pen and erase as strategy pattern introducing the CanvasMode classes
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "shape.h"
|
||||
#include "brush.h"
|
||||
#include "action.h"
|
||||
#include "canvas_modes.h"
|
||||
|
||||
NS_START
|
||||
|
||||
@@ -66,8 +67,17 @@ public:
|
||||
Sampler m_sampler_mask;
|
||||
glm::vec2 m_cam_rot;
|
||||
float m_cam_fov = 85;
|
||||
enum class kPenState { Draw, Erase, Line, Camera };
|
||||
kPenState m_state{ kPenState::Draw };
|
||||
|
||||
enum class kCanvasMode { Draw, Erase, Line, Camera };
|
||||
kCanvasMode m_state{ kCanvasMode::Draw };
|
||||
static CanvasMode* modes[];
|
||||
CanvasMode* m_mode;
|
||||
static void set_mode(kCanvasMode mode)
|
||||
{
|
||||
I->m_mode = modes[(int)mode];
|
||||
I->m_state = mode;
|
||||
I->m_mode->canvas = I;
|
||||
}
|
||||
|
||||
GLuint cube_id;
|
||||
RTT m_latlong;
|
||||
@@ -96,7 +106,6 @@ public:
|
||||
void preview_generate();
|
||||
};
|
||||
|
||||
|
||||
class ActionStroke : public Action
|
||||
{
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user