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         kFeatureVirtControls,
00359         // Can side textures be rendered on the side for widescreen support?
00360         kFeatureSideTextures,
00361 
00369         kFeatureVSync,
00370 
00382         kFeatureFullscreenToggleKeepsContext,
00383 
00390         kFeatureDisplayLogFile,
00391 
00398         kFeatureClipboardSupport,
00399 
00406         kFeatureOpenUrl,
00407 
00411         kFeatureOnScreenControl,
00412 
00416         kFeatureTouchpadMode,
00417 
00421         kFeatureSwapMenuAndBackButtons,
00422 
00426         kFeatureKbdMouseSpeed,
00427 
00431         kFeatureJoystickDeadzone,
00432 
00436         kFeatureShader,
00437 
00442         kFeatureSystemBrowserDialog
00443 
00444     };
00445 
00449     virtual bool hasFeature(Feature f) { return false; }
00450 
00455     virtual void setFeatureState(Feature f, bool enable) {}
00456 
00461     virtual bool getFeatureState(Feature f) { return false; }
00462 
00464 
00465 
00466 
00534 
00540     struct GraphicsMode {
00546         const char *name;
00551         const char *description;
00557         int id;
00558     };
00559 
00570     virtual const GraphicsMode *getSupportedGraphicsModes() const = 0;
00571 
00582     virtual int getDefaultGraphicsMode() const = 0;
00583 
00593     virtual bool setGraphicsMode(int mode) = 0;
00594 
00607     bool setGraphicsMode(const char *name);
00608 
00615     virtual int getGraphicsMode() const = 0;
00616 
00624     virtual void resetGraphicsScale() {}
00625 
00626 #ifdef USE_RGB_COLOR
00627 
00634     virtual Graphics::PixelFormat getScreenFormat() const = 0;
00635 
00659     virtual Common::List<Graphics::PixelFormat> getSupportedFormats() const = 0;
00660 #else
00661     inline Graphics::PixelFormat getScreenFormat() const {
00662         return Graphics::PixelFormat::createFormatCLUT8();
00663     };
00664 
00665     inline Common::List<Graphics::PixelFormat> getSupportedFormats() const {
00666         Common::List<Graphics::PixelFormat> list;
00667         list.push_back(Graphics::PixelFormat::createFormatCLUT8());
00668         return list;
00669     };
00670 #endif
00671 
00682     virtual const GraphicsMode *getSupportedShaders() const {
00683         static const OSystem::GraphicsMode no_shader[2] = {{"NONE", "Normal (no shader)", 0}, {nullptr, nullptr, 0}};
00684         return no_shader;
00685     }
00686 
00696     virtual bool setShader(int id) { return false; }
00697 
00702     virtual int getShader() const { return 0; }
00703 
00711     virtual const GraphicsMode *getSupportedStretchModes() const {
00712         static const GraphicsMode noStretchModes[] = {{"NONE", "Normal", 0}, {nullptr, nullptr, 0 }};
00713         return noStretchModes;
00714     }
00715 
00724     virtual int getDefaultStretchMode() const { return 0; }
00725 
00733     virtual bool setStretchMode(int mode) { return false; }
00734 
00745     bool setStretchMode(const char *name);
00746 
00751     virtual int getStretchMode() const { return 0; }
00752 
00753 
00780     virtual void initSize(uint width, uint height, const Graphics::PixelFormat *format = nullptr) = 0;
00781 
00792     virtual void initSizeHint(const Graphics::ModeList &modes) {}
00793  
00801     virtual void launcherInitSize(uint width, uint height) = 0;
00802 
00818     virtual int getScreenChangeID() const { return 0; }
00819 
00838     virtual void beginGFXTransaction() {}
00839 
00851     enum TransactionError {
00852         kTransactionSuccess = 0,                    
00853         kTransactionAspectRatioFailed = (1 << 0),   
00854         kTransactionFullscreenFailed = (1 << 1),    
00855         kTransactionModeSwitchFailed = (1 << 2),    
00856         kTransactionSizeChangeFailed = (1 << 3),    
00857         kTransactionFormatNotSupported = (1 << 4),  
00858         kTransactionFilteringFailed = (1 << 5),     
00859         kTransactionStretchModeSwitchFailed = (1 << 6)  
00860     };
00861 
00870     virtual TransactionError endGFXTransaction() { return kTransactionSuccess; }
00871 
00881     virtual void setupScreen(uint screenW, uint screenH, bool fullscreen, bool accel3d) = 0;
00882 
00889     virtual Graphics::PixelBuffer getScreenPixelBuffer() = 0;
00890 
00903     virtual void suggestSideTextures(Graphics::Surface *left,
00904                                      Graphics::Surface *right) {};
00905 
00911     virtual int16 getHeight() = 0;
00912 
00918     virtual int16 getWidth() = 0;
00919 
00926     virtual PaletteManager *getPaletteManager() = 0;
00927 
00956     virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) = 0;
00957 
00975     virtual Graphics::Surface *lockScreen() = 0;
00976 
00981     virtual void unlockScreen() = 0;
00982 
00991     virtual void fillScreen(uint32 col) = 0;
00992 
01002     virtual void updateScreen() = 0;
01003 
01018     virtual void setShakePos(int shakeOffset) = 0;
01019 
01034     virtual void setFocusRectangle(const Common::Rect& rect) {}
01035 
01042     virtual void clearFocusRectangle() {}
01043 
01045 
01046 
01047 
01066 
01068     virtual void showOverlay() = 0;
01069 
01071     virtual void hideOverlay() = 0;
01072 
01077     virtual Graphics::PixelFormat getOverlayFormat() const = 0;
01078 
01090     virtual void clearOverlay() = 0;
01091 
01096     virtual void grabOverlay(void *buf, int pitch) = 0;
01097 
01112     virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) = 0;
01113 
01118     virtual int16 getOverlayHeight() = 0;
01119 
01124     virtual int16 getOverlayWidth() = 0;
01125 
01127 
01128 
01129 
01136 
01149     virtual bool showMouse(bool visible) = 0;
01150 
01156     virtual bool lockMouse(bool lock) = 0;
01157 
01164     virtual void warpMouse(int x, int y) = 0;
01165 
01183     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;
01184 
01197     virtual void setCursorPalette(const byte *colors, uint start, uint num) {}
01198 
01200 
01201 
01202 
01205 
01213     virtual uint32 getMillis(bool skipRecord = false) = 0;
01214 
01216     virtual void delayMillis(uint msecs) = 0;
01217 
01223     virtual void getTimeAndDate(TimeDate &t) const = 0;
01224 
01229     virtual Common::TimerManager *getTimerManager();
01230 
01235     inline Common::EventManager *getEventManager() {
01236         return _eventManager;
01237     }
01238 
01239 #ifdef ENABLE_KEYMAPPER
01240 
01249     virtual Common::HardwareInputSet *getHardwareInputSet() { return nullptr; }
01250 
01262     virtual Common::Keymap *getGlobalKeymap() { return nullptr; }
01263 
01273     virtual Common::KeymapperDefaultBindings *getKeymapperDefaultBindings() { return nullptr; }
01274 #endif
01275 
01276 
01277 
01278 
01295 
01296     typedef struct OpaqueMutex *MutexRef;
01297 
01302     virtual MutexRef createMutex() = 0;
01303 
01314     virtual void lockMutex(MutexRef mutex) = 0;
01315 
01320     virtual void unlockMutex(MutexRef mutex) = 0;
01321 
01328     virtual void deleteMutex(MutexRef mutex) = 0;
01329 
01331 
01332 
01333 
01336 
01341     virtual Audio::Mixer *getMixer() = 0;
01342 
01344 
01345 
01346 
01349 
01354     inline AudioCDManager *getAudioCDManager() {
01355         return _audiocdManager;
01356     }
01357 
01359 
01360 
01361 
01365     virtual void quit() = 0;
01366 
01372     virtual void fatalError();
01373 
01382     virtual void setWindowCaption(const char *caption) {}
01383 
01401     virtual void displayMessageOnOSD(const char *msg) = 0;
01402 
01420     virtual void displayActivityIconOnOSD(const Graphics::Surface *icon) = 0;
01421 
01427     virtual Common::SaveFileManager *getSavefileManager();
01428 
01429 #if defined(USE_TASKBAR)
01430 
01436     virtual Common::TaskbarManager *getTaskbarManager() {
01437         return _taskbarManager;
01438     }
01439 #endif
01440 
01441 #if defined(USE_UPDATES)
01442 
01448     virtual Common::UpdateManager *getUpdateManager() {
01449         return _updateManager;
01450     }
01451 #endif
01452 
01453 #if defined(USE_SYSDIALOGS)
01454 
01459     virtual Common::DialogManager *getDialogManager() {
01460         return _dialogManager;
01461     }
01462 #endif
01463 
01469     virtual FilesystemFactory *getFilesystemFactory();
01470 
01481     virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0) {}
01482 
01488     virtual Common::SeekableReadStream *createConfigReadStream();
01489 
01497     virtual Common::WriteStream *createConfigWriteStream();
01498 
01504     virtual Common::String getDefaultConfigFileName();
01505 
01518     virtual void logMessage(LogMessageType::Type type, const char *message) = 0;
01519 
01545     virtual bool displayLogFile() { return false; }
01546 
01556     virtual bool hasTextInClipboard() { return false; }
01557 
01567     virtual Common::String getTextFromClipboard() { return ""; }
01568 
01578     virtual bool setTextInClipboard(const Common::String &text) { return false; }
01579 
01592     virtual bool openUrl(const Common::String &url) {return false; }
01593 
01610     virtual Common::String getSystemLanguage() const;
01611 
01613 };
01614 
01615 
01617 extern OSystem *g_system;
01618 
01619 #endif


Generated on Sat Feb 16 2019 05:01:08 for ResidualVM by doxygen 1.7.1
curved edge   curved edge