ScummVM API documentation
osystem_ds.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 
23 #ifndef _OSYSTEM_DS_H_
24 #define _OSYSTEM_DS_H_
25 
26 #include "backends/modular-backend.h"
27 #include "backends/events/ds/ds-events.h"
28 #include "backends/mixer/mixer.h"
29 #include "backends/platform/ds/background.h"
30 #include "backends/platform/ds/keyboard.h"
31 #include "graphics/surface.h"
32 #include "graphics/paletteman.h"
33 
34 enum {
35  GFX_NOSCALE = 0,
36  GFX_HWSCALE = 1,
37  GFX_SWSCALE = 2
38 };
39 
41 protected:
42  Graphics::Surface _framebuffer, _overlay;
43  DS::Background *_screen, *_overlayScreen;
44 #ifdef DISABLE_TEXT_CONSOLE
45  DS::Background *_subScreen;
46  DS::TiledBackground *_banner;
47 #endif
48  bool _subScreenActive;
49  Graphics::Surface _cursor;
50  int _graphicsMode, _stretchMode;
51  bool _paletteDirty, _cursorDirty;
52 
53  static OSystem_DS *_instance;
54 
55  u16 _palette[256];
56  u16 _cursorPalette[256];
57 
58  u16 *_cursorSprite;
59  Common::Point _cursorPos;
60  int _cursorHotX;
61  int _cursorHotY;
62  uint32 _cursorKey;
63  bool _cursorVisible;
64  bool _overlayInGUI;
65 
66  DSEventSource *_eventSource;
67  DS::Keyboard *_keyboard;
68 
69  void initGraphics();
70 
71  bool _disableCursorPalette;
72 
73  const Graphics::PixelFormat _pfCLUT8, _pfABGR1555;
74 
75  bool _engineRunning;
76 
77 public:
78  OSystem_DS();
79  virtual ~OSystem_DS();
80 
81  static OSystem_DS *instance() { return _instance; }
82 
83  virtual bool hasFeature(Feature f);
84  virtual void setFeatureState(Feature f, bool enable);
85  virtual bool getFeatureState(Feature f);
86 
87  virtual const OSystem::GraphicsMode *getSupportedGraphicsModes() const;
88  virtual int getDefaultGraphicsMode() const;
89  virtual bool setGraphicsMode(int mode, uint flags);
90  virtual int getGraphicsMode() const;
91 
92  virtual const GraphicsMode *getSupportedStretchModes() const;
93  virtual int getDefaultStretchMode() const;
94  virtual bool setStretchMode(int mode);
95  virtual int getStretchMode() const;
96 
97  virtual Graphics::PixelFormat getScreenFormat() const;
98  virtual Common::List<Graphics::PixelFormat> getSupportedFormats() const;
99 
100  virtual void initSize(uint width, uint height, const Graphics::PixelFormat *format);
101  virtual int16 getHeight();
102  virtual int16 getWidth();
103 
104  virtual PaletteManager *getPaletteManager() { return this; }
105 protected:
106  // PaletteManager API
107  virtual void setPalette(const byte *colors, uint start, uint num);
108  virtual void grabPalette(byte *colors, uint start, uint num) const;
109 
110 public:
111  virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h);
112  virtual void updateScreen();
113  virtual void setShakePos(int shakeXOffset, int shakeYOffset);
114 
115  virtual void showOverlay(bool inGUI);
116  virtual void hideOverlay();
117  virtual bool isOverlayVisible() const;
118  virtual void clearOverlay();
119  virtual void grabOverlay(Graphics::Surface &surface);
120  virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h);
121  virtual int16 getOverlayHeight();
122  virtual int16 getOverlayWidth();
123  virtual Graphics::PixelFormat getOverlayFormat() const;
124 
125  Common::Point transformPoint(int16 x, int16 y);
126  virtual bool showMouse(bool visible);
127 
128  virtual void warpMouse(int x, int y);
129  virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, u32 keycolor, bool dontScale, const Graphics::PixelFormat *format, const byte *mask);
130 
131  virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority);
132 
133  virtual uint32 getMillis(bool skipRecord = false);
134  virtual void delayMillis(uint msecs);
135  virtual void getTimeAndDate(TimeDate &td, bool skipRecord = false) const;
136  void doTimerCallback(int interval = 10);
138 
139  virtual Common::EventSource *getDefaultEventSource() { return _eventSource; }
141 
142  virtual Common::String getSystemLanguage() const;
143 
144  virtual void engineInit();
145  virtual void engineDone();
146  virtual void quit();
147 
148  virtual void setFocusRectangle(const Common::Rect& rect);
149  virtual void clearFocusRectangle();
150 
151  virtual void initBackend();
152 
153  virtual Graphics::Surface *lockScreen();
154  virtual void unlockScreen();
155 
156  virtual void setCursorPalette(const byte *colors, uint start, uint num);
157 
158  void setSwapLCDs(bool swap);
159 
160  void refreshCursor(u16 *dst, const Graphics::Surface &src, const uint16 *palette);
161 
162  virtual void logMessage(LogMessageType::Type type, const char *message);
163  virtual void messageBox(LogMessageType::Type type, const char *message);
164 
165  void setMainScreen(int32 x, int32 y, int32 sx, int32 sy);
166  void setSubScreen(int32 x, int32 y, int32 sx, int32 sy);
167 
168  int _currentTimeMillis, _callbackTimer;
169 };
170 
171 #endif
Definition: modular-backend.h:149
virtual void messageBox(LogMessageType::Type type, const char *message)
virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h)
Definition: system.h:106
virtual int getGraphicsMode() const
Definition: str.h:59
virtual int16 getOverlayHeight()
virtual bool hasFeature(Feature f)
Definition: surface.h:67
virtual void getTimeAndDate(TimeDate &td, bool skipRecord=false) const
Definition: background.h:33
virtual int getDefaultGraphicsMode() const
virtual void updateScreen()
virtual void showOverlay(bool inGUI)
virtual int16 getHeight()
Definition: pixelformat.h:138
virtual void setFeatureState(Feature f, bool enable)
Definition: system.h:730
Feature
Definition: system.h:403
virtual int16 getWidth()
Definition: list.h:44
virtual void grabOverlay(Graphics::Surface &surface)
virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority)
virtual void engineInit()
Definition: rect.h:144
virtual PaletteManager * getPaletteManager()
Definition: osystem_ds.h:104
virtual Graphics::PixelFormat getOverlayFormat() const
virtual void clearOverlay()
virtual void delayMillis(uint msecs)
Type
Definition: log.h:33
Definition: ds-events.h:30
virtual Common::String getSystemLanguage() const
virtual void initBackend()
virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, u32 keycolor, bool dontScale, const Graphics::PixelFormat *format, const byte *mask)
Definition: keyboard.h:29
virtual void unlockScreen()
virtual void quit()
virtual bool setStretchMode(int mode)
virtual const GraphicsMode * getSupportedStretchModes() const
virtual void warpMouse(int x, int y)
virtual void engineDone()
Definition: archive.h:312
virtual void setShakePos(int shakeXOffset, int shakeYOffset)
virtual uint32 getMillis(bool skipRecord=false)
virtual const OSystem::GraphicsMode * getSupportedGraphicsModes() const
Definition: hardware-input.h:199
virtual int getStretchMode() const
virtual void clearFocusRectangle()
Definition: rect.h:45
virtual bool isOverlayVisible() const
virtual void initSize(uint width, uint height, const Graphics::PixelFormat *format)
virtual void logMessage(LogMessageType::Type type, const char *message)
Definition: osystem_ds.h:40
virtual void grabPalette(byte *colors, uint start, uint num) const
virtual bool setGraphicsMode(int mode, uint flags)
virtual void hideOverlay()
virtual Graphics::Surface * lockScreen()
virtual void setFocusRectangle(const Common::Rect &rect)
virtual int16 getOverlayWidth()
virtual void setCursorPalette(const byte *colors, uint start, uint num)
virtual bool showMouse(bool visible)
Definition: events.h:259
Definition: mutex.h:40
virtual bool getFeatureState(Feature f)
virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h)
virtual Common::HardwareInputSet * getHardwareInputSet()
virtual void setPalette(const byte *colors, uint start, uint num)
Definition: paletteman.h:47
virtual int getDefaultStretchMode() const
virtual Common::MutexInternal * createMutex()
Definition: background.h:62