diff --git a/SDL2pp/Window.cc b/SDL2pp/Window.cc index 98e5c1a..9f77d7c 100644 --- a/SDL2pp/Window.cc +++ b/SDL2pp/Window.cc @@ -22,6 +22,7 @@ #include #include +#include #include namespace SDL2pp { @@ -213,4 +214,9 @@ Uint32 Window::GetFlags() const { return SDL_GetWindowFlags(window_); } +Window& Window::SetIcon(const Surface& icon) { + SDL_SetWindowIcon(window_, icon.Get()); + return *this; +} + } diff --git a/SDL2pp/Window.hh b/SDL2pp/Window.hh index 8ddb5d8..7506920 100644 --- a/SDL2pp/Window.hh +++ b/SDL2pp/Window.hh @@ -33,6 +33,8 @@ struct SDL_Window; namespace SDL2pp { +class Surface; + //////////////////////////////////////////////////////////// /// \brief GUI window object /// @@ -474,6 +476,18 @@ public: /// //////////////////////////////////////////////////////////// Uint32 GetFlags() const; + + //////////////////////////////////////////////////////////// + /// \brief Set the icon for a window + /// + /// \param[in] icon Surface containing the icon for the window + /// + /// \see http://wiki.libsdl.org/SDL_SetWindowIcon + /// + /// Icon surface may be destroyed after calling this function + /// + //////////////////////////////////////////////////////////// + Window& SetIcon(const Surface& icon); }; }