Initial support for scripting actions.
[ipdf/code.git] / src / debugscript.h
1 #ifndef _DEBUGSCRIPT_H
2 #define _DEBUGSCRIPT_H
3
4 #include "real.h"
5 #include "view.h"
6 #include "screen.h"
7 #include <iostream>
8 #include <fstream>
9
10 namespace IPDF
11 {
12
13 class DebugScript
14 {
15 public:
16         void Load(const char *filename)
17         {
18                 inp.open(filename);
19         }
20         bool Execute(View *view, Screen *scr);
21 private:
22         enum ActionType
23         {
24                 AT_WaitFrame,
25                 AT_Translate,
26                 AT_Zoom,
27                 AT_TranslatePx,
28                 AT_ZoomPx,
29                 AT_Quit
30         };
31
32         struct Action
33         {
34                 ActionType type;
35                 Real x, y;
36                 int ix, iy;
37                 Real z;
38                 int iz;
39                 int loops;
40                 Action() : type(AT_WaitFrame), x(0), y(0), ix(0), iy(0), z(0), loops(0) {}
41         };
42
43         std::ifstream inp;
44
45         Action currentAction;
46
47         void ParseAction();
48 };
49
50 }
51
52 #endif

UCC git Repository :: git.ucc.asn.au