use mvp
Switch from MVC (Model-View-Controller) pattern to a modified MVP (Model-View-Presenter) pattern, to toss out the inconvenient Controller
This commit is contained in:
		| @@ -19,25 +19,43 @@ | ||||
| #ifndef VIEW_H | ||||
| #define VIEW_H | ||||
|  | ||||
| #include <bounce/common/math/vec2.h> | ||||
| #include <testbed/framework/presenter.h> | ||||
|  | ||||
| struct GLFWwindow; | ||||
|  | ||||
| class Model; | ||||
|  | ||||
| class View | ||||
| { | ||||
| {	 | ||||
| public: | ||||
| 	View(GLFWwindow* window, Model* model); | ||||
|  | ||||
| 	~View(); | ||||
|  | ||||
| 	void Event_SetWindowSize(int w, int h); | ||||
| 	void Event_Press_Key(int button); | ||||
| 	void Event_Release_Key(int button); | ||||
| 	void Event_Press_Mouse(int button); | ||||
| 	void Event_Release_Mouse(int button); | ||||
| 	void Event_Move_Cursor(float x, float y); | ||||
| 	void Event_Scroll(float dx, float dy); | ||||
|  | ||||
| 	void Command_PreDraw(); | ||||
|  | ||||
| 	void Command_Draw(); | ||||
|  | ||||
| 	void Command_PostDraw(); | ||||
| private: | ||||
| 	GLFWwindow * m_window; | ||||
| 	friend class Presenter; | ||||
|  | ||||
| 	Presenter m_presenter; | ||||
| 	Model* m_model; | ||||
|  | ||||
| 	GLFWwindow* m_window; | ||||
| 	bool m_leftDown; | ||||
| 	bool m_rightDown; | ||||
| 	bool m_shiftDown; | ||||
| 	b3Vec2 m_ps0; | ||||
| 	// Ray3 m_ray0; | ||||
| }; | ||||
|  | ||||
| #endif | ||||
		Reference in New Issue
	
	Block a user