File: DemoKeeper.h

package info (click to toggle)
mygui 3.4.3%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 38,792 kB
  • sloc: cpp: 133,849; ansic: 30,249; xml: 15,794; cs: 12,601; tcl: 776; python: 400; makefile: 35; sh: 4
file content (84 lines) | stat: -rw-r--r-- 2,320 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*!
	@file
	@author		Albert Semenov
	@date		08/2008
*/
#ifndef DEMO_KEEPER_H_
#define DEMO_KEEPER_H_

#include "Base/BaseDemoManager.h"
#include "GraphView.h"
#include "AnimationGraph.h"
#include "AnimationNodeFactory.h"
#include "GraphNodeFactory.h"
#include "OpenSaveFileDialog.h"
#include "ContextMenu.h"

namespace demo
{

	class DemoKeeper : public base::BaseDemoManager
	{
	private:
		void createScene() override;
		void destroyScene() override;
		void setupResources() override;
		void notifyFrameStarted(float _time);

		void createGrapView();
		void notifyNodeClosed(wraps::BaseGraphView* _sender, wraps::BaseGraphNode* _node);
		void notifyConnectPoint(
			wraps::BaseGraphView* _sender,
			wraps::BaseGraphConnection* _from,
			wraps::BaseGraphConnection* _to);
		void notifyDisconnectPoint(
			wraps::BaseGraphView* _sender,
			wraps::BaseGraphConnection* _from,
			wraps::BaseGraphConnection* _to);
		void notifyInvalidateNode(BaseAnimationNode* _sender);
		void notifyMouseButtonReleased(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id);
		void notifyMenuCtrlAccept(wraps::ContextMenu* _sender, std::string_view _id);

		void SaveGraph();
		void LoadGraph();
		void ClearGraph();

		void notifyEndDialog(tools::Dialog* _dialog, bool _result);
		void saveToFile(const std::string& _filename);
		void loadFromFile(const std::string& _filename);

		BaseAnimationNode* createNode(std::string_view _type, std::string_view _name);
		BaseAnimationNode* getNodeByName(std::string_view _name);

		void connectPoints(
			BaseAnimationNode* _node_from,
			BaseAnimationNode* _node_to,
			std::string_view _name_from,
			std::string_view _name_to);
		void disconnectPoints(
			BaseAnimationNode* _node_from,
			BaseAnimationNode* _node_to,
			std::string_view _name_from,
			std::string_view _name_to);

	private:
		GraphView* mGraphView{nullptr};

		animation::AnimationNodeFactory mNodeFactory;
		animation::AnimationGraph* mGraph{nullptr};

		GraphNodeFactory mGraphNodeFactory;

		tools::OpenSaveFileDialog* mFileDialog{nullptr};
		bool mFileDialogSave{false};
		wraps::ContextMenu* mContextMenu{nullptr};

		using VectorBaseAnimationNode = std::vector<BaseAnimationNode*>;
		VectorBaseAnimationNode mNodes;

		MyGUI::IntPoint mClickPosition;
	};

} // namespace demo

#endif // DEMO_KEEPER_H_