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 
01050     virtual void saveScreenshot() {}
01052 
01053 
01054 
01073 
01075     virtual void showOverlay() = 0;
01076 
01078     virtual void hideOverlay() = 0;
01079 
01084     virtual Graphics::PixelFormat getOverlayFormat() const = 0;
01085 
01097     virtual void clearOverlay() = 0;
01098 
01103     virtual void grabOverlay(void *buf, int pitch) = 0;
01104 
01119     virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) = 0;
01120 
01125     virtual int16 getOverlayHeight() = 0;
01126 
01131     virtual int16 getOverlayWidth() = 0;
01132 
01134 
01135 
01136 
01143 
01156     virtual bool showMouse(bool visible) = 0;
01157 
01163     virtual bool lockMouse(bool lock) = 0;
01164 
01171     virtual void warpMouse(int x, int y) = 0;
01172 
01190     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;
01191 
01204     virtual void setCursorPalette(const byte *colors, uint start, uint num) {}
01205 
01207 
01208 
01209 
01212 
01220     virtual uint32 getMillis(bool skipRecord = false) = 0;
01221 
01223     virtual void delayMillis(uint msecs) = 0;
01224 
01230     virtual void getTimeAndDate(TimeDate &t) const = 0;
01231 
01236     virtual Common::TimerManager *getTimerManager();
01237 
01242     inline Common::EventManager *getEventManager() {
01243         return _eventManager;
01244     }
01245 
01246 #ifdef ENABLE_KEYMAPPER
01247 
01256     virtual Common::HardwareInputSet *getHardwareInputSet() { return nullptr; }
01257 
01269     virtual Common::Keymap *getGlobalKeymap() { return nullptr; }
01270 
01280     virtual Common::KeymapperDefaultBindings *getKeymapperDefaultBindings() { return nullptr; }
01281 #endif
01282 
01283 
01284 
01285 
01302 
01303     typedef struct OpaqueMutex *MutexRef;
01304 
01309     virtual MutexRef createMutex() = 0;
01310 
01321     virtual void lockMutex(MutexRef mutex) = 0;
01322 
01327     virtual void unlockMutex(MutexRef mutex) = 0;
01328 
01335     virtual void deleteMutex(MutexRef mutex) = 0;
01336 
01338 
01339 
01340 
01343 
01348     virtual Audio::Mixer *getMixer() = 0;
01349 
01351 
01352 
01353 
01356 
01361     inline AudioCDManager *getAudioCDManager() {
01362         return _audiocdManager;
01363     }
01364 
01366 
01367 
01368 
01372     virtual void quit() = 0;
01373 
01379     virtual void fatalError();
01380 
01389     virtual void setWindowCaption(const char *caption) {}
01390 
01408     virtual void displayMessageOnOSD(const char *msg) = 0;
01409 
01427     virtual void displayActivityIconOnOSD(const Graphics::Surface *icon) = 0;
01428 
01434     virtual Common::SaveFileManager *getSavefileManager();
01435 
01436 #if defined(USE_TASKBAR)
01437 
01443     virtual Common::TaskbarManager *getTaskbarManager() {
01444         return _taskbarManager;
01445     }
01446 #endif
01447 
01448 #if defined(USE_UPDATES)
01449 
01455     virtual Common::UpdateManager *getUpdateManager() {
01456         return _updateManager;
01457     }
01458 #endif
01459 
01460 #if defined(USE_SYSDIALOGS)
01461 
01466     virtual Common::DialogManager *getDialogManager() {
01467         return _dialogManager;
01468     }
01469 #endif
01470 
01476     virtual FilesystemFactory *getFilesystemFactory();
01477 
01488     virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0) {}
01489 
01495     virtual Common::SeekableReadStream *createConfigReadStream();
01496 
01504     virtual Common::WriteStream *createConfigWriteStream();
01505 
01511     virtual Common::String getDefaultConfigFileName();
01512 
01525     virtual void logMessage(LogMessageType::Type type, const char *message) = 0;
01526 
01552     virtual bool displayLogFile() { return false; }
01553 
01563     virtual bool hasTextInClipboard() { return false; }
01564 
01574     virtual Common::String getTextFromClipboard() { return ""; }
01575 
01585     virtual bool setTextInClipboard(const Common::String &text) { return false; }
01586 
01599     virtual bool openUrl(const Common::String &url) {return false; }
01600 
01617     virtual Common::String getSystemLanguage() const;
01618 
01620 };
01621 
01622 
01624 extern OSystem *g_system;
01625 
01626 #endif


Generated on Sat Mar 23 2019 05:02:15 for ResidualVM by doxygen 1.7.1
curved edge   curved edge