ScummVM API documentation
system_stub.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef AWE_SYSTEM_STUB_H
23 #define AWE_SYSTEM_STUB_H
24 
25 #include "awe/intern.h"
26 
27 namespace Awe {
28 
29 struct PlayerInput {
30  enum {
31  DIR_LEFT = 1 << 0,
32  DIR_RIGHT = 1 << 1,
33  DIR_UP = 1 << 2,
34  DIR_DOWN = 1 << 3
35  };
36 
37  uint8 dirMask = 0;
38  bool action = false; // run,shoot
39  bool jump = false;
40  bool code = false;
41  bool pause = false;
42  bool quit = false;
43  bool back = false;
44  char lastChar = '\0';
45  bool fastMode = false;
46 };
47 
48 struct DisplayMode {
49  enum {
50  WINDOWED,
51  FULLSCREEN, // stretch
52  FULLSCREEN_AR, // 16:10 aspect ratio
53  } mode;
54  int width = 0, height = 0; // window dimensions
55  bool opengl = false; // GL renderer
56 };
57 
58 struct SystemStub {
59  typedef void (*AudioCallback)(void *param, uint8 *stream, int len);
60 
61  PlayerInput _pi;
62  DisplayMode _dm;
63 
64  SystemStub() {}
65  virtual ~SystemStub() {}
66 
67  virtual void init(const DisplayMode &dm) = 0;
68  virtual void fini() = 0;
69 
70  // GL rendering
71  virtual void prepareScreen(int &w, int &h, float ar[4]) = 0;
72  virtual void updateScreen() = 0;
73  // framebuffer rendering
74  virtual void setPalette(const Color pal[16]) = 0;
75  virtual void setScreenPixels(const Graphics::Surface &src) = 0;
76 
77  virtual void processEvents() = 0;
78  virtual void sleep(uint32 duration) = 0;
79  virtual uint32 getTimeStamp() = 0;
80 };
81 
82 extern SystemStub *SystemStub_create(bool isAnniversaryEdition);
83 
84 } // namespace Awe
85 
86 #endif
Definition: surface.h:67
Definition: intern.h:85
Definition: system_stub.h:29
Definition: system_stub.h:48
Definition: aifc_player.h:29
Definition: system_stub.h:58