ScummVM API documentation
android-graphics.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 BACKENDS_GRAPHICS_ANDROID_ANDROID_GRAPHICS_H
23 #define BACKENDS_GRAPHICS_ANDROID_ANDROID_GRAPHICS_H
24 
25 #include "common/scummsys.h"
26 #include "backends/graphics/opengl/opengl-graphics.h"
27 
28 #include "backends/platform/android/touchcontrols.h"
29 
31 public:
32  virtual ~AndroidCommonGraphics() {}
33 
34  virtual void initSurface() = 0;
35  virtual void deinitSurface() = 0;
36  virtual void resizeSurface() = 0;
37 
38  virtual Common::Point getMousePosition() = 0;
39  virtual bool notifyMousePosition(Common::Point &mouse) = 0;
40 
41  virtual void syncVirtkeyboardState(bool virtkeybd_on) = 0;
42  virtual void applyTouchSettings() const = 0;
43 
48  struct State {
49  int screenWidth, screenHeight;
50  bool aspectRatio;
51  bool fullscreen;
52  bool cursorPalette;
53 
54 #ifdef USE_RGB_COLOR
55  Graphics::PixelFormat pixelFormat;
56 #endif
57  };
58 
62  virtual State getState() const = 0;
63 
67  virtual bool setState(const State &state) = 0;
68 };
69 
72 public:
74  virtual ~AndroidGraphicsManager();
75 
76  virtual void initSurface() override;
77  virtual void deinitSurface() override;
78  virtual void resizeSurface() override;
79 
80  virtual AndroidCommonGraphics::State getState() const override;
81  virtual bool setState(const AndroidCommonGraphics::State &state) override;
82 
83  void updateScreen() override;
84 
85  void displayMessageOnOSD(const Common::U32String &msg) override;
86 
87  virtual bool notifyMousePosition(Common::Point &mouse) override;
88  virtual Common::Point getMousePosition() override { return Common::Point(_cursorX, _cursorY); }
89 
90  float getHiDPIScreenFactor() const override;
91 
92  void touchControlInitSurface(const Graphics::ManagedSurface &surf) override;
93  void touchControlNotifyChanged() override;
94  void touchControlDraw(uint8 alpha, int16 x, int16 y, int16 w, int16 h, const Common::Rect &clip) override;
95 
96 protected:
97  void recalculateDisplayAreas() override;
98  void setSystemMousePosition(const int x, const int y) override {}
99 
100  void showOverlay(bool inGUI) override;
101  void hideOverlay() override;
102 
103 
104  bool loadVideoMode(uint requestedWidth, uint requestedHeight, const Graphics::PixelFormat &format) override;
105 
106  void refreshScreen() override;
107 
108  void syncVirtkeyboardState(bool virtkeybd_on) override;
109  void applyTouchSettings() const override;
110 
111 private:
112  OpenGL::Surface *_touchcontrols;
113  int _old_touch_mode;
114 };
115 
116 #endif
Definition: managed_surface.h:51
virtual bool setState(const State &state)=0
void setSystemMousePosition(const int x, const int y) override
Definition: android-graphics.h:98
Definition: pixelformat.h:138
Definition: rect.h:144
Definition: android-graphics.h:30
Definition: android-graphics.h:70
Definition: ustr.h:57
Definition: opengl-graphics.h:57
Definition: android-graphics.h:48
Definition: rect.h:45
virtual State getState() const =0
Definition: texture.h:166
Definition: touchcontrols.h:31