mirror of
https://github.com/SFML/SFML.git
synced 2024-11-28 22:31:09 +08:00
Allow setting window icon with sf::Image
This commit is contained in:
parent
698b7ee49f
commit
474de4d16e
@ -35,6 +35,8 @@
|
||||
|
||||
namespace sf
|
||||
{
|
||||
class Image;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Window that can serve as a target for 2D drawing
|
||||
///
|
||||
@ -112,6 +114,18 @@ public:
|
||||
////////////////////////////////////////////////////////////
|
||||
Vector2u getSize() const override;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change the window's icon
|
||||
///
|
||||
/// The OS default icon is used by default.
|
||||
///
|
||||
/// \param icon Image to use as the icon. The image is copied,
|
||||
/// so you need not keep the source alive after
|
||||
/// calling this function.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void setIcon(const Image& icon);
|
||||
using Window::setIcon;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Tell if the window will use sRGB encoding when drawing on it
|
||||
|
@ -26,6 +26,7 @@
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Graphics/GLCheck.hpp>
|
||||
#include <SFML/Graphics/Image.hpp>
|
||||
#include <SFML/Graphics/RenderTextureImplFBO.hpp>
|
||||
#include <SFML/Graphics/RenderWindow.hpp>
|
||||
#include <SFML/Graphics/Texture.hpp>
|
||||
@ -65,6 +66,13 @@ Vector2u RenderWindow::getSize() const
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
void RenderWindow::setIcon(const Image& icon)
|
||||
{
|
||||
setIcon(icon.getSize(), icon.getPixelsPtr());
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
bool RenderWindow::isSrgb() const
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user