ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

system.h

Go to the documentation of this file.
00001 /* ScummVM - Graphic Adventure Engine
00002  *
00003  * ScummVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the COPYRIGHT
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #ifndef COMMON_SYSTEM_H
00024 #define COMMON_SYSTEM_H
00025 
00026 #include "common/scummsys.h"
00027 #include "common/noncopyable.h"
00028 #include "common/list.h" // For OSystem::getSupportedFormats()
00029 #include "graphics/pixelformat.h"
00030 #include "graphics/mode.h"
00031 
00032 namespace Audio {
00033 class Mixer;
00034 }
00035 
00036 namespace Graphics {
00037 struct Surface;
00038 //ResidualVM specific:
00039 class PixelBuffer;
00040 }
00041 
00042 namespace Common {
00043 class EventManager;
00044 struct Rect;
00045 class SaveFileManager;
00046 class SearchSet;
00047 class String;
00048 #if defined(USE_TASKBAR)
00049 class TaskbarManager;
00050 #endif
00051 #if defined(USE_UPDATES)
00052 class UpdateManager;
00053 #endif
00054 #if defined(USE_SYSDIALOGS)
00055 class DialogManager;
00056 #endif
00057 class TimerManager;
00058 class SeekableReadStream;
00059 class WriteStream;
00060 #ifdef ENABLE_KEYMAPPER
00061 class HardwareInputSet;
00062 class Keymap;
00063 class KeymapperDefaultBindings;
00064 #endif
00065 }
00066 
00067 class AudioCDManager;
00068 class FilesystemFactory;
00069 class PaletteManager;
00070 
00080 struct TimeDate {
00081     int tm_sec;     
00082     int tm_min;     
00083     int tm_hour;    
00084     int tm_mday;    
00085     int tm_mon;     
00086     int tm_year;    
00087     int tm_wday;    
00088 };
00089 
00090 namespace LogMessageType {
00091 
00092 enum Type {
00093     kInfo,
00094     kError,
00095     kWarning,
00096     kDebug
00097 };
00098 
00099 } // End of namespace LogMessageType
00100 
00111 class OSystem : Common::NonCopyable {
00112 protected:
00113     OSystem();
00114     virtual ~OSystem();
00115 
00116 protected:
00136 
00144     AudioCDManager *_audiocdManager;
00145 
00153     Common::EventManager *_eventManager;
00154 
00160     Common::TimerManager *_timerManager;
00161 
00167     Common::SaveFileManager *_savefileManager;
00168 
00169 #if defined(USE_TASKBAR)
00170 
00175     Common::TaskbarManager *_taskbarManager;
00176 #endif
00177 
00178 #if defined(USE_UPDATES)
00179 
00184     Common::UpdateManager *_updateManager;
00185 #endif
00186 
00187 #if defined(USE_SYSDIALOGS)
00188 
00193     Common::DialogManager *_dialogManager;
00194 #endif
00195 
00205     FilesystemFactory *_fsFactory;
00206 
00207 private:
00211     bool _backendInitialized;
00212 
00214 
00215 public:
00216 
00221     void destroy();
00222 
00231     virtual void initBackend();
00232 
00238     bool backendInitialized() const { return _backendInitialized; }
00239 
00244     virtual void engineInit() { }
00245 
00250     virtual void engineDone() { }
00251 
00254 
00270     enum Feature {
00275         kFeatureFullscreenMode,
00276 
00290         kFeatureAspectRatioCorrection,
00291 
00296         kFeatureFilteringMode,
00297 
00301         kFeatureStretchMode,
00302 
00308         kFeatureVirtualKeyboard,
00309 
00320         kFeatureCursorPalette,
00321 
00329         kFeatureOverlaySupportsAlpha,
00330 
00335         kFeatureIconifyWindow,
00336 
00354         kFeatureDisableKeyFiltering,
00355 
00356         //ResidualVM specific
00357         kFeatureOpenGL,
00358         // Can side textures be rendered on the side for widescreen support?
00359         kFeatureSideTextures,
00360 
00368         kFeatureVSync,
00369 
00381         kFeatureFullscreenToggleKeepsContext,
00382 
00389         kFeatureDisplayLogFile,
00390 
00397         kFeatureClipboardSupport,
00398 
00405         kFeatureOpenUrl,
00406 
00410         kFeatureOnScreenControl,
00411 
00415         kFeatureTouchpadMode,
00416 
00420         kFeatureSwapMenuAndBackButtons,
00421 
00425         kFeatureKbdMouseSpeed,
00426 
00430         kFeatureJoystickDeadzone,
00431 
00435         kFeatureShader,
00436 
00441         kFeatureSystemBrowserDialog
00442 
00443     };
00444 
00448     virtual bool hasFeature(Feature f) { return false; }
00449 
00454     virtual void setFeatureState(Feature f, bool enable) {}
00455 
00460     virtual bool getFeatureState(Feature f) { return false; }
00461 
00463 
00464 
00465 
00533 
00539     struct GraphicsMode {
00545         const char *name;
00550         const char *description;
00556         int id;
00557     };
00558 
00569     virtual const GraphicsMode *getSupportedGraphicsModes() const = 0;
00570 
00581     virtual int getDefaultGraphicsMode() const = 0;
00582 
00592     virtual bool setGraphicsMode(int mode) = 0;
00593 
00606     bool setGraphicsMode(const char *name);
00607 
00614     virtual int getGraphicsMode() const = 0;
00615 
00623     virtual void resetGraphicsScale() {}
00624 
00625 #ifdef USE_RGB_COLOR
00626 
00633     virtual Graphics::PixelFormat getScreenFormat() const = 0;
00634 
00658     virtual Common::List<Graphics::PixelFormat> getSupportedFormats() const = 0;
00659 #else
00660     inline Graphics::PixelFormat getScreenFormat() const {
00661         return Graphics::PixelFormat::createFormatCLUT8();
00662     };
00663 
00664     inline Common::List<Graphics::PixelFormat> getSupportedFormats() const {
00665         Common::List<Graphics::PixelFormat> list;
00666         list.push_back(Graphics::PixelFormat::createFormatCLUT8());
00667         return list;
00668     };
00669 #endif
00670 
00681     virtual const GraphicsMode *getSupportedShaders() const {
00682         static const OSystem::GraphicsMode no_shader[2] = {{"NONE", "Normal (no shader)", 0}, {nullptr, nullptr, 0}};
00683         return no_shader;
00684     }
00685 
00695     virtual bool setShader(int id) { return false; }
00696 
00701     virtual int getShader() const { return 0; }
00702 
00710     virtual const GraphicsMode *getSupportedStretchModes() const {
00711         static const GraphicsMode noStretchModes[] = {{"NONE", "Normal", 0}, {nullptr, nullptr, 0 }};
00712         return noStretchModes;
00713     }
00714 
00723     virtual int getDefaultStretchMode() const { return 0; }
00724 
00732     virtual bool setStretchMode(int mode) { return false; }
00733 
00744     bool setStretchMode(const char *name);
00745 
00750     virtual int getStretchMode() const { return 0; }
00751 
00752 
00779     virtual void initSize(uint width, uint height, const Graphics::PixelFormat *format = nullptr) = 0;
00780 
00791     virtual void initSizeHint(const Graphics::ModeList &modes) {}
00792  
00800     virtual void launcherInitSize(uint width, uint height) = 0;
00801 
00817     virtual int getScreenChangeID() const { return 0; }
00818 
00837     virtual void beginGFXTransaction() {}
00838 
00850     enum TransactionError {
00851         kTransactionSuccess = 0,                    
00852         kTransactionAspectRatioFailed = (1 << 0),   
00853         kTransactionFullscreenFailed = (1 << 1),    
00854         kTransactionModeSwitchFailed = (1 << 2),    
00855         kTransactionSizeChangeFailed = (1 << 3),    
00856         kTransactionFormatNotSupported = (1 << 4),  
00857         kTransactionFilteringFailed = (1 << 5),     
00858         kTransactionStretchModeSwitchFailed = (1 << 6)  
00859     };
00860 
00869     virtual TransactionError endGFXTransaction() { return kTransactionSuccess; }
00870 
00880     virtual void setupScreen(uint screenW, uint screenH, bool fullscreen, bool accel3d) = 0;
00881 
00888     virtual Graphics::PixelBuffer getScreenPixelBuffer() = 0;
00889 
00902     virtual void suggestSideTextures(Graphics::Surface *left,
00903                                      Graphics::Surface *right) {};
00904 
00910     virtual int16 getHeight() = 0;
00911 
00917     virtual int16 getWidth() = 0;
00918 
00925     virtual PaletteManager *getPaletteManager() = 0;
00926 
00955     virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) = 0;
00956 
00974     virtual Graphics::Surface *lockScreen() = 0;
00975 
00980     virtual void unlockScreen() = 0;
00981 
00990     virtual void fillScreen(uint32 col) = 0;
00991 
01001     virtual void updateScreen() = 0;
01002 
01017     virtual void setShakePos(int shakeOffset) = 0;
01018 
01033     virtual void setFocusRectangle(const Common::Rect& rect) {}
01034 
01041     virtual void clearFocusRectangle() {}
01042 
01049     virtual void saveScreenshot() {}
01051 
01052 
01053 
01072 
01074     virtual void showOverlay() = 0;
01075 
01077     virtual void hideOverlay() = 0;
01078 
01083     virtual Graphics::PixelFormat getOverlayFormat() const = 0;
01084 
01096     virtual void clearOverlay() = 0;
01097 
01102     virtual void grabOverlay(void *buf, int pitch) = 0;
01103 
01118     virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) = 0;
01119 
01124     virtual int16 getOverlayHeight() = 0;
01125 
01130     virtual int16 getOverlayWidth() = 0;
01131 
01133 
01134 
01135 
01142 
01155     virtual bool showMouse(bool visible) = 0;
01156 
01162     virtual bool lockMouse(bool lock) = 0;
01163 
01170     virtual void warpMouse(int x, int y) = 0;
01171 
01189     virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = nullptr) = 0;
01190 
01203     virtual void setCursorPalette(const byte *colors, uint start, uint num) {}
01204 
01206 
01207 
01208 
01211 
01219     virtual uint32 getMillis(bool skipRecord = false) = 0;
01220 
01222     virtual void delayMillis(uint msecs) = 0;
01223 
01229     virtual void getTimeAndDate(TimeDate &t) const = 0;
01230 
01235     virtual Common::TimerManager *getTimerManager();
01236 
01241     inline Common::EventManager *getEventManager() {
01242         return _eventManager;
01243     }
01244 
01245 #ifdef ENABLE_KEYMAPPER
01246 
01255     virtual Common::HardwareInputSet *getHardwareInputSet() { return nullptr; }
01256 
01268     virtual Common::Keymap *getGlobalKeymap() { return nullptr; }
01269 
01279     virtual Common::KeymapperDefaultBindings *getKeymapperDefaultBindings() { return nullptr; }
01280 #endif
01281 
01282 
01283 
01284 
01301 
01302     typedef struct OpaqueMutex *MutexRef;
01303 
01308     virtual MutexRef createMutex() = 0;
01309 
01320     virtual void lockMutex(MutexRef mutex) = 0;
01321 
01326     virtual void unlockMutex(MutexRef mutex) = 0;
01327 
01334     virtual void deleteMutex(MutexRef mutex) = 0;
01335 
01337 
01338 
01339 
01342 
01347     virtual Audio::Mixer *getMixer() = 0;
01348 
01350 
01351 
01352 
01355 
01360     inline AudioCDManager *getAudioCDManager() {
01361         return _audiocdManager;
01362     }
01363 
01365 
01366 
01367 
01371     virtual void quit() = 0;
01372 
01378     virtual void fatalError();
01379 
01388     virtual void setWindowCaption(const char *caption) {}
01389 
01407     virtual void displayMessageOnOSD(const char *msg) = 0;
01408 
01426     virtual void displayActivityIconOnOSD(const Graphics::Surface *icon) = 0;
01427 
01433     virtual Common::SaveFileManager *getSavefileManager();
01434 
01435 #if defined(USE_TASKBAR)
01436 
01442     virtual Common::TaskbarManager *getTaskbarManager() {
01443         return _taskbarManager;
01444     }
01445 #endif
01446 
01447 #if defined(USE_UPDATES)
01448 
01454     virtual Common::UpdateManager *getUpdateManager() {
01455         return _updateManager;
01456     }
01457 #endif
01458 
01459 #if defined(USE_SYSDIALOGS)
01460 
01465     virtual Common::DialogManager *getDialogManager() {
01466         return _dialogManager;
01467     }
01468 #endif
01469 
01475     virtual FilesystemFactory *getFilesystemFactory();
01476 
01487     virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0) {}
01488 
01494     virtual Common::SeekableReadStream *createConfigReadStream();
01495 
01503     virtual Common::WriteStream *createConfigWriteStream();
01504 
01510     virtual Common::String getDefaultConfigFileName();
01511 
01524     virtual void logMessage(LogMessageType::Type type, const char *message) = 0;
01525 
01551     virtual bool displayLogFile() { return false; }
01552 
01562     virtual bool hasTextInClipboard() { return false; }
01563 
01573     virtual Common::String getTextFromClipboard() { return ""; }
01574 
01584     virtual bool setTextInClipboard(const Common::String &text) { return false; }
01585 
01598     virtual bool openUrl(const Common::String &url) {return false; }
01599 
01616     virtual Common::String getSystemLanguage() const;
01617 
01619 };
01620 
01621 
01623 extern OSystem *g_system;
01624 
01625 #endif


Generated on Sat May 18 2019 05:01:22 for ResidualVM by doxygen 1.7.1
curved edge   curved edge