mirror of
https://github.com/SFML/CSFML.git
synced 2026-10-26 05:06:12 +01:00
Added functions to set the title of sfWindow/sfRenderWindow with a UTF-32 string
This commit is contained in:
1 parent
2ec849d7b9
commit
85db0634e5
4 files changed
+116
No files matched your search
@@ -53,6 +53,17 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfRenderWindow* sfRenderWindow_create(sfVideoMode mode, const char* title, sfUint32 style, const sfContextSettings* settings);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Construct a new render window (with a UTF-32 title)
|
||||
///
|
||||
/// \param mode Video mode to use
|
||||
/// \param title Title of the window (UTF-32)
|
||||
/// \param style Window style
|
||||
/// \param settings Creation settings (pass NULL to use default values)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfRenderWindow* sfRenderWindow_createUnicode(sfVideoMode mode, const sfUint32* title, sfUint32 style, const sfContextSettings* settings);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Construct a render window from an existing control
|
||||
///
|
||||
@@ -167,6 +178,15 @@ CSFML_GRAPHICS_API void sfRenderWindow_setSize(sfRenderWindow* renderWindow, sfV
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_setTitle(sfRenderWindow* renderWindow, const char* title);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change the title of a render window (with a UTF-32 string)
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
/// \param title New title
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_setUnicodeTitle(sfRenderWindow* renderWindow, const sfUint32* title);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change a render window's icon
|
||||
///
|
||||
|
||||
@@ -88,6 +88,29 @@ typedef struct
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_WINDOW_API sfWindow* sfWindow_create(sfVideoMode mode, const char* title, sfUint32 style, const sfContextSettings* settings);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Construct a new window (with a UTF-32 title)
|
||||
///
|
||||
/// This function creates the window with the size and pixel
|
||||
/// depth defined in \a mode. An optional style can be passed to
|
||||
/// customize the look and behaviour of the window (borders,
|
||||
/// title bar, resizable, closable, ...). If \a style contains
|
||||
/// sfFullscreen, then \a mode must be a valid video mode.
|
||||
///
|
||||
/// The fourth parameter is a pointer to a structure specifying
|
||||
/// advanced OpenGL context settings such as antialiasing,
|
||||
/// depth-buffer bits, etc.
|
||||
///
|
||||
/// \param mode Video mode to use (defines the width, height and depth of the rendering area of the window)
|
||||
/// \param title Title of the window (UTF-32)
|
||||
/// \param style Window style
|
||||
/// \param settings Additional settings for the underlying OpenGL context
|
||||
///
|
||||
/// \return A new sfWindow object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_WINDOW_API sfWindow* sfWindow_createUnicode(sfVideoMode mode, const sfUint32* title, sfUint32 style, const sfContextSettings* settings);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Construct a window from an existing control
|
||||
///
|
||||
@@ -247,6 +270,15 @@ CSFML_WINDOW_API void sfWindow_setSize(sfWindow* window, sfVector2u size);
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_WINDOW_API void sfWindow_setTitle(sfWindow* window, const char* title);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change the title of a window (with a UTF-32 string)
|
||||
///
|
||||
/// \param window Window object
|
||||
/// \param title New title
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_WINDOW_API void sfWindow_setUnicodeTitle(sfWindow* window, const sfUint32* title);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change a window's icon
|
||||
///
|
||||
|
||||
@@ -66,6 +66,32 @@ sfRenderWindow* sfRenderWindow_create(sfVideoMode mode, const char* title, sfUin
|
||||
return renderWindow;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
sfRenderWindow* sfRenderWindow_createUnicode(sfVideoMode mode, const sfUint32* title, sfUint32 style, const sfContextSettings* settings)
|
||||
{
|
||||
// Convert video mode
|
||||
sf::VideoMode videoMode(mode.width, mode.height, mode.bitsPerPixel);
|
||||
|
||||
// Convert context settings
|
||||
sf::ContextSettings params;
|
||||
if (settings)
|
||||
{
|
||||
params.depthBits = settings->depthBits;
|
||||
params.stencilBits = settings->stencilBits;
|
||||
params.antialiasingLevel = settings->antialiasingLevel;
|
||||
params.majorVersion = settings->majorVersion;
|
||||
params.minorVersion = settings->minorVersion;
|
||||
}
|
||||
|
||||
// Create the window
|
||||
sfRenderWindow* renderWindow = new sfRenderWindow;
|
||||
renderWindow->This.create(videoMode, title, style, params);
|
||||
renderWindow->DefaultView.This = renderWindow->This.getDefaultView();
|
||||
renderWindow->CurrentView.This = renderWindow->This.getView();
|
||||
|
||||
return renderWindow;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
sfRenderWindow* sfRenderWindow_createFromHandle(sfWindowHandle handle, const sfContextSettings* settings)
|
||||
@@ -220,6 +246,13 @@ void sfRenderWindow_setTitle(sfRenderWindow* renderWindow, const char* title)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfRenderWindow_setUnicodeTitle(sfRenderWindow* renderWindow, const sfUint32* title)
|
||||
{
|
||||
CSFML_CALL(renderWindow, setTitle(title));
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfRenderWindow_setIcon(sfRenderWindow* renderWindow, unsigned int width, unsigned int height, const sfUint8* pixels)
|
||||
{
|
||||
|
||||
@@ -55,6 +55,30 @@ sfWindow* sfWindow_create(sfVideoMode mode, const char* title, sfUint32 style, c
|
||||
return window;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
sfWindow* sfWindow_createUnicode(sfVideoMode mode, const sfUint32* title, sfUint32 style, const sfContextSettings* settings)
|
||||
{
|
||||
// Convert video mode
|
||||
sf::VideoMode videoMode(mode.width, mode.height, mode.bitsPerPixel);
|
||||
|
||||
// Convert context settings
|
||||
sf::ContextSettings params;
|
||||
if (settings)
|
||||
{
|
||||
params.depthBits = settings->depthBits;
|
||||
params.stencilBits = settings->stencilBits;
|
||||
params.antialiasingLevel = settings->antialiasingLevel;
|
||||
params.majorVersion = settings->majorVersion;
|
||||
params.minorVersion = settings->minorVersion;
|
||||
}
|
||||
|
||||
// Create the window
|
||||
sfWindow* window = new sfWindow;
|
||||
window->This.create(videoMode, title, style, params);
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
sfWindow* sfWindow_createFromHandle(sfWindowHandle handle, const sfContextSettings* settings)
|
||||
@@ -206,6 +230,13 @@ void sfWindow_setTitle(sfWindow* window, const char* title)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfWindow_setUnicodeTitle(sfWindow* window, const sfUint32* title)
|
||||
{
|
||||
CSFML_CALL(window, setTitle(title));
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfWindow_setIcon(sfWindow* window, unsigned int width, unsigned int height, const sfUint8* pixels)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user