From bc44792da9f276ca2a15ee2e389ff572f3d0a00c Mon Sep 17 00:00:00 2001 From: Hielke Morsink Date: Fri, 16 Feb 2018 00:43:16 +0100 Subject: [PATCH] Pack nested namespaces together --- src/openrct2-ui/CursorData.cpp | 4 +- src/openrct2-ui/CursorRepository.h | 93 ++++++++++----------- src/openrct2-ui/TextComposition.h | 57 ++++++------- src/openrct2-ui/UiContext.Android.cpp | 90 ++++++++++---------- src/openrct2-ui/UiContext.Linux.cpp | 4 +- src/openrct2-ui/UiContext.Win32.cpp | 4 +- src/openrct2-ui/UiContext.macOS.mm | 4 +- src/openrct2-ui/WindowManager.h | 4 +- src/openrct2-ui/audio/AudioChannel.cpp | 4 +- src/openrct2-ui/audio/AudioContext.cpp | 4 +- src/openrct2-ui/audio/AudioContext.h | 4 +- src/openrct2-ui/audio/AudioFormat.h | 4 +- src/openrct2-ui/audio/AudioMixer.cpp | 4 +- src/openrct2-ui/audio/FileAudioSource.cpp | 4 +- src/openrct2-ui/audio/MemoryAudioSource.cpp | 4 +- src/openrct2-ui/interface/InGameConsole.h | 4 +- src/openrct2/audio/AudioChannel.h | 4 +- src/openrct2/audio/AudioContext.h | 61 +++++++------- src/openrct2/audio/AudioMixer.h | 4 +- src/openrct2/audio/AudioSource.h | 4 +- src/openrct2/audio/DummyAudioContext.cpp | 4 +- src/openrct2/audio/NullAudioSource.cpp | 4 +- src/openrct2/drawing/IDrawingContext.h | 4 +- src/openrct2/drawing/IDrawingEngine.h | 4 +- src/openrct2/drawing/Rain.h | 4 +- src/openrct2/interface/Cursors.h | 4 +- src/openrct2/ui/DummyUiContext.cpp | 4 +- src/openrct2/ui/DummyWindowManager.cpp | 4 +- src/openrct2/ui/WindowManager.h | 43 +++++----- 29 files changed, 214 insertions(+), 226 deletions(-) diff --git a/src/openrct2-ui/CursorData.cpp b/src/openrct2-ui/CursorData.cpp index 6407803c2f..c94e26d70b 100644 --- a/src/openrct2-ui/CursorData.cpp +++ b/src/openrct2-ui/CursorData.cpp @@ -17,7 +17,7 @@ #include #include "CursorRepository.h" -namespace OpenRCT2 { namespace Ui +namespace OpenRCT2::Ui { static constexpr const CursorData BlankCursorData = { @@ -664,4 +664,4 @@ namespace OpenRCT2 { namespace Ui } return result; } -} } +} diff --git a/src/openrct2-ui/CursorRepository.h b/src/openrct2-ui/CursorRepository.h index 193a883252..400fa55f47 100644 --- a/src/openrct2-ui/CursorRepository.h +++ b/src/openrct2-ui/CursorRepository.h @@ -23,59 +23,56 @@ struct SDL_Cursor; -namespace OpenRCT2 +namespace OpenRCT2::Ui { - namespace Ui + class CursorRepository { - class CursorRepository + private: + class CursorSetHolder { private: - class CursorSetHolder - { - private: - SDL_Cursor * _cursors[CURSOR_COUNT] = {nullptr}; - public: - CursorSetHolder(const std::function & getCursor) - { - for (size_t i = 0; i < CURSOR_COUNT; i++) - { - _cursors[i] = getCursor(static_cast(i)); - } - } - - ~CursorSetHolder() - { - for (size_t i = 0; i < CURSOR_COUNT; i++) - { - SDL_FreeCursor(_cursors[i]); - } - } - - SDL_Cursor * getScaledCursor(CURSOR_ID cursorId) - { - return _cursors[cursorId]; - } - }; - - constexpr static sint32 BASE_CURSOR_WIDTH = 32; - constexpr static sint32 BASE_CURSOR_HEIGHT = 32; - - CURSOR_ID _currentCursor = CURSOR_UNDEFINED; - uint8 _currentCursorScale = 1; - - std::map _scaledCursors; - + SDL_Cursor * _cursors[CURSOR_COUNT] = {nullptr}; public: - ~CursorRepository(); - void LoadCursors(); - CURSOR_ID GetCurrentCursor(); - void SetCurrentCursor(CURSOR_ID cursorId); - void SetCursorScale(uint8 cursorScale); + CursorSetHolder(const std::function & getCursor) + { + for (size_t i = 0; i < CURSOR_COUNT; i++) + { + _cursors[i] = getCursor(static_cast(i)); + } + } - private: - SDL_Cursor * Create(const CursorData * cursorInfo, uint8 scale); - void GenerateScaledCursorSetHolder(uint8 scale); - static const CursorData * GetCursorData(CURSOR_ID cursorId); + ~CursorSetHolder() + { + for (size_t i = 0; i < CURSOR_COUNT; i++) + { + SDL_FreeCursor(_cursors[i]); + } + } + + SDL_Cursor * getScaledCursor(CURSOR_ID cursorId) + { + return _cursors[cursorId]; + } }; - } + + constexpr static sint32 BASE_CURSOR_WIDTH = 32; + constexpr static sint32 BASE_CURSOR_HEIGHT = 32; + + CURSOR_ID _currentCursor = CURSOR_UNDEFINED; + uint8 _currentCursorScale = 1; + + std::map _scaledCursors; + + public: + ~CursorRepository(); + void LoadCursors(); + CURSOR_ID GetCurrentCursor(); + void SetCurrentCursor(CURSOR_ID cursorId); + void SetCursorScale(uint8 cursorScale); + + private: + SDL_Cursor * Create(const CursorData * cursorInfo, uint8 scale); + void GenerateScaledCursorSetHolder(uint8 scale); + static const CursorData * GetCursorData(CURSOR_ID cursorId); + }; } diff --git a/src/openrct2-ui/TextComposition.h b/src/openrct2-ui/TextComposition.h index eb9686a347..79850df23b 100644 --- a/src/openrct2-ui/TextComposition.h +++ b/src/openrct2-ui/TextComposition.h @@ -20,39 +20,36 @@ union SDL_Event; -namespace OpenRCT2 +namespace OpenRCT2::Ui { - namespace Ui + /** + * Represents a + */ + class TextComposition { - /** - * Represents a - */ - class TextComposition - { - private: - TextInputSession _session = { 0 }; + private: + TextInputSession _session = { 0 }; - bool _imeActive = false; - sint32 _imeStart = 0; - sint32 _imeLength = 0; - utf8 _imeBuffer[32] = { 0 }; + bool _imeActive = false; + sint32 _imeStart = 0; + sint32 _imeLength = 0; + utf8 _imeBuffer[32] = { 0 }; - public: - bool IsActive(); - TextInputSession * Start(utf8 * buffer, size_t bufferSize); - void Stop(); - void HandleMessage(const SDL_Event * e); + public: + bool IsActive(); + TextInputSession * Start(utf8 * buffer, size_t bufferSize); + void Stop(); + void HandleMessage(const SDL_Event * e); - private: - void CursorHome(); - void CursorEnd(); - void CursorLeft(); - void CursorRight(); - void Insert(const utf8 * text); - void InsertCodepoint(codepoint_t codepoint); - void Clear(); - void Delete(); - void RecalculateLength(); - }; - } + private: + void CursorHome(); + void CursorEnd(); + void CursorLeft(); + void CursorRight(); + void Insert(const utf8 * text); + void InsertCodepoint(codepoint_t codepoint); + void Clear(); + void Delete(); + void RecalculateLength(); + }; } diff --git a/src/openrct2-ui/UiContext.Android.cpp b/src/openrct2-ui/UiContext.Android.cpp index 2c5b887d01..3e2f6ba438 100644 --- a/src/openrct2-ui/UiContext.Android.cpp +++ b/src/openrct2-ui/UiContext.Android.cpp @@ -26,54 +26,54 @@ #include -namespace OpenRCT2 { namespace Ui +namespace OpenRCT2::Ui +{ + + class AndroidContext final : public IPlatformUiContext { + private: - class AndroidContext final : public IPlatformUiContext + public: + AndroidContext() { - private: - - public: - AndroidContext() - { - } - - void SetWindowIcon(SDL_Window * window) override - { - } - - bool IsSteamOverlayAttached() override - { - return false; - } - - void ShowMessageBox(SDL_Window * window, const std::string &message) override - { - log_verbose(message.c_str()); - - STUB(); - } - - std::string ShowFileDialog(SDL_Window * window, const FileDialogDesc &desc) override - { - STUB(); - - return nullptr; - } - - std::string ShowDirectoryDialog(SDL_Window * window, const std::string &title) override - { - log_info(title.c_str()); - STUB(); - - return "/sdcard/rct2"; - } - }; - - IPlatformUiContext * CreatePlatformUiContext() - { - return new AndroidContext(); } - } } + + void SetWindowIcon(SDL_Window * window) override + { + } + + bool IsSteamOverlayAttached() override + { + return false; + } + + void ShowMessageBox(SDL_Window * window, const std::string &message) override + { + log_verbose(message.c_str()); + + STUB(); + } + + std::string ShowFileDialog(SDL_Window * window, const FileDialogDesc &desc) override + { + STUB(); + + return nullptr; + } + + std::string ShowDirectoryDialog(SDL_Window * window, const std::string &title) override + { + log_info(title.c_str()); + STUB(); + + return "/sdcard/rct2"; + } + }; + + IPlatformUiContext * CreatePlatformUiContext() + { + return new AndroidContext(); + } +} #endif // __ANDROID__ diff --git a/src/openrct2-ui/UiContext.Linux.cpp b/src/openrct2-ui/UiContext.Linux.cpp index af47284af7..6859460ba7 100644 --- a/src/openrct2-ui/UiContext.Linux.cpp +++ b/src/openrct2-ui/UiContext.Linux.cpp @@ -29,7 +29,7 @@ #include -namespace OpenRCT2 { namespace Ui +namespace OpenRCT2::Ui { enum class DIALOG_TYPE { @@ -385,6 +385,6 @@ namespace OpenRCT2 { namespace Ui { return new LinuxContext(); } -} } +} #endif // __linux__ || __OpenBSD__ diff --git a/src/openrct2-ui/UiContext.Win32.cpp b/src/openrct2-ui/UiContext.Win32.cpp index 3ac5705a2e..5e8a35cb36 100644 --- a/src/openrct2-ui/UiContext.Win32.cpp +++ b/src/openrct2-ui/UiContext.Win32.cpp @@ -54,7 +54,7 @@ static std::wstring SHGetPathFromIDListLongPath(LPCITEMIDLIST pidl) return pszPath; } -namespace OpenRCT2 { namespace Ui +namespace OpenRCT2::Ui { class Win32Context : public IPlatformUiContext { @@ -224,6 +224,6 @@ namespace OpenRCT2 { namespace Ui { return new Win32Context(); } -} } +} #endif // _WIN32 diff --git a/src/openrct2-ui/UiContext.macOS.mm b/src/openrct2-ui/UiContext.macOS.mm index d5a9929ff0..b67b9b7296 100644 --- a/src/openrct2-ui/UiContext.macOS.mm +++ b/src/openrct2-ui/UiContext.macOS.mm @@ -27,7 +27,7 @@ #include -namespace OpenRCT2 { namespace Ui +namespace OpenRCT2::Ui { class macOSContext final : public IPlatformUiContext { @@ -182,6 +182,6 @@ namespace OpenRCT2 { namespace Ui { return new macOSContext(); } -} } +} #endif // __APPLE__ && __MACH__ diff --git a/src/openrct2-ui/WindowManager.h b/src/openrct2-ui/WindowManager.h index 9828776397..842c0cff1e 100644 --- a/src/openrct2-ui/WindowManager.h +++ b/src/openrct2-ui/WindowManager.h @@ -16,9 +16,9 @@ #include -namespace OpenRCT2 { namespace Ui +namespace OpenRCT2::Ui { interface IWindowManager; IWindowManager * CreateWindowManager(); -} } +} diff --git a/src/openrct2-ui/audio/AudioChannel.cpp b/src/openrct2-ui/audio/AudioChannel.cpp index 3671f80102..bbcef49102 100644 --- a/src/openrct2-ui/audio/AudioChannel.cpp +++ b/src/openrct2-ui/audio/AudioChannel.cpp @@ -24,7 +24,7 @@ #include "AudioContext.h" #include "AudioFormat.h" -namespace OpenRCT2 { namespace Audio +namespace OpenRCT2::Audio { class AudioChannelImpl : public ISDLAudioChannel { @@ -295,4 +295,4 @@ namespace OpenRCT2 { namespace Audio { return new (std::nothrow) AudioChannelImpl(); } -} } +} diff --git a/src/openrct2-ui/audio/AudioContext.cpp b/src/openrct2-ui/audio/AudioContext.cpp index fc7f80787f..9bf456936c 100644 --- a/src/openrct2-ui/audio/AudioContext.cpp +++ b/src/openrct2-ui/audio/AudioContext.cpp @@ -21,7 +21,7 @@ #include "../SDLException.h" #include "AudioContext.h" -namespace OpenRCT2 { namespace Audio +namespace OpenRCT2::Audio { class AudioContext : public IAudioContext { @@ -98,4 +98,4 @@ namespace OpenRCT2 { namespace Audio { return new AudioContext(); } -} } +} diff --git a/src/openrct2-ui/audio/AudioContext.h b/src/openrct2-ui/audio/AudioContext.h index 04980a18fb..d6c4b41c47 100644 --- a/src/openrct2-ui/audio/AudioContext.h +++ b/src/openrct2-ui/audio/AudioContext.h @@ -9,7 +9,7 @@ struct SDL_RWops; using SpeexResamplerState = struct SpeexResamplerState_; -namespace OpenRCT2 { namespace Audio +namespace OpenRCT2::Audio { struct AudioFormat; interface IAudioContext; @@ -70,4 +70,4 @@ namespace OpenRCT2 { namespace Audio } IAudioContext * CreateAudioContext(); -} } +} diff --git a/src/openrct2-ui/audio/AudioFormat.h b/src/openrct2-ui/audio/AudioFormat.h index 45a68adb74..2d21c3d21f 100644 --- a/src/openrct2-ui/audio/AudioFormat.h +++ b/src/openrct2-ui/audio/AudioFormat.h @@ -19,7 +19,7 @@ #include #include -namespace OpenRCT2 { namespace Audio +namespace OpenRCT2::Audio { /** * Represents the size, frequency and number of channels for @@ -53,4 +53,4 @@ namespace OpenRCT2 { namespace Audio { return !(lhs == rhs); } -} } +} diff --git a/src/openrct2-ui/audio/AudioMixer.cpp b/src/openrct2-ui/audio/AudioMixer.cpp index ac3a5601da..4b291840b8 100644 --- a/src/openrct2-ui/audio/AudioMixer.cpp +++ b/src/openrct2-ui/audio/AudioMixer.cpp @@ -36,7 +36,7 @@ #include #include -namespace OpenRCT2 { namespace Audio +namespace OpenRCT2::Audio { class AudioMixerImpl final : public IAudioMixer { @@ -513,4 +513,4 @@ namespace OpenRCT2 { namespace Audio { return new AudioMixerImpl(); } -} } +} diff --git a/src/openrct2-ui/audio/FileAudioSource.cpp b/src/openrct2-ui/audio/FileAudioSource.cpp index 9ca3b50d52..3308b8c0e4 100644 --- a/src/openrct2-ui/audio/FileAudioSource.cpp +++ b/src/openrct2-ui/audio/FileAudioSource.cpp @@ -21,7 +21,7 @@ #include "AudioContext.h" #include "AudioFormat.h" -namespace OpenRCT2 { namespace Audio +namespace OpenRCT2::Audio { /** * An audio source where raw PCM data is streamed directly from @@ -207,4 +207,4 @@ namespace OpenRCT2 { namespace Audio } return source; } -} } +} diff --git a/src/openrct2-ui/audio/MemoryAudioSource.cpp b/src/openrct2-ui/audio/MemoryAudioSource.cpp index 40f9fb1df0..6da59002ab 100644 --- a/src/openrct2-ui/audio/MemoryAudioSource.cpp +++ b/src/openrct2-ui/audio/MemoryAudioSource.cpp @@ -24,7 +24,7 @@ #include "AudioContext.h" #include "AudioFormat.h" -namespace OpenRCT2 { namespace Audio +namespace OpenRCT2::Audio { /** * An audio source where raw PCM data is initially loaded into RAM from @@ -243,4 +243,4 @@ namespace OpenRCT2 { namespace Audio } return source; } -} } +} diff --git a/src/openrct2-ui/interface/InGameConsole.h b/src/openrct2-ui/interface/InGameConsole.h index cf7ad3152f..b67762a0eb 100644 --- a/src/openrct2-ui/interface/InGameConsole.h +++ b/src/openrct2-ui/interface/InGameConsole.h @@ -1,6 +1,6 @@ #include -namespace OpenRCT2 { namespace Ui +namespace OpenRCT2::Ui { class InGameConsole final : public InteractiveConsole { @@ -53,4 +53,4 @@ namespace OpenRCT2 { namespace Ui void Invalidate() const; sint32 GetNumVisibleLines() const; }; -} } +} diff --git a/src/openrct2/audio/AudioChannel.h b/src/openrct2/audio/AudioChannel.h index 5b65fcd4c7..622e4e5b89 100644 --- a/src/openrct2/audio/AudioChannel.h +++ b/src/openrct2/audio/AudioChannel.h @@ -18,7 +18,7 @@ #include "../common.h" -namespace OpenRCT2 { namespace Audio +namespace OpenRCT2::Audio { interface IAudioSource; @@ -73,4 +73,4 @@ namespace OpenRCT2 { namespace Audio virtual size_t Read(void * dst, size_t len) abstract; }; -} } +} diff --git a/src/openrct2/audio/AudioContext.h b/src/openrct2/audio/AudioContext.h index a917015ed7..efc2387cd0 100644 --- a/src/openrct2/audio/AudioContext.h +++ b/src/openrct2/audio/AudioContext.h @@ -20,47 +20,44 @@ #include #include "../common.h" -namespace OpenRCT2 +namespace OpenRCT2::Audio { - namespace Audio + interface IAudioChannel; + interface IAudioMixer; + interface IAudioSource; + + /** + * Audio services for playing music and sound effects. + */ + interface IAudioContext { - interface IAudioChannel; - interface IAudioMixer; - interface IAudioSource; + virtual ~IAudioContext() = default; - /** - * Audio services for playing music and sound effects. - */ - interface IAudioContext - { - virtual ~IAudioContext() = default; + virtual IAudioMixer * GetMixer() abstract; - virtual IAudioMixer * GetMixer() abstract; + virtual std::vector GetOutputDevices() abstract; + virtual void SetOutputDevice(const std::string &deviceName) abstract; - virtual std::vector GetOutputDevices() abstract; - virtual void SetOutputDevice(const std::string &deviceName) abstract; - - virtual IAudioSource * CreateStreamFromWAV(const std::string &path) abstract; + virtual IAudioSource * CreateStreamFromWAV(const std::string &path) abstract; - virtual void StartTitleMusic() abstract; + virtual void StartTitleMusic() abstract; - virtual IAudioChannel * PlaySound(sint32 soundId, sint32 volume, sint32 pan) abstract; - virtual IAudioChannel * PlaySoundAtLocation(sint32 soundId, sint16 x, sint16 y, sint16 z) abstract; - virtual IAudioChannel * PlaySoundPanned(sint32 soundId, sint32 pan, sint16 x, sint16 y, sint16 z) abstract; + virtual IAudioChannel * PlaySound(sint32 soundId, sint32 volume, sint32 pan) abstract; + virtual IAudioChannel * PlaySoundAtLocation(sint32 soundId, sint16 x, sint16 y, sint16 z) abstract; + virtual IAudioChannel * PlaySoundPanned(sint32 soundId, sint32 pan, sint16 x, sint16 y, sint16 z) abstract; - virtual void ToggleAllSounds() abstract; - virtual void PauseSounds() abstract; - virtual void UnpauseSounds() abstract; + virtual void ToggleAllSounds() abstract; + virtual void PauseSounds() abstract; + virtual void UnpauseSounds() abstract; - virtual void StopAll() abstract; - virtual void StopCrowdSound() abstract; - virtual void StopRainSound() abstract; - virtual void StopRideMusic() abstract; - virtual void StopTitleMusic() abstract; - virtual void StopVehicleSounds() abstract; - }; + virtual void StopAll() abstract; + virtual void StopCrowdSound() abstract; + virtual void StopRainSound() abstract; + virtual void StopRideMusic() abstract; + virtual void StopTitleMusic() abstract; + virtual void StopVehicleSounds() abstract; + }; - IAudioContext * CreateDummyAudioContext(); - } + IAudioContext * CreateDummyAudioContext(); } diff --git a/src/openrct2/audio/AudioMixer.h b/src/openrct2/audio/AudioMixer.h index 158fac3606..5784f8fdd3 100644 --- a/src/openrct2/audio/AudioMixer.h +++ b/src/openrct2/audio/AudioMixer.h @@ -29,7 +29,7 @@ enum MIXER_GROUP MIXER_GROUP_TITLE_MUSIC, }; -namespace OpenRCT2 { namespace Audio +namespace OpenRCT2::Audio { interface IAudioSource; interface IAudioChannel; @@ -53,7 +53,7 @@ namespace OpenRCT2 { namespace Audio virtual IAudioSource * GetSoundSource(sint32 id) abstract; virtual IAudioSource * GetMusicSource(sint32 id) abstract; }; -} } +} #ifndef DSBPAN_LEFT #define DSBPAN_LEFT -10000 diff --git a/src/openrct2/audio/AudioSource.h b/src/openrct2/audio/AudioSource.h index 5302dab68e..e23b6149c8 100644 --- a/src/openrct2/audio/AudioSource.h +++ b/src/openrct2/audio/AudioSource.h @@ -19,7 +19,7 @@ #include "../common.h" #include "AudioMixer.h" -namespace OpenRCT2 { namespace Audio +namespace OpenRCT2::Audio { /** * Represents a readable source of audio PCM data. @@ -37,4 +37,4 @@ namespace OpenRCT2 { namespace Audio { IAudioSource * CreateNull(); } -} } +} diff --git a/src/openrct2/audio/DummyAudioContext.cpp b/src/openrct2/audio/DummyAudioContext.cpp index 9ef86ca439..b70454ef69 100644 --- a/src/openrct2/audio/DummyAudioContext.cpp +++ b/src/openrct2/audio/DummyAudioContext.cpp @@ -16,7 +16,7 @@ #include "AudioContext.h" -namespace OpenRCT2 { namespace Audio +namespace OpenRCT2::Audio { class DummyAudioContext final : public IAudioContext { @@ -49,4 +49,4 @@ namespace OpenRCT2 { namespace Audio { return new DummyAudioContext(); } -} } +} diff --git a/src/openrct2/audio/NullAudioSource.cpp b/src/openrct2/audio/NullAudioSource.cpp index f396d7236a..e104fe2b45 100644 --- a/src/openrct2/audio/NullAudioSource.cpp +++ b/src/openrct2/audio/NullAudioSource.cpp @@ -16,7 +16,7 @@ #include "AudioSource.h" -namespace OpenRCT2 { namespace Audio +namespace OpenRCT2::Audio { /** * An audio source representing silence. @@ -39,4 +39,4 @@ namespace OpenRCT2 { namespace Audio { return new NullAudioSource(); } -} } +} diff --git a/src/openrct2/drawing/IDrawingContext.h b/src/openrct2/drawing/IDrawingContext.h index bcd96cc413..b768b1e64a 100644 --- a/src/openrct2/drawing/IDrawingContext.h +++ b/src/openrct2/drawing/IDrawingContext.h @@ -20,7 +20,7 @@ #include "Drawing.h" -namespace OpenRCT2 { namespace Drawing +namespace OpenRCT2::Drawing { interface IDrawingEngine; @@ -39,4 +39,4 @@ namespace OpenRCT2 { namespace Drawing virtual void DrawSpriteSolid(uint32 image, sint32 x, sint32 y, uint8 colour) abstract; virtual void DrawGlyph(uint32 image, sint32 x, sint32 y, uint8 * palette) abstract; }; -} } +} diff --git a/src/openrct2/drawing/IDrawingEngine.h b/src/openrct2/drawing/IDrawingEngine.h index f46b6571b1..0784cdc429 100644 --- a/src/openrct2/drawing/IDrawingEngine.h +++ b/src/openrct2/drawing/IDrawingEngine.h @@ -40,7 +40,7 @@ enum DRAWING_ENGINE_FLAGS struct rct_drawpixelinfo; struct rct_palette_entry; -namespace OpenRCT2 { namespace Drawing +namespace OpenRCT2::Drawing { interface IDrawingContext; @@ -80,4 +80,4 @@ namespace OpenRCT2 { namespace Drawing sint32 xStart, sint32 yStart) abstract; }; -} } +} diff --git a/src/openrct2/drawing/Rain.h b/src/openrct2/drawing/Rain.h index 552057ef5a..522213fd99 100644 --- a/src/openrct2/drawing/Rain.h +++ b/src/openrct2/drawing/Rain.h @@ -20,9 +20,9 @@ struct rct_drawpixelinfo; -namespace OpenRCT2 { namespace Drawing +namespace OpenRCT2::Drawing { interface IRainDrawer; -} } +} void DrawRain(rct_drawpixelinfo * dpi, OpenRCT2::Drawing::IRainDrawer * rainDrawer); diff --git a/src/openrct2/interface/Cursors.h b/src/openrct2/interface/Cursors.h index ea224fa043..e9bf8211c8 100644 --- a/src/openrct2/interface/Cursors.h +++ b/src/openrct2/interface/Cursors.h @@ -51,7 +51,7 @@ enum CURSOR_ID CURSOR_COUNT, }; -namespace OpenRCT2 { namespace Ui +namespace OpenRCT2::Ui { constexpr size_t CURSOR_BIT_WIDTH = 32; constexpr size_t CURSOR_HEIGHT = 4; @@ -65,4 +65,4 @@ namespace OpenRCT2 { namespace Ui uint8 Data[CURSOR_BIT_WIDTH * CURSOR_HEIGHT]; uint8 Mask[CURSOR_BIT_WIDTH * CURSOR_HEIGHT]; }; -} } +} diff --git a/src/openrct2/ui/DummyUiContext.cpp b/src/openrct2/ui/DummyUiContext.cpp index 801b426b48..9d0d844765 100644 --- a/src/openrct2/ui/DummyUiContext.cpp +++ b/src/openrct2/ui/DummyUiContext.cpp @@ -20,7 +20,7 @@ using namespace OpenRCT2::Drawing; -namespace OpenRCT2 { namespace Ui +namespace OpenRCT2::Ui { /** * Represents the window or screen that OpenRCT2 is presented on. @@ -96,4 +96,4 @@ namespace OpenRCT2 { namespace Ui { return new DummyUiContext(); } -} } +} diff --git a/src/openrct2/ui/DummyWindowManager.cpp b/src/openrct2/ui/DummyWindowManager.cpp index 924e944765..661f56f489 100644 --- a/src/openrct2/ui/DummyWindowManager.cpp +++ b/src/openrct2/ui/DummyWindowManager.cpp @@ -16,7 +16,7 @@ #include "WindowManager.h" -namespace OpenRCT2 { namespace Ui +namespace OpenRCT2::Ui { class DummyWindowManager final : public IWindowManager { @@ -38,4 +38,4 @@ namespace OpenRCT2 { namespace Ui { return new DummyWindowManager(); } -} } +} diff --git a/src/openrct2/ui/WindowManager.h b/src/openrct2/ui/WindowManager.h index ab4f3b18a2..edbb154087 100644 --- a/src/openrct2/ui/WindowManager.h +++ b/src/openrct2/ui/WindowManager.h @@ -22,30 +22,27 @@ #include "../interface/Window.h" -namespace OpenRCT2 +namespace OpenRCT2::Ui { - namespace Ui + /** + * Manager of in-game windows and widgets. + */ + interface IWindowManager { - /** - * Manager of in-game windows and widgets. - */ - interface IWindowManager - { - virtual ~IWindowManager() = default; - virtual void Init() abstract; - virtual rct_window * OpenWindow(rct_windowclass wc) abstract; - virtual rct_window * OpenView(uint8 view) abstract; - virtual rct_window * OpenDetails(uint8 type, sint32 id) abstract; - virtual rct_window * OpenIntent(Intent * intent) abstract; - virtual void BroadcastIntent(const Intent &intent) abstract; - virtual rct_window * ShowError(rct_string_id title, rct_string_id message) abstract; - virtual void ForceClose(rct_windowclass windowClass) abstract; - virtual void UpdateMapTooltip() abstract; - virtual void HandleInput() abstract; - virtual void HandleKeyboard(bool isTitle) abstract; - virtual std::string GetKeyboardShortcutString(sint32 shortcut) abstract; - }; + virtual ~IWindowManager() = default; + virtual void Init() abstract; + virtual rct_window * OpenWindow(rct_windowclass wc) abstract; + virtual rct_window * OpenView(uint8 view) abstract; + virtual rct_window * OpenDetails(uint8 type, sint32 id) abstract; + virtual rct_window * OpenIntent(Intent * intent) abstract; + virtual void BroadcastIntent(const Intent &intent) abstract; + virtual rct_window * ShowError(rct_string_id title, rct_string_id message) abstract; + virtual void ForceClose(rct_windowclass windowClass) abstract; + virtual void UpdateMapTooltip() abstract; + virtual void HandleInput() abstract; + virtual void HandleKeyboard(bool isTitle) abstract; + virtual std::string GetKeyboardShortcutString(sint32 shortcut) abstract; + }; - IWindowManager * CreateDummyWindowManager(); - } + IWindowManager * CreateDummyWindowManager(); }