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 
00679     virtual Common::Array<uint> getSupportedAntiAliasingLevels() const {
00680         return Common::Array<uint>();
00681     }
00682 
00693     virtual const GraphicsMode *getSupportedShaders() const {
00694         static const OSystem::GraphicsMode no_shader[2] = {{"NONE", "Normal (no shader)", 0}, {nullptr, nullptr, 0}};
00695         return no_shader;
00696     }
00697 
00707     virtual bool setShader(int id) { return false; }
00708 
00713     virtual int getShader() const { return 0; }
00714 
00722     virtual const GraphicsMode *getSupportedStretchModes() const {
00723         static const GraphicsMode noStretchModes[] = {{"NONE", "Normal", 0}, {nullptr, nullptr, 0 }};
00724         return noStretchModes;
00725     }
00726 
00735     virtual int getDefaultStretchMode() const { return 0; }
00736 
00744     virtual bool setStretchMode(int mode) { return false; }
00745 
00756     bool setStretchMode(const char *name);
00757 
00762     virtual int getStretchMode() const { return 0; }
00763 
00764 
00791     virtual void initSize(uint width, uint height, const Graphics::PixelFormat *format = nullptr) = 0;
00792 
00803     virtual void initSizeHint(const Graphics::ModeList &modes) {}
00804  
00812     virtual void launcherInitSize(uint width, uint height) = 0;
00813 
00829     virtual int getScreenChangeID() const { return 0; }
00830 
00849     virtual void beginGFXTransaction() {}
00850 
00862     enum TransactionError {
00863         kTransactionSuccess = 0,                    
00864         kTransactionAspectRatioFailed = (1 << 0),   
00865         kTransactionFullscreenFailed = (1 << 1),    
00866         kTransactionModeSwitchFailed = (1 << 2),    
00867         kTransactionSizeChangeFailed = (1 << 3),    
00868         kTransactionFormatNotSupported = (1 << 4),  
00869         kTransactionFilteringFailed = (1 << 5),     
00870         kTransactionStretchModeSwitchFailed = (1 << 6)  
00871     };
00872 
00881     virtual TransactionError endGFXTransaction() { return kTransactionSuccess; }
00882 
00892     virtual void setupScreen(uint screenW, uint screenH, bool fullscreen, bool accel3d) = 0;
00893 
00900     virtual Graphics::PixelBuffer getScreenPixelBuffer() = 0;
00901 
00914     virtual void suggestSideTextures(Graphics::Surface *left,
00915                                      Graphics::Surface *right) {};
00916 
00922     virtual int16 getHeight() = 0;
00923 
00929     virtual int16 getWidth() = 0;
00930 
00937     virtual PaletteManager *getPaletteManager() = 0;
00938 
00967     virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) = 0;
00968 
00986     virtual Graphics::Surface *lockScreen() = 0;
00987 
00992     virtual void unlockScreen() = 0;
00993 
01002     virtual void fillScreen(uint32 col) = 0;
01003 
01013     virtual void updateScreen() = 0;
01014 
01029     virtual void setShakePos(int shakeOffset) = 0;
01030 
01045     virtual void setFocusRectangle(const Common::Rect& rect) {}
01046 
01053     virtual void clearFocusRectangle() {}
01054 
01061     virtual void saveScreenshot() {}
01063 
01064 
01065 
01084 
01086     virtual void showOverlay() = 0;
01087 
01089     virtual void hideOverlay() = 0;
01090 
01095     virtual Graphics::PixelFormat getOverlayFormat() const = 0;
01096 
01108     virtual void clearOverlay() = 0;
01109 
01114     virtual void grabOverlay(void *buf, int pitch) = 0;
01115 
01130     virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) = 0;
01131 
01136     virtual int16 getOverlayHeight() = 0;
01137 
01142     virtual int16 getOverlayWidth() = 0;
01143 
01145 
01146 
01147 
01154 
01167     virtual bool showMouse(bool visible) = 0;
01168 
01174     virtual bool lockMouse(bool lock) = 0;
01175 
01182     virtual void warpMouse(int x, int y) = 0;
01183 
01201     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;
01202 
01215     virtual void setCursorPalette(const byte *colors, uint start, uint num) {}
01216 
01218 
01219 
01220 
01223 
01231     virtual uint32 getMillis(bool skipRecord = false) = 0;
01232 
01234     virtual void delayMillis(uint msecs) = 0;
01235 
01241     virtual void getTimeAndDate(TimeDate &t) const = 0;
01242 
01247     virtual Common::TimerManager *getTimerManager();
01248 
01253     inline Common::EventManager *getEventManager() {
01254         return _eventManager;
01255     }
01256 
01257 #ifdef ENABLE_KEYMAPPER
01258 
01267     virtual Common::HardwareInputSet *getHardwareInputSet() { return nullptr; }
01268 
01280     virtual Common::Keymap *getGlobalKeymap() { return nullptr; }
01281 
01291     virtual Common::KeymapperDefaultBindings *getKeymapperDefaultBindings() { return nullptr; }
01292 #endif
01293 
01294 
01295 
01296 
01313 
01314     typedef struct OpaqueMutex *MutexRef;
01315 
01320     virtual MutexRef createMutex() = 0;
01321 
01332     virtual void lockMutex(MutexRef mutex) = 0;
01333 
01338     virtual void unlockMutex(MutexRef mutex) = 0;
01339 
01346     virtual void deleteMutex(MutexRef mutex) = 0;
01347 
01349 
01350 
01351 
01354 
01359     virtual Audio::Mixer *getMixer() = 0;
01360 
01362 
01363 
01364 
01367 
01372     inline AudioCDManager *getAudioCDManager() {
01373         return _audiocdManager;
01374     }
01375 
01377 
01378 
01379 
01383     virtual void quit() = 0;
01384 
01390     virtual void fatalError();
01391 
01400     virtual void setWindowCaption(const char *caption) {}
01401 
01419     virtual void displayMessageOnOSD(const char *msg) = 0;
01420 
01438     virtual void displayActivityIconOnOSD(const Graphics::Surface *icon) = 0;
01439 
01445     virtual Common::SaveFileManager *getSavefileManager();
01446 
01447 #if defined(USE_TASKBAR)
01448 
01454     virtual Common::TaskbarManager *getTaskbarManager() {
01455         return _taskbarManager;
01456     }
01457 #endif
01458 
01459 #if defined(USE_UPDATES)
01460 
01466     virtual Common::UpdateManager *getUpdateManager() {
01467         return _updateManager;
01468     }
01469 #endif
01470 
01471 #if defined(USE_SYSDIALOGS)
01472 
01477     virtual Common::DialogManager *getDialogManager() {
01478         return _dialogManager;
01479     }
01480 #endif
01481 
01487     virtual FilesystemFactory *getFilesystemFactory();
01488 
01499     virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0) {}
01500 
01506     virtual Common::SeekableReadStream *createConfigReadStream();
01507 
01515     virtual Common::WriteStream *createConfigWriteStream();
01516 
01522     virtual Common::String getDefaultConfigFileName();
01523 
01536     virtual void logMessage(LogMessageType::Type type, const char *message) = 0;
01537 
01563     virtual bool displayLogFile() { return false; }
01564 
01574     virtual bool hasTextInClipboard() { return false; }
01575 
01585     virtual Common::String getTextFromClipboard() { return ""; }
01586 
01596     virtual bool setTextInClipboard(const Common::String &text) { return false; }
01597 
01610     virtual bool openUrl(const Common::String &url) {return false; }
01611 
01628     virtual Common::String getSystemLanguage() const;
01629 
01635     virtual bool isConnectionLimited();
01636 
01638 };
01639 
01640 
01642 extern OSystem *g_system;
01643 
01644 #endif


Generated on Sat Nov 9 2019 05:00:26 for ResidualVM by doxygen 1.7.1
curved edge   curved edge