diff options
author | Max Horn | 2004-02-28 12:58:13 +0000 |
---|---|---|
committer | Max Horn | 2004-02-28 12:58:13 +0000 |
commit | c6752cccf5186fb04c97e2bb4a64c52fc9447073 (patch) | |
tree | 91f3f0264b1542a839cc3504b52603a8034547cb /backends/sdl | |
parent | 56102a1d02925abbe9fc0504751de1a270a34ff3 (diff) | |
download | scummvm-rg350-c6752cccf5186fb04c97e2bb4a64c52fc9447073.tar.gz scummvm-rg350-c6752cccf5186fb04c97e2bb4a64c52fc9447073.tar.bz2 scummvm-rg350-c6752cccf5186fb04c97e2bb4a64c52fc9447073.zip |
renamed more OSystem methods to follow our naming scheme; renamed NewGuiColor to OverlayColor; fixed some calls to error() in the SDL backend
svn-id: r13087
Diffstat (limited to 'backends/sdl')
-rw-r--r-- | backends/sdl/sdl-common.cpp | 83 | ||||
-rw-r--r-- | backends/sdl/sdl-common.h | 22 | ||||
-rw-r--r-- | backends/sdl/sdl.cpp | 6 |
3 files changed, 56 insertions, 55 deletions
diff --git a/backends/sdl/sdl-common.cpp b/backends/sdl/sdl-common.cpp index dbf7f2de9f..3fc8e7c2ec 100644 --- a/backends/sdl/sdl-common.cpp +++ b/backends/sdl/sdl-common.cpp @@ -95,11 +95,11 @@ void OSystem_SDL_Common::init_intern() { if (joystick_num > -1) sdlFlags |= SDL_INIT_JOYSTICK; - if (SDL_Init(sdlFlags) ==-1) { - error("Could not initialize SDL: %s.\n", SDL_GetError()); + if (SDL_Init(sdlFlags) == -1) { + error("Could not initialize SDL: %s", SDL_GetError()); } - _graphicsMutex = create_mutex(); + _graphicsMutex = createMutex(); SDL_ShowCursor(SDL_DISABLE); @@ -156,7 +156,7 @@ OSystem_SDL_Common::~OSystem_SDL_Common() { free(_dirty_checksums); free(_currentPalette); free(_mouseBackup); - delete_mutex(_graphicsMutex); + deleteMutex(_graphicsMutex); SDL_ShowCursor(SDL_ENABLE); SDL_Quit(); @@ -229,7 +229,7 @@ void OSystem_SDL_Common::copy_rect(const byte *src, int pitch, int x, int y, int // Try to lock the screen surface if (SDL_LockSurface(_screen) == -1) - error("SDL_LockSurface failed: %s.\n", SDL_GetError()); + error("SDL_LockSurface failed: %s", SDL_GetError()); byte *dst = (byte *)_screen->pixels + y * _screenWidth + x; @@ -268,7 +268,7 @@ void OSystem_SDL_Common::move_screen(int dx, int dy, int height) { // Try to lock the screen surface if (SDL_LockSurface(_screen) == -1) - error("SDL_LockSurface failed: %s.\n", SDL_GetError()); + error("SDL_LockSurface failed: %s", SDL_GetError()); // vertical movement if (dy > 0) { @@ -535,7 +535,7 @@ void OSystem_SDL_Common::set_mouse_pos(int x, int y) { _mouseCurState.x = x; _mouseCurState.y = y; undraw_mouse(); - update_screen(); + updateScreen(); } } @@ -1050,14 +1050,18 @@ void OSystem_SDL_Common::clearSoundCallback() { SDL_CloseAudio(); } +int OSystem_SDL_Common::getOutputSampleRate() const { + return SAMPLES_PER_SEC; +} + const OSystem::GraphicsMode *OSystem_SDL_Common::getSupportedGraphicsModes() const { return s_supportedGraphicsModes; } -void OSystem_SDL_Common::update_screen() { +void OSystem_SDL_Common::updateScreen() { Common::StackLock lock(_graphicsMutex, this); // Lock the mutex until this function ends - intern_update_screen(); + internUpdateScreen(); } bool OSystem_SDL_Common::setGraphicsMode(int mode) { @@ -1131,7 +1135,7 @@ bool OSystem_SDL_Common::setGraphicsMode(int mode) { _forceFull = true; // Blit everything to the screen - intern_update_screen(); + internUpdateScreen(); // Make sure that an EVENT_SCREEN_CHANGED gets sent later _modeChanged = true; @@ -1149,29 +1153,6 @@ void OSystem_SDL_Common::setWindowCaption(const char *caption) { SDL_WM_SetCaption(caption, caption); } -bool OSystem_SDL_Common::openCD(int drive) { - if (SDL_InitSubSystem(SDL_INIT_CDROM) == -1) - _cdrom = NULL; - else { - _cdrom = SDL_CDOpen(drive); - // Did it open? Check if _cdrom is NULL - if (!_cdrom) { - warning("Couldn't open drive: %s", SDL_GetError()); - } else { - cd_num_loops = 0; - cd_stop_time = 0; - cd_end_time = 0; - } - } - - return (_cdrom != NULL); -} - -int OSystem_SDL_Common::getOutputSampleRate() const { - return SAMPLES_PER_SEC; -} - - bool OSystem_SDL_Common::hasFeature(Feature f) { return (f == kFeatureFullscreenMode) || @@ -1278,7 +1259,7 @@ void OSystem_SDL_Common::draw_mouse() { // Draw the mouse cursor; backup the covered area in "bak" if (SDL_LockSurface(_overlayVisible ? _tmpscreen : _screen) == -1) - error("SDL_LockSurface failed: %s.\n", SDL_GetError()); + error("SDL_LockSurface failed: %s", SDL_GetError()); // Mark as dirty add_dirty_rect(x, y, w, h); @@ -1338,7 +1319,7 @@ void OSystem_SDL_Common::undraw_mouse() { _mouseDrawn = false; if (SDL_LockSurface(_overlayVisible ? _tmpscreen : _screen) == -1) - error("SDL_LockSurface failed: %s.\n", SDL_GetError()); + error("SDL_LockSurface failed: %s", SDL_GetError()); const int old_mouse_x = _mouseOldState.x; const int old_mouse_y = _mouseOldState.y; @@ -1375,6 +1356,24 @@ void OSystem_SDL_Common::undraw_mouse() { SDL_UnlockSurface(_overlayVisible ? _tmpscreen : _screen); } +bool OSystem_SDL_Common::openCD(int drive) { + if (SDL_InitSubSystem(SDL_INIT_CDROM) == -1) + _cdrom = NULL; + else { + _cdrom = SDL_CDOpen(drive); + // Did it open? Check if _cdrom is NULL + if (!_cdrom) { + warning("Couldn't open drive: %s", SDL_GetError()); + } else { + cd_num_loops = 0; + cd_stop_time = 0; + cd_end_time = 0; + } + } + + return (_cdrom != NULL); +} + void OSystem_SDL_Common::stop_cdrom() { /* Stop CD Audio in 1/10th of a second */ cd_stop_time = SDL_GetTicks() + 100; cd_num_loops = 0; @@ -1488,19 +1487,19 @@ void OSystem_SDL_Common::setup_icon() { SDL_FreeSurface(sdl_surf); } -OSystem::MutexRef OSystem_SDL_Common::create_mutex(void) { +OSystem::MutexRef OSystem_SDL_Common::createMutex(void) { return (MutexRef) SDL_CreateMutex(); } -void OSystem_SDL_Common::lock_mutex(MutexRef mutex) { +void OSystem_SDL_Common::lockMutex(MutexRef mutex) { SDL_mutexP((SDL_mutex *) mutex); } -void OSystem_SDL_Common::unlock_mutex(MutexRef mutex) { +void OSystem_SDL_Common::unlockMutex(MutexRef mutex) { SDL_mutexV((SDL_mutex *) mutex); } -void OSystem_SDL_Common::delete_mutex(MutexRef mutex) { +void OSystem_SDL_Common::deleteMutex(MutexRef mutex) { SDL_DestroyMutex((SDL_mutex *) mutex); } @@ -1560,7 +1559,7 @@ void OSystem_SDL_Common::grab_overlay(int16 *buf, int pitch) { undraw_mouse(); if (SDL_LockSurface(_tmpscreen) == -1) - error("SDL_LockSurface failed: %s.\n", SDL_GetError()); + error("SDL_LockSurface failed: %s", SDL_GetError()); int16 *src = (int16 *)_tmpscreen->pixels + _tmpScreenWidth + 1; int h = _screenHeight; @@ -1611,7 +1610,7 @@ void OSystem_SDL_Common::copy_rect_overlay(const int16 *buf, int pitch, int x, i undraw_mouse(); if (SDL_LockSurface(_tmpscreen) == -1) - error("SDL_LockSurface failed: %s.\n", SDL_GetError()); + error("SDL_LockSurface failed: %s", SDL_GetError()); int16 *dst = (int16 *)_tmpscreen->pixels + (y + 1) * _tmpScreenWidth + (x + 1); do { @@ -1623,7 +1622,7 @@ void OSystem_SDL_Common::copy_rect_overlay(const int16 *buf, int pitch, int x, i SDL_UnlockSurface(_tmpscreen); } -void OSystem_SDL_Common::set_palette(const byte *colors, uint start, uint num) { +void OSystem_SDL_Common::setPalette(const byte *colors, uint start, uint num) { const byte *b = colors; uint i; SDL_Color *base = _currentPalette + start; diff --git a/backends/sdl/sdl-common.h b/backends/sdl/sdl-common.h index 9a612d80b3..d007bf91ce 100644 --- a/backends/sdl/sdl-common.h +++ b/backends/sdl/sdl-common.h @@ -37,7 +37,7 @@ public: void initSize(uint w, uint h); // Set colors of the palette - void set_palette(const byte *colors, uint start, uint num); + void setPalette(const byte *colors, uint start, uint num); // Draw a bitmap to screen. // The screen will not be updated to reflect the new bitmap @@ -46,7 +46,7 @@ public: void move_screen(int dx, int dy, int height); // Update the dirty areas of the screen - void update_screen(); + void updateScreen(); // Either show or hide the mouse cursor bool show_mouse(bool visible); @@ -98,10 +98,10 @@ public: void set_timer(TimerProc callback, int timer); // Mutex handling - MutexRef create_mutex(); - void lock_mutex(MutexRef mutex); - void unlock_mutex(MutexRef mutex); - void delete_mutex(MutexRef mutex); + MutexRef createMutex(); + void lockMutex(MutexRef mutex); + void unlockMutex(MutexRef mutex); + void deleteMutex(MutexRef mutex); // Overlay virtual void show_overlay(); @@ -159,7 +159,7 @@ protected: DF_UPDATE_EXPAND_1_PIXEL = 1 << 1 }; - bool _forceFull; // Force full redraw on next update_screen + bool _forceFull; // Force full redraw on next updateScreen ScalerProc *_scaler_proc; int _scaleFactor; int _mode; @@ -217,8 +217,10 @@ protected: SDL_Color *_currentPalette; uint _paletteDirtyStart, _paletteDirtyEnd; - // Mutex that prevents multiple threads interferring with each other - // when accessing the screen. + /** + * Mutex which prevents multiple threads from interfering with each other + * when accessing the screen. + */ MutexRef _graphicsMutex; @@ -235,7 +237,7 @@ protected: void toggleMouseGrab(); - virtual void intern_update_screen() = 0; + virtual void internUpdateScreen() = 0; virtual void load_gfx_mode() = 0; virtual void unload_gfx_mode() = 0; diff --git a/backends/sdl/sdl.cpp b/backends/sdl/sdl.cpp index 7b28f75552..5e231e07a6 100644 --- a/backends/sdl/sdl.cpp +++ b/backends/sdl/sdl.cpp @@ -28,7 +28,7 @@ public: OSystem_SDL(); // Update the dirty areas of the screen - void intern_update_screen(); + void internUpdateScreen(); protected: SDL_Surface *_hwscreen; // hardware screen @@ -222,13 +222,13 @@ void OSystem_SDL::hotswap_gfx_mode() { SDL_FreeSurface(old_tmpscreen); // Blit everything to the screen - intern_update_screen(); + internUpdateScreen(); // Make sure that an EVENT_SCREEN_CHANGED gets sent later _modeChanged = true; } -void OSystem_SDL::intern_update_screen() { +void OSystem_SDL::internUpdateScreen() { assert(_hwscreen != NULL); // If the shake position changed, fill the dirty area with blackness |