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 
00211     Common::String _clipboard;
00212 
00213 private:
00217     bool _backendInitialized;
00218 
00220 
00221 public:
00222 
00227     void destroy();
00228 
00237     virtual void initBackend();
00238 
00244     bool backendInitialized() const { return _backendInitialized; }
00245 
00250     virtual void engineInit() { }
00251 
00256     virtual void engineDone() { }
00257 
00260 
00276     enum Feature {
00281         kFeatureFullscreenMode,
00282 
00296         kFeatureAspectRatioCorrection,
00297 
00302         kFeatureFilteringMode,
00303 
00307         kFeatureStretchMode,
00308 
00314         kFeatureVirtualKeyboard,
00315 
00326         kFeatureCursorPalette,
00327 
00335         kFeatureOverlaySupportsAlpha,
00336 
00341         kFeatureIconifyWindow,
00342 
00360         kFeatureDisableKeyFiltering,
00361 
00362         //ResidualVM specific
00363         kFeatureOpenGL,
00364         // Can side textures be rendered on the side for widescreen support?
00365         kFeatureSideTextures,
00366 
00374         kFeatureVSync,
00375 
00387         kFeatureFullscreenToggleKeepsContext,
00388 
00395         kFeatureDisplayLogFile,
00396 
00406         kFeatureClipboardSupport,
00407 
00414         kFeatureOpenUrl,
00415 
00419         kFeatureOnScreenControl,
00420 
00424         kFeatureTouchpadMode,
00425 
00429         kFeatureSwapMenuAndBackButtons,
00430 
00434         kFeatureKbdMouseSpeed,
00435 
00439         kFeatureJoystickDeadzone,
00440 
00444         kFeatureShader,
00445 
00450         kFeatureSystemBrowserDialog
00451 
00452     };
00453 
00457     virtual bool hasFeature(Feature f) { return false; }
00458 
00463     virtual void setFeatureState(Feature f, bool enable) {}
00464 
00469     virtual bool getFeatureState(Feature f) { return false; }
00470 
00472 
00473 
00474 
00542 
00548     struct GraphicsMode {
00554         const char *name;
00559         const char *description;
00565         int id;
00566     };
00567 
00578     virtual const GraphicsMode *getSupportedGraphicsModes() const = 0;
00579 
00590     virtual int getDefaultGraphicsMode() const = 0;
00591 
00601     virtual bool setGraphicsMode(int mode) = 0;
00602 
00615     bool setGraphicsMode(const char *name);
00616 
00623     virtual int getGraphicsMode() const = 0;
00624 
00632     virtual void resetGraphicsScale() {}
00633 
00634 #ifdef USE_RGB_COLOR
00635 
00642     virtual Graphics::PixelFormat getScreenFormat() const = 0;
00643 
00667     virtual Common::List<Graphics::PixelFormat> getSupportedFormats() const = 0;
00668 #else
00669     inline Graphics::PixelFormat getScreenFormat() const {
00670         return Graphics::PixelFormat::createFormatCLUT8();
00671     };
00672 
00673     inline Common::List<Graphics::PixelFormat> getSupportedFormats() const {
00674         Common::List<Graphics::PixelFormat> list;
00675         list.push_back(Graphics::PixelFormat::createFormatCLUT8());
00676         return list;
00677     };
00678 #endif
00679 
00688     virtual Common::Array<uint> getSupportedAntiAliasingLevels() const {
00689         return Common::Array<uint>();
00690     }
00691 
00702     virtual const GraphicsMode *getSupportedShaders() const {
00703         static const OSystem::GraphicsMode no_shader[2] = {{"NONE", "Normal (no shader)", 0}, {nullptr, nullptr, 0}};
00704         return no_shader;
00705     }
00706 
00716     virtual bool setShader(int id) { return false; }
00717 
00722     virtual int getShader() const { return 0; }
00723 
00731     virtual const GraphicsMode *getSupportedStretchModes() const {
00732         static const GraphicsMode noStretchModes[] = {{"NONE", "Normal", 0}, {nullptr, nullptr, 0 }};
00733         return noStretchModes;
00734     }
00735 
00744     virtual int getDefaultStretchMode() const { return 0; }
00745 
00753     virtual bool setStretchMode(int mode) { return false; }
00754 
00765     bool setStretchMode(const char *name);
00766 
00771     virtual int getStretchMode() const { return 0; }
00772 
00773 
00800     virtual void initSize(uint width, uint height, const Graphics::PixelFormat *format = nullptr) = 0;
00801 
00812     virtual void initSizeHint(const Graphics::ModeList &modes) {}
00813  
00821     virtual void launcherInitSize(uint width, uint height) = 0;
00822 
00838     virtual int getScreenChangeID() const { return 0; }
00839 
00858     virtual void beginGFXTransaction() {}
00859 
00871     enum TransactionError {
00872         kTransactionSuccess = 0,                    
00873         kTransactionAspectRatioFailed = (1 << 0),   
00874         kTransactionFullscreenFailed = (1 << 1),    
00875         kTransactionModeSwitchFailed = (1 << 2),    
00876         kTransactionSizeChangeFailed = (1 << 3),    
00877         kTransactionFormatNotSupported = (1 << 4),  
00878         kTransactionFilteringFailed = (1 << 5),     
00879         kTransactionStretchModeSwitchFailed = (1 << 6)  
00880     };
00881 
00890     virtual TransactionError endGFXTransaction() { return kTransactionSuccess; }
00891 
00901     virtual void setupScreen(uint screenW, uint screenH, bool fullscreen, bool accel3d) = 0;
00902 
00909     virtual Graphics::PixelBuffer getScreenPixelBuffer() = 0;
00910 
00923     virtual void suggestSideTextures(Graphics::Surface *left,
00924                                      Graphics::Surface *right) {};
00925 
00931     virtual int16 getHeight() = 0;
00932 
00938     virtual int16 getWidth() = 0;
00939 
00946     virtual PaletteManager *getPaletteManager() = 0;
00947 
00976     virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) = 0;
00977 
00995     virtual Graphics::Surface *lockScreen() = 0;
00996 
01001     virtual void unlockScreen() = 0;
01002 
01008     virtual void fillScreen(uint32 col) = 0;
01009 
01019     virtual void updateScreen() = 0;
01020 
01035     virtual void setShakePos(int shakeOffset) = 0;
01036 
01051     virtual void setFocusRectangle(const Common::Rect& rect) {}
01052 
01059     virtual void clearFocusRectangle() {}
01060 
01067     virtual void saveScreenshot() {}
01069 
01070 
01071 
01090 
01092     virtual void showOverlay() = 0;
01093 
01095     virtual void hideOverlay() = 0;
01096 
01101     virtual Graphics::PixelFormat getOverlayFormat() const = 0;
01102 
01114     virtual void clearOverlay() = 0;
01115 
01120     virtual void grabOverlay(void *buf, int pitch) = 0;
01121 
01136     virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) = 0;
01137 
01142     virtual int16 getOverlayHeight() = 0;
01143 
01148     virtual int16 getOverlayWidth() = 0;
01149 
01151 
01152 
01153 
01160 
01173     virtual bool showMouse(bool visible) = 0;
01174 
01180     virtual bool lockMouse(bool lock) = 0;
01181 
01188     virtual void warpMouse(int x, int y) = 0;
01189 
01207     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;
01208 
01221     virtual void setCursorPalette(const byte *colors, uint start, uint num) {}
01222 
01224 
01225 
01226 
01229 
01237     virtual uint32 getMillis(bool skipRecord = false) = 0;
01238 
01240     virtual void delayMillis(uint msecs) = 0;
01241 
01247     virtual void getTimeAndDate(TimeDate &t) const = 0;
01248 
01253     virtual Common::TimerManager *getTimerManager();
01254 
01259     inline Common::EventManager *getEventManager() {
01260         return _eventManager;
01261     }
01262 
01263 #ifdef ENABLE_KEYMAPPER
01264 
01273     virtual Common::HardwareInputSet *getHardwareInputSet() { return nullptr; }
01274 
01286     virtual Common::Keymap *getGlobalKeymap() { return nullptr; }
01287 
01297     virtual Common::KeymapperDefaultBindings *getKeymapperDefaultBindings() { return nullptr; }
01298 #endif
01299 
01300 
01301 
01302 
01319 
01320     typedef struct OpaqueMutex *MutexRef;
01321 
01326     virtual MutexRef createMutex() = 0;
01327 
01338     virtual void lockMutex(MutexRef mutex) = 0;
01339 
01344     virtual void unlockMutex(MutexRef mutex) = 0;
01345 
01352     virtual void deleteMutex(MutexRef mutex) = 0;
01353 
01355 
01356 
01357 
01360 
01365     virtual Audio::Mixer *getMixer() = 0;
01366 
01368 
01369 
01370 
01373 
01378     inline AudioCDManager *getAudioCDManager() {
01379         return _audiocdManager;
01380     }
01381 
01383 
01384 
01385 
01389     virtual void quit() = 0;
01390 
01396     virtual void fatalError();
01397 
01406     virtual void setWindowCaption(const char *caption) {}
01407 
01425     virtual void displayMessageOnOSD(const char *msg) = 0;
01426 
01444     virtual void displayActivityIconOnOSD(const Graphics::Surface *icon) = 0;
01445 
01451     virtual Common::SaveFileManager *getSavefileManager();
01452 
01453 #if defined(USE_TASKBAR)
01454 
01460     virtual Common::TaskbarManager *getTaskbarManager() {
01461         return _taskbarManager;
01462     }
01463 #endif
01464 
01465 #if defined(USE_UPDATES)
01466 
01472     virtual Common::UpdateManager *getUpdateManager() {
01473         return _updateManager;
01474     }
01475 #endif
01476 
01477 #if defined(USE_SYSDIALOGS)
01478 
01483     virtual Common::DialogManager *getDialogManager() {
01484         return _dialogManager;
01485     }
01486 #endif
01487 
01493     virtual FilesystemFactory *getFilesystemFactory();
01494 
01505     virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0) {}
01506 
01512     virtual Common::SeekableReadStream *createConfigReadStream();
01513 
01521     virtual Common::WriteStream *createConfigWriteStream();
01522 
01528     virtual Common::String getDefaultConfigFileName();
01529 
01542     virtual void logMessage(LogMessageType::Type type, const char *message) = 0;
01543 
01569     virtual bool displayLogFile() { return false; }
01570 
01580     virtual bool hasTextInClipboard() { return !_clipboard.empty(); }
01581 
01591     virtual Common::String getTextFromClipboard() { return _clipboard; }
01592 
01602     virtual bool setTextInClipboard(const Common::String &text) { _clipboard = text; return true; }
01603 
01616     virtual bool openUrl(const Common::String &url) {return false; }
01617 
01634     virtual Common::String getSystemLanguage() const;
01635 
01641     virtual bool isConnectionLimited();
01642 
01644 };
01645 
01646 
01648 extern OSystem *g_system;
01649 
01650 #endif


Generated on Sat Jan 25 2020 05:00:24 for ResidualVM by doxygen 1.7.1
curved edge   curved edge