From d979ca254e546aa57a4151f37eef60ed8fd3f07b Mon Sep 17 00:00:00 2001 From: LaurentGom Date: Thu, 26 Nov 2009 20:09:57 +0000 Subject: [PATCH] Fixed linker errors in sfml-network and csfml-network Made every read-only pointer "const" in CSFML git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1290 4e206d99-4929-0410-ac5d-dfc041789085 --- CSFML/build/VC2005/csfml-network.vcproj | 4 +- CSFML/build/VC2008/csfml-network.vcproj | 4 +- CSFML/include/SFML/Audio/Music.h | 24 ++++----- CSFML/include/SFML/Audio/Sound.h | 22 ++++---- CSFML/include/SFML/Audio/SoundBuffer.h | 12 ++--- .../include/SFML/Audio/SoundBufferRecorder.h | 4 +- CSFML/include/SFML/Audio/SoundRecorder.h | 2 +- CSFML/include/SFML/Audio/SoundStream.h | 22 ++++---- CSFML/include/SFML/Graphics/Font.h | 4 +- CSFML/include/SFML/Graphics/Image.h | 16 +++--- CSFML/include/SFML/Graphics/Rect.h | 8 +-- CSFML/include/SFML/Graphics/RenderImage.h | 26 +++++----- CSFML/include/SFML/Graphics/RenderWindow.h | 38 +++++++------- CSFML/include/SFML/Graphics/Shader.h | 8 +-- CSFML/include/SFML/Graphics/Shape.h | 32 ++++++------ CSFML/include/SFML/Graphics/Sprite.h | 34 ++++++------- CSFML/include/SFML/Graphics/Text.h | 38 +++++++------- CSFML/include/SFML/Graphics/View.h | 12 ++--- CSFML/include/SFML/Network/Ftp.h | 24 ++++----- CSFML/include/SFML/Network/Http.h | 12 ++--- CSFML/include/SFML/Network/Packet.h | 10 ++-- CSFML/include/SFML/Network/Selector.h | 4 +- CSFML/include/SFML/Network/SocketTCP.h | 2 +- CSFML/include/SFML/System/Clock.h | 2 +- CSFML/include/SFML/Window/Input.h | 12 ++--- CSFML/include/SFML/Window/Window.h | 18 +++---- CSFML/src/SFML/Audio/Music.cpp | 26 +++++----- CSFML/src/SFML/Audio/Sound.cpp | 22 ++++---- CSFML/src/SFML/Audio/SoundBuffer.cpp | 12 ++--- CSFML/src/SFML/Audio/SoundBufferRecorder.cpp | 4 +- .../SFML/Audio/SoundBufferRecorderStruct.h | 2 +- CSFML/src/SFML/Audio/SoundRecorder.cpp | 2 +- CSFML/src/SFML/Audio/SoundStream.cpp | 22 ++++---- CSFML/src/SFML/Audio/SoundStruct.h | 4 +- CSFML/src/SFML/Graphics/Font.cpp | 4 +- CSFML/src/SFML/Graphics/Image.cpp | 16 +++--- CSFML/src/SFML/Graphics/Rect.cpp | 8 +-- CSFML/src/SFML/Graphics/RenderImage.cpp | 26 +++++----- CSFML/src/SFML/Graphics/RenderImageStruct.h | 4 +- CSFML/src/SFML/Graphics/RenderWindow.cpp | 38 +++++++------- CSFML/src/SFML/Graphics/RenderWindowStruct.h | 2 +- CSFML/src/SFML/Graphics/Shader.cpp | 6 +-- CSFML/src/SFML/Graphics/Shape.cpp | 32 ++++++------ CSFML/src/SFML/Graphics/Sprite.cpp | 34 ++++++------- CSFML/src/SFML/Graphics/SpriteStruct.h | 6 +-- CSFML/src/SFML/Graphics/Text.cpp | 38 +++++++------- CSFML/src/SFML/Graphics/TextStruct.h | 8 +-- CSFML/src/SFML/Graphics/View.cpp | 12 ++--- CSFML/src/SFML/Network/Ftp.cpp | 24 ++++----- CSFML/src/SFML/Network/Http.cpp | 12 ++--- CSFML/src/SFML/Network/Packet.cpp | 10 ++-- CSFML/src/SFML/Network/Selector.cpp | 8 +-- CSFML/src/SFML/Network/SocketTCP.cpp | 2 +- CSFML/src/SFML/Network/SocketUDP.cpp | 8 ++- CSFML/src/SFML/System/Clock.cpp | 2 +- CSFML/src/SFML/Window/Window.cpp | 18 +++---- build/codeblocks/sfml-network.cbp | 2 + build/vc2005/SFML.sln | 51 ++++++++++--------- include/SFML/Network/Selector.hpp | 2 +- include/SFML/Network/Selector.inl | 2 +- include/SFML/Network/SelectorBase.hpp | 2 +- src/SFML/Network/SelectorBase.cpp | 2 +- 62 files changed, 438 insertions(+), 429 deletions(-) diff --git a/CSFML/build/VC2005/csfml-network.vcproj b/CSFML/build/VC2005/csfml-network.vcproj index 0f30288f..4e408ef6 100644 --- a/CSFML/build/VC2005/csfml-network.vcproj +++ b/CSFML/build/VC2005/csfml-network.vcproj @@ -64,7 +64,7 @@ /> Left, rect->Top, rect->Right, rect->Bottom).Contains(x, y); } -sfBool sfIntRect_Contains(sfIntRect* rect, int x, int y) +sfBool sfIntRect_Contains(const sfIntRect* rect, int x, int y) { CSFML_CHECK_RETURN(rect, sfFalse) return sf::IntRect(rect->Left, rect->Top, rect->Right, rect->Bottom).Contains(x, y); @@ -69,7 +69,7 @@ sfBool sfIntRect_Contains(sfIntRect* rect, int x, int y) //////////////////////////////////////////////////////////// /// Check intersection between two rectangles //////////////////////////////////////////////////////////// -sfBool sfFloatRect_Intersects(sfFloatRect* rect1, sfFloatRect* rect2, sfFloatRect* intersection) +sfBool sfFloatRect_Intersects(const sfFloatRect* rect1, const sfFloatRect* rect2, sfFloatRect* intersection) { CSFML_CHECK_RETURN(rect1, sfFalse) CSFML_CHECK_RETURN(rect2, sfFalse) @@ -94,7 +94,7 @@ sfBool sfFloatRect_Intersects(sfFloatRect* rect1, sfFloatRect* rect2, sfFloatRec return SFMLRect1.Intersects(SFMLRect2); } } -sfBool sfIntRect_Intersects(sfIntRect* rect1, sfIntRect* rect2, sfIntRect* intersection) +sfBool sfIntRect_Intersects(const sfIntRect* rect1, const sfIntRect* rect2, sfIntRect* intersection) { CSFML_CHECK_RETURN(rect1, sfFalse) CSFML_CHECK_RETURN(rect2, sfFalse) diff --git a/CSFML/src/SFML/Graphics/RenderImage.cpp b/CSFML/src/SFML/Graphics/RenderImage.cpp index a8b8d55c..ce586143 100644 --- a/CSFML/src/SFML/Graphics/RenderImage.cpp +++ b/CSFML/src/SFML/Graphics/RenderImage.cpp @@ -63,7 +63,7 @@ void sfRenderImage_Destroy(sfRenderImage* renderImage) //////////////////////////////////////////////////////////// /// Get the width of the rendering region of a renderimage //////////////////////////////////////////////////////////// -unsigned int sfRenderImage_GetWidth(sfRenderImage* renderImage) +unsigned int sfRenderImage_GetWidth(const sfRenderImage* renderImage) { CSFML_CALL_RETURN(renderImage, GetWidth(), 0); } @@ -72,7 +72,7 @@ unsigned int sfRenderImage_GetWidth(sfRenderImage* renderImage) //////////////////////////////////////////////////////////// /// Get the height of the rendering region of a renderimage //////////////////////////////////////////////////////////// -unsigned int sfRenderImage_GetHeight(sfRenderImage* renderImage) +unsigned int sfRenderImage_GetHeight(const sfRenderImage* renderImage) { CSFML_CALL_RETURN(renderImage, GetHeight(), 0); } @@ -118,17 +118,17 @@ void sfRenderImage_Display(sfRenderImage* renderImage) //////////////////////////////////////////////////////////// /// Draw something on a renderimage //////////////////////////////////////////////////////////// -void sfRenderImage_DrawSprite(sfRenderImage* renderImage, sfSprite* sprite) +void sfRenderImage_DrawSprite(sfRenderImage* renderImage, const sfSprite* sprite) { CSFML_CHECK(sprite); CSFML_CALL(renderImage, Draw(sprite->This)); } -void sfRenderImage_DrawShape(sfRenderImage* renderImage, sfShape* shape) +void sfRenderImage_DrawShape(sfRenderImage* renderImage, const sfShape* shape) { CSFML_CHECK(shape); CSFML_CALL(renderImage, Draw(shape->This)); } -void sfRenderImage_DrawText(sfRenderImage* renderImage, sfText* text) +void sfRenderImage_DrawText(sfRenderImage* renderImage, const sfText* text) { CSFML_CHECK(text); CSFML_CALL(renderImage, Draw(text->This)); @@ -138,19 +138,19 @@ void sfRenderImage_DrawText(sfRenderImage* renderImage, sfText* text) //////////////////////////////////////////////////////////// /// Draw something on a renderimage with a shader //////////////////////////////////////////////////////////// -void sfRenderImage_DrawSpriteWithShader(sfRenderImage* renderImage, sfSprite* sprite, sfShader* shader) +void sfRenderImage_DrawSpriteWithShader(sfRenderImage* renderImage, const sfSprite* sprite, const sfShader* shader) { CSFML_CHECK(sprite); CSFML_CHECK(shader); CSFML_CALL(renderImage, Draw(sprite->This, shader->This)); } -void sfRenderImage_DrawShapeWithShader(sfRenderImage* renderImage, sfShape* shape, sfShader* shader) +void sfRenderImage_DrawShapeWithShader(sfRenderImage* renderImage, const sfShape* shape, const sfShader* shader) { CSFML_CHECK(shape); CSFML_CHECK(shader); CSFML_CALL(renderImage, Draw(shape->This, shader->This)); } -void sfRenderImage_DrawTextWithShader(sfRenderImage* renderImage, sfText* text, sfShader* shader) +void sfRenderImage_DrawTextWithShader(sfRenderImage* renderImage, const sfText* text, const sfShader* shader) { CSFML_CHECK(text); CSFML_CHECK(shader); @@ -172,7 +172,7 @@ void sfRenderImage_Clear(sfRenderImage* renderImage, sfColor color) //////////////////////////////////////////////////////////// /// Change the current active view of a renderimage //////////////////////////////////////////////////////////// -void sfRenderImage_SetView(sfRenderImage* renderImage, sfView* view) +void sfRenderImage_SetView(sfRenderImage* renderImage, const sfView* view) { CSFML_CHECK(view); CSFML_CALL(renderImage, SetView(*view->This)); @@ -183,7 +183,7 @@ void sfRenderImage_SetView(sfRenderImage* renderImage, sfView* view) //////////////////////////////////////////////////////////// /// Get the current active view of a renderimage //////////////////////////////////////////////////////////// -const sfView* sfRenderImage_GetView(sfRenderImage* renderImage) +const sfView* sfRenderImage_GetView(const sfRenderImage* renderImage) { CSFML_CHECK_RETURN(renderImage, NULL); @@ -205,7 +205,7 @@ sfView* sfRenderImage_GetDefaultView(sfRenderImage* renderImage) //////////////////////////////////////////////////////////// /// Get the viewport of a view applied to this target //////////////////////////////////////////////////////////// -sfIntRect sfRenderImage_GetViewport(sfRenderImage* renderImage, sfView* view) +sfIntRect sfRenderImage_GetViewport(const sfRenderImage* renderImage, const sfView* view) { sfIntRect rect = {0, 0, 0, 0}; CSFML_CHECK_RETURN(view, rect); @@ -224,7 +224,7 @@ sfIntRect sfRenderImage_GetViewport(sfRenderImage* renderImage, sfView* view) //////////////////////////////////////////////////////////// /// Convert a point in image coordinates into view coordinates //////////////////////////////////////////////////////////// -void sfRenderImage_ConvertCoords(sfRenderImage* renderImage, unsigned int imageX, unsigned int imageY, float* viewX, float* viewY, sfView* targetView) +void sfRenderImage_ConvertCoords(const sfRenderImage* renderImage, unsigned int imageX, unsigned int imageY, float* viewX, float* viewY, const sfView* targetView) { CSFML_CHECK(renderImage); @@ -242,7 +242,7 @@ void sfRenderImage_ConvertCoords(sfRenderImage* renderImage, unsigned int imageX //////////////////////////////////////////////////////////// /// Get the target image //////////////////////////////////////////////////////////// -sfImage* sfRenderImage_GetImage(sfRenderImage* renderImage) +const sfImage* sfRenderImage_GetImage(const sfRenderImage* renderImage) { CSFML_CHECK_RETURN(renderImage, NULL); diff --git a/CSFML/src/SFML/Graphics/RenderImageStruct.h b/CSFML/src/SFML/Graphics/RenderImageStruct.h index 0c9f5c8f..1341fd81 100644 --- a/CSFML/src/SFML/Graphics/RenderImageStruct.h +++ b/CSFML/src/SFML/Graphics/RenderImageStruct.h @@ -40,9 +40,9 @@ struct sfRenderImage { sf::RenderImage This; - sfImage* Target; + const sfImage* Target; sfView* DefaultView; - sfView* CurrentView; + const sfView* CurrentView; }; diff --git a/CSFML/src/SFML/Graphics/RenderWindow.cpp b/CSFML/src/SFML/Graphics/RenderWindow.cpp index f10798bd..a72885d5 100644 --- a/CSFML/src/SFML/Graphics/RenderWindow.cpp +++ b/CSFML/src/SFML/Graphics/RenderWindow.cpp @@ -39,7 +39,7 @@ //////////////////////////////////////////////////////////// /// Construct a new renderwindow //////////////////////////////////////////////////////////// -sfRenderWindow* sfRenderWindow_Create(sfVideoMode mode, const char* title, unsigned long style, sfContextSettings* settings) +sfRenderWindow* sfRenderWindow_Create(sfVideoMode mode, const char* title, unsigned long style, const sfContextSettings* settings) { // Convert video mode sf::VideoMode videoMode(mode.Width, mode.Height, mode.BitsPerPixel); @@ -69,7 +69,7 @@ sfRenderWindow* sfRenderWindow_Create(sfVideoMode mode, const char* title, unsig //////////////////////////////////////////////////////////// /// Construct a renderwindow from an existing control //////////////////////////////////////////////////////////// -sfRenderWindow* sfRenderWindow_CreateFromHandle(sfWindowHandle handle, sfContextSettings* settings) +sfRenderWindow* sfRenderWindow_CreateFromHandle(sfWindowHandle handle, const sfContextSettings* settings) { // Convert context settings sf::ContextSettings params; @@ -114,7 +114,7 @@ void sfRenderWindow_Close(sfRenderWindow* renderWindow) //////////////////////////////////////////////////////////// /// Tell whether or not a renderwindow is opened //////////////////////////////////////////////////////////// -sfBool sfRenderWindow_IsOpened(sfRenderWindow* renderWindow) +sfBool sfRenderWindow_IsOpened(const sfRenderWindow* renderWindow) { CSFML_CALL_RETURN(renderWindow, IsOpened(), sfFalse); } @@ -123,7 +123,7 @@ sfBool sfRenderWindow_IsOpened(sfRenderWindow* renderWindow) //////////////////////////////////////////////////////////// /// Get the width of the rendering region of a window //////////////////////////////////////////////////////////// -unsigned int sfRenderWindow_GetWidth(sfRenderWindow* renderWindow) +unsigned int sfRenderWindow_GetWidth(const sfRenderWindow* renderWindow) { CSFML_CALL_RETURN(renderWindow, GetWidth(), 0); } @@ -132,7 +132,7 @@ unsigned int sfRenderWindow_GetWidth(sfRenderWindow* renderWindow) //////////////////////////////////////////////////////////// /// Get the height of the rendering region of a window //////////////////////////////////////////////////////////// -unsigned int sfRenderWindow_GetHeight(sfRenderWindow* renderWindow) +unsigned int sfRenderWindow_GetHeight(const sfRenderWindow* renderWindow) { CSFML_CALL_RETURN(renderWindow, GetHeight(), 0); } @@ -141,7 +141,7 @@ unsigned int sfRenderWindow_GetHeight(sfRenderWindow* renderWindow) //////////////////////////////////////////////////////////// /// Get the creation settings of a window //////////////////////////////////////////////////////////// -sfContextSettings sfRenderWindow_GetSettings(sfRenderWindow* renderWindow) +sfContextSettings sfRenderWindow_GetSettings(const sfRenderWindow* renderWindow) { sfContextSettings settings = {0, 0, 0}; CSFML_CHECK_RETURN(renderWindow, settings); @@ -270,7 +270,7 @@ void sfRenderWindow_EnableKeyRepeat(sfRenderWindow* renderWindow, sfBool enabled //////////////////////////////////////////////////////////// /// Change the window's icon //////////////////////////////////////////////////////////// -void sfRenderWindow_SetIcon(sfRenderWindow* renderWindow, unsigned int width, unsigned int height, sfUint8* pixels) +void sfRenderWindow_SetIcon(sfRenderWindow* renderWindow, unsigned int width, unsigned int height, const sfUint8* pixels) { CSFML_CALL(renderWindow, SetIcon(width, height, pixels)) } @@ -317,7 +317,7 @@ void sfRenderWindow_Display(sfRenderWindow* renderWindow) //////////////////////////////////////////////////////////// /// Get the input manager of a window //////////////////////////////////////////////////////////// -sfInput* sfRenderWindow_GetInput(sfRenderWindow* renderWindow) +const sfInput* sfRenderWindow_GetInput(const sfRenderWindow* renderWindow) { CSFML_CHECK_RETURN(renderWindow, NULL); @@ -337,7 +337,7 @@ void sfRenderWindow_SetFramerateLimit(sfRenderWindow* renderWindow, unsigned int //////////////////////////////////////////////////////////// /// Get time elapsed since last frame of a window //////////////////////////////////////////////////////////// -float sfRenderWindow_GetFrameTime(sfRenderWindow* renderWindow) +float sfRenderWindow_GetFrameTime(const sfRenderWindow* renderWindow) { CSFML_CALL_RETURN(renderWindow, GetFrameTime(), 0.f); } @@ -356,17 +356,17 @@ void sfRenderWindow_SetJoystickThreshold(sfRenderWindow* renderWindow, float thr //////////////////////////////////////////////////////////// /// Draw something on a renderwindow //////////////////////////////////////////////////////////// -void sfRenderWindow_DrawSprite(sfRenderWindow* renderWindow, sfSprite* sprite) +void sfRenderWindow_DrawSprite(sfRenderWindow* renderWindow, const sfSprite* sprite) { CSFML_CHECK(sprite); CSFML_CALL(renderWindow, Draw(sprite->This)); } -void sfRenderWindow_DrawShape(sfRenderWindow* renderWindow, sfShape* shape) +void sfRenderWindow_DrawShape(sfRenderWindow* renderWindow, const sfShape* shape) { CSFML_CHECK(shape); CSFML_CALL(renderWindow, Draw(shape->This)); } -void sfRenderWindow_DrawText(sfRenderWindow* renderWindow, sfText* text) +void sfRenderWindow_DrawText(sfRenderWindow* renderWindow, const sfText* text) { CSFML_CHECK(text); CSFML_CALL(renderWindow, Draw(text->This)); @@ -376,19 +376,19 @@ void sfRenderWindow_DrawText(sfRenderWindow* renderWindow, sfText* text) //////////////////////////////////////////////////////////// /// Draw something on a renderwindow with a shader //////////////////////////////////////////////////////////// -void sfRenderWindow_DrawSpriteWithShader(sfRenderWindow* renderWindow, sfSprite* sprite, sfShader* shader) +void sfRenderWindow_DrawSpriteWithShader(sfRenderWindow* renderWindow, const sfSprite* sprite, const sfShader* shader) { CSFML_CHECK(sprite); CSFML_CHECK(shader); CSFML_CALL(renderWindow, Draw(sprite->This, shader->This)); } -void sfRenderWindow_DrawShapeWithShader(sfRenderWindow* renderWindow, sfShape* shape, sfShader* shader) +void sfRenderWindow_DrawShapeWithShader(sfRenderWindow* renderWindow, const sfShape* shape, const sfShader* shader) { CSFML_CHECK(shape); CSFML_CHECK(shader); CSFML_CALL(renderWindow, Draw(shape->This, shader->This)); } -void sfRenderWindow_DrawTextWithShader(sfRenderWindow* renderWindow, sfText* text, sfShader* shader) +void sfRenderWindow_DrawTextWithShader(sfRenderWindow* renderWindow, const sfText* text, const sfShader* shader) { CSFML_CHECK(text); CSFML_CHECK(shader); @@ -410,7 +410,7 @@ void sfRenderWindow_Clear(sfRenderWindow* renderWindow, sfColor color) //////////////////////////////////////////////////////////// /// Change the current active view of a renderwindow //////////////////////////////////////////////////////////// -void sfRenderWindow_SetView(sfRenderWindow* renderWindow, sfView* view) +void sfRenderWindow_SetView(sfRenderWindow* renderWindow, const sfView* view) { CSFML_CHECK(view); CSFML_CALL(renderWindow, SetView(*view->This)); @@ -421,7 +421,7 @@ void sfRenderWindow_SetView(sfRenderWindow* renderWindow, sfView* view) //////////////////////////////////////////////////////////// /// Get the current active view of a renderwindow //////////////////////////////////////////////////////////// -const sfView* sfRenderWindow_GetView(sfRenderWindow* renderWindow) +const sfView* sfRenderWindow_GetView(const sfRenderWindow* renderWindow) { CSFML_CHECK_RETURN(renderWindow, NULL); @@ -443,7 +443,7 @@ sfView* sfRenderWindow_GetDefaultView(sfRenderWindow* renderWindow) //////////////////////////////////////////////////////////// /// Get the viewport of a view applied to this target //////////////////////////////////////////////////////////// -sfIntRect sfRenderWindow_GetViewport(sfRenderWindow* renderWindow, sfView* view) +sfIntRect sfRenderWindow_GetViewport(const sfRenderWindow* renderWindow, const sfView* view) { sfIntRect rect = {0, 0, 0, 0}; CSFML_CHECK_RETURN(view, rect); @@ -462,7 +462,7 @@ sfIntRect sfRenderWindow_GetViewport(sfRenderWindow* renderWindow, sfView* view) //////////////////////////////////////////////////////////// /// Convert a point in window coordinates into view coordinates //////////////////////////////////////////////////////////// -void sfRenderWindow_ConvertCoords(sfRenderWindow* renderWindow, unsigned int windowX, unsigned int windowY, float* viewX, float* viewY, sfView* targetView) +void sfRenderWindow_ConvertCoords(const sfRenderWindow* renderWindow, unsigned int windowX, unsigned int windowY, float* viewX, float* viewY, const sfView* targetView) { CSFML_CHECK(renderWindow); diff --git a/CSFML/src/SFML/Graphics/RenderWindowStruct.h b/CSFML/src/SFML/Graphics/RenderWindowStruct.h index 8c26fa54..f3b7c542 100644 --- a/CSFML/src/SFML/Graphics/RenderWindowStruct.h +++ b/CSFML/src/SFML/Graphics/RenderWindowStruct.h @@ -41,7 +41,7 @@ struct sfRenderWindow sf::RenderWindow This; sfInput Input; sfView* DefaultView; - sfView* CurrentView; + const sfView* CurrentView; }; diff --git a/CSFML/src/SFML/Graphics/Shader.cpp b/CSFML/src/SFML/Graphics/Shader.cpp index eec4a0ae..3ba8ed5c 100644 --- a/CSFML/src/SFML/Graphics/Shader.cpp +++ b/CSFML/src/SFML/Graphics/Shader.cpp @@ -113,7 +113,7 @@ void sfShader_SetParameter4(sfShader* shader, const char* name, float x, float y //////////////////////////////////////////////////////////// /// Set a texture parameter in a shader //////////////////////////////////////////////////////////// -void sfShader_SetTexture(sfShader* shader, const char* name, sfImage* texture) +void sfShader_SetTexture(sfShader* shader, const char* name, const sfImage* texture) { CSFML_CALL(shader, SetTexture(name, texture && texture->This ? *texture->This : sf::Shader::CurrentTexture)) } @@ -122,7 +122,7 @@ void sfShader_SetTexture(sfShader* shader, const char* name, sfImage* texture) //////////////////////////////////////////////////////////// /// Bind a shader for rendering //////////////////////////////////////////////////////////// -void sfShader_Bind(sfShader* shader) +void sfShader_Bind(const sfShader* shader) { CSFML_CALL(shader, Bind()) } @@ -131,7 +131,7 @@ void sfShader_Bind(sfShader* shader) //////////////////////////////////////////////////////////// /// Unbind a shader //////////////////////////////////////////////////////////// -void sfShader_Unbind(sfShader* shader) +void sfShader_Unbind(const sfShader* shader) { CSFML_CALL(shader, Unbind()) } diff --git a/CSFML/src/SFML/Graphics/Shape.cpp b/CSFML/src/SFML/Graphics/Shape.cpp index 2772030f..485bfe73 100644 --- a/CSFML/src/SFML/Graphics/Shape.cpp +++ b/CSFML/src/SFML/Graphics/Shape.cpp @@ -185,7 +185,7 @@ void sfShape_SetBlendMode(sfShape* shape, sfBlendMode mode) //////////////////////////////////////////////////////////// /// Get the X position of a shape //////////////////////////////////////////////////////////// -float sfShape_GetX(sfShape* shape) +float sfShape_GetX(const sfShape* shape) { CSFML_CALL_RETURN(shape, GetPosition().x, 0.f) } @@ -194,7 +194,7 @@ float sfShape_GetX(sfShape* shape) //////////////////////////////////////////////////////////// /// Get the Y position of a shape //////////////////////////////////////////////////////////// -float sfShape_GetY(sfShape* shape) +float sfShape_GetY(const sfShape* shape) { CSFML_CALL_RETURN(shape, GetPosition().y, 0.f) } @@ -203,7 +203,7 @@ float sfShape_GetY(sfShape* shape) //////////////////////////////////////////////////////////// /// Get the horizontal scale of a shape //////////////////////////////////////////////////////////// -float sfShape_GetScaleX(sfShape* shape) +float sfShape_GetScaleX(const sfShape* shape) { CSFML_CALL_RETURN(shape, GetScale().x, 0.f) } @@ -212,7 +212,7 @@ float sfShape_GetScaleX(sfShape* shape) //////////////////////////////////////////////////////////// /// Get the vertical scale of a shape //////////////////////////////////////////////////////////// -float sfShape_GetScaleY(sfShape* shape) +float sfShape_GetScaleY(const sfShape* shape) { CSFML_CALL_RETURN(shape, GetScale().y, 0.f) } @@ -221,7 +221,7 @@ float sfShape_GetScaleY(sfShape* shape) //////////////////////////////////////////////////////////// /// Get the orientation of a shape //////////////////////////////////////////////////////////// -float sfShape_GetRotation(sfShape* shape) +float sfShape_GetRotation(const sfShape* shape) { CSFML_CALL_RETURN(shape, GetRotation(), 0.f) } @@ -230,7 +230,7 @@ float sfShape_GetRotation(sfShape* shape) //////////////////////////////////////////////////////////// /// Get the X position of the origin a shape //////////////////////////////////////////////////////////// -float sfShape_GetOriginX(sfShape* shape) +float sfShape_GetOriginX(const sfShape* shape) { CSFML_CALL_RETURN(shape, GetOrigin().x, 0.f) } @@ -239,7 +239,7 @@ float sfShape_GetOriginX(sfShape* shape) //////////////////////////////////////////////////////////// /// Get the Y position of the origin a shape //////////////////////////////////////////////////////////// -float sfShape_GetOriginY(sfShape* shape) +float sfShape_GetOriginY(const sfShape* shape) { CSFML_CALL_RETURN(shape, GetOrigin().y, 0.f) } @@ -248,7 +248,7 @@ float sfShape_GetOriginY(sfShape* shape) //////////////////////////////////////////////////////////// /// Get the color of a shape //////////////////////////////////////////////////////////// -sfColor sfShape_GetColor(sfShape* shape) +sfColor sfShape_GetColor(const sfShape* shape) { sfColor color = {0, 0, 0, 0}; CSFML_CHECK_RETURN(shape, color) @@ -261,7 +261,7 @@ sfColor sfShape_GetColor(sfShape* shape) //////////////////////////////////////////////////////////// /// Get the current blending mode of a shape //////////////////////////////////////////////////////////// -sfBlendMode sfShape_GetBlendMode(sfShape* shape) +sfBlendMode sfShape_GetBlendMode(const sfShape* shape) { CSFML_CHECK_RETURN(shape, sfBlendNone) @@ -300,7 +300,7 @@ void sfShape_Rotate(sfShape* shape, float angle) /// Transform a point from global coordinates into the shape's local coordinates /// (ie it applies the inverse of object's origin, translation, rotation and scale to the point) //////////////////////////////////////////////////////////// -void sfShape_TransformToLocal(sfShape* shape, float pointX, float pointY, float* x, float* y) +void sfShape_TransformToLocal(const sfShape* shape, float pointX, float pointY, float* x, float* y) { CSFML_CHECK(shape) @@ -314,7 +314,7 @@ void sfShape_TransformToLocal(sfShape* shape, float pointX, float pointY, float* /// Transform a point from the shape's local coordinates into global coordinates /// (ie it applies the object's origin, translation, rotation and scale to the point) //////////////////////////////////////////////////////////// -void sfShape_TransformToGlobal(sfShape* shape, float pointX, float pointY, float* x, float* y) +void sfShape_TransformToGlobal(const sfShape* shape, float pointX, float pointY, float* x, float* y) { CSFML_CHECK(shape) @@ -368,7 +368,7 @@ void sfShape_SetOutlineWidth(sfShape* shape, float width) //////////////////////////////////////////////////////////// /// Get the width of a shape outline //////////////////////////////////////////////////////////// -float sfShape_GetOutlineWidth(sfShape* shape) +float sfShape_GetOutlineWidth(const sfShape* shape) { CSFML_CALL_RETURN(shape, GetOutlineWidth(), 0.f) } @@ -377,7 +377,7 @@ float sfShape_GetOutlineWidth(sfShape* shape) //////////////////////////////////////////////////////////// /// Get the number of points composing a shape //////////////////////////////////////////////////////////// -unsigned int sfShape_GetNbPoints(sfShape* shape) +unsigned int sfShape_GetNbPoints(const sfShape* shape) { CSFML_CALL_RETURN(shape, GetNbPoints(), 0) } @@ -386,7 +386,7 @@ unsigned int sfShape_GetNbPoints(sfShape* shape) //////////////////////////////////////////////////////////// /// Get a point of a shape //////////////////////////////////////////////////////////// -void sfShape_GetPointPosition(sfShape* shape, unsigned int index, float* x, float* y) +void sfShape_GetPointPosition(const sfShape* shape, unsigned int index, float* x, float* y) { CSFML_CHECK(shape) @@ -399,7 +399,7 @@ void sfShape_GetPointPosition(sfShape* shape, unsigned int index, float* x, floa //////////////////////////////////////////////////////////// /// Get a the color of a shape's point //////////////////////////////////////////////////////////// -sfColor sfShape_GetPointColor(sfShape* shape, unsigned int index) +sfColor sfShape_GetPointColor(const sfShape* shape, unsigned int index) { sfColor color = {255, 255, 255, 255}; CSFML_CHECK_RETURN(shape, color) @@ -417,7 +417,7 @@ sfColor sfShape_GetPointColor(sfShape* shape, unsigned int index) //////////////////////////////////////////////////////////// /// Get a the outline color of a shape's point //////////////////////////////////////////////////////////// -sfColor sfShape_GetPointOutlineColor(sfShape* shape, unsigned int index) +sfColor sfShape_GetPointOutlineColor(const sfShape* shape, unsigned int index) { sfColor color = {255, 255, 255, 255}; CSFML_CHECK_RETURN(shape, color) diff --git a/CSFML/src/SFML/Graphics/Sprite.cpp b/CSFML/src/SFML/Graphics/Sprite.cpp index 35175568..7fdf7561 100644 --- a/CSFML/src/SFML/Graphics/Sprite.cpp +++ b/CSFML/src/SFML/Graphics/Sprite.cpp @@ -151,7 +151,7 @@ void sfSprite_SetBlendMode(sfSprite* sprite, sfBlendMode mode) //////////////////////////////////////////////////////////// /// Get the X position of a sprite //////////////////////////////////////////////////////////// -float sfSprite_GetX(sfSprite* sprite) +float sfSprite_GetX(const sfSprite* sprite) { CSFML_CALL_RETURN(sprite, GetPosition().x, 0.f) } @@ -160,7 +160,7 @@ float sfSprite_GetX(sfSprite* sprite) //////////////////////////////////////////////////////////// /// Get the Y position of a sprite //////////////////////////////////////////////////////////// -float sfSprite_GetY(sfSprite* sprite) +float sfSprite_GetY(const sfSprite* sprite) { CSFML_CALL_RETURN(sprite, GetPosition().y, 0.f) } @@ -169,7 +169,7 @@ float sfSprite_GetY(sfSprite* sprite) //////////////////////////////////////////////////////////// /// Get the horizontal scale of a sprite //////////////////////////////////////////////////////////// -float sfSprite_GetScaleX(sfSprite* sprite) +float sfSprite_GetScaleX(const sfSprite* sprite) { CSFML_CALL_RETURN(sprite, GetScale().x, 0.f) } @@ -178,7 +178,7 @@ float sfSprite_GetScaleX(sfSprite* sprite) //////////////////////////////////////////////////////////// /// Get the vertical scale of a sprite //////////////////////////////////////////////////////////// -float sfSprite_GetScaleY(sfSprite* sprite) +float sfSprite_GetScaleY(const sfSprite* sprite) { CSFML_CALL_RETURN(sprite, GetScale().y, 0.f) } @@ -187,7 +187,7 @@ float sfSprite_GetScaleY(sfSprite* sprite) //////////////////////////////////////////////////////////// /// Get the orientation of a sprite //////////////////////////////////////////////////////////// -float sfSprite_GetRotation(sfSprite* sprite) +float sfSprite_GetRotation(const sfSprite* sprite) { CSFML_CALL_RETURN(sprite, GetRotation(), 0.f) } @@ -196,7 +196,7 @@ float sfSprite_GetRotation(sfSprite* sprite) //////////////////////////////////////////////////////////// /// Get the X position of the origin a sprite //////////////////////////////////////////////////////////// -float sfSprite_GetOriginX(sfSprite* sprite) +float sfSprite_GetOriginX(const sfSprite* sprite) { CSFML_CALL_RETURN(sprite, GetOrigin().x, 0.f) } @@ -205,7 +205,7 @@ float sfSprite_GetOriginX(sfSprite* sprite) //////////////////////////////////////////////////////////// /// Get the Y position of the origin a sprite //////////////////////////////////////////////////////////// -float sfSprite_GetOriginY(sfSprite* sprite) +float sfSprite_GetOriginY(const sfSprite* sprite) { CSFML_CALL_RETURN(sprite, GetOrigin().y, 0.f) } @@ -214,7 +214,7 @@ float sfSprite_GetOriginY(sfSprite* sprite) //////////////////////////////////////////////////////////// /// Get the color of a sprite //////////////////////////////////////////////////////////// -sfColor sfSprite_GetColor(sfSprite* sprite) +sfColor sfSprite_GetColor(const sfSprite* sprite) { sfColor color = {0, 0, 0, 0}; CSFML_CHECK_RETURN(sprite, color) @@ -227,7 +227,7 @@ sfColor sfSprite_GetColor(sfSprite* sprite) //////////////////////////////////////////////////////////// /// Get the current blending mode of a sprite //////////////////////////////////////////////////////////// -sfBlendMode sfSprite_GetBlendMode(sfSprite* sprite) +sfBlendMode sfSprite_GetBlendMode(const sfSprite* sprite) { CSFML_CHECK_RETURN(sprite, sfBlendNone) @@ -266,7 +266,7 @@ void sfSprite_Rotate(sfSprite* sprite, float angle) /// Transform a point from global coordinates into the sprite's local coordinates /// (ie it applies the inverse of object's origin, translation, rotation and scale to the point) //////////////////////////////////////////////////////////// -void sfSprite_TransformToLocal(sfSprite* sprite, float pointX, float pointY, float* x, float* y) +void sfSprite_TransformToLocal(const sfSprite* sprite, float pointX, float pointY, float* x, float* y) { CSFML_CHECK(sprite) @@ -280,7 +280,7 @@ void sfSprite_TransformToLocal(sfSprite* sprite, float pointX, float pointY, flo /// Transform a point from the sprite's local coordinates into global coordinates /// (ie it applies the object's origin, translation, rotation and scale to the point) //////////////////////////////////////////////////////////// -void sfSprite_TransformToGlobal(sfSprite* sprite, float pointX, float pointY, float* x, float* y) +void sfSprite_TransformToGlobal(const sfSprite* sprite, float pointX, float pointY, float* x, float* y) { CSFML_CHECK(sprite) @@ -293,7 +293,7 @@ void sfSprite_TransformToGlobal(sfSprite* sprite, float pointX, float pointY, fl //////////////////////////////////////////////////////////// /// Change the image of a sprite //////////////////////////////////////////////////////////// -void sfSprite_SetImage(sfSprite* sprite, sfImage* image) +void sfSprite_SetImage(sfSprite* sprite, const sfImage* image) { if (image) { @@ -343,7 +343,7 @@ void sfSprite_FlipY(sfSprite* sprite, sfBool flipped) //////////////////////////////////////////////////////////// /// Get the source image of a sprite //////////////////////////////////////////////////////////// -sfImage* sfSprite_GetImage(sfSprite* sprite) +const sfImage* sfSprite_GetImage(const sfSprite* sprite) { CSFML_CHECK_RETURN(sprite, NULL) @@ -354,7 +354,7 @@ sfImage* sfSprite_GetImage(sfSprite* sprite) //////////////////////////////////////////////////////////// /// Get the sub-rectangle of a sprite inside the source image //////////////////////////////////////////////////////////// -sfIntRect sfSprite_GetSubRect(sfSprite* sprite) +sfIntRect sfSprite_GetSubRect(const sfSprite* sprite) { sfIntRect rect = {0, 0, 0, 0}; CSFML_CHECK_RETURN(sprite, rect) @@ -366,7 +366,7 @@ sfIntRect sfSprite_GetSubRect(sfSprite* sprite) //////////////////////////////////////////////////////////// /// Get a sprite width //////////////////////////////////////////////////////////// -float sfSprite_GetWidth(sfSprite* sprite) +float sfSprite_GetWidth(const sfSprite* sprite) { CSFML_CALL_RETURN(sprite, GetSize().x, 0.f) } @@ -375,7 +375,7 @@ float sfSprite_GetWidth(sfSprite* sprite) //////////////////////////////////////////////////////////// /// Get a sprite height //////////////////////////////////////////////////////////// -float sfSprite_GetHeight(sfSprite* sprite) +float sfSprite_GetHeight(const sfSprite* sprite) { CSFML_CALL_RETURN(sprite, GetSize().y, 0.f) } @@ -384,7 +384,7 @@ float sfSprite_GetHeight(sfSprite* sprite) //////////////////////////////////////////////////////////// /// Get the color of a given pixel in a sprite //////////////////////////////////////////////////////////// -sfColor sfSprite_GetPixel(sfSprite* sprite, unsigned int x, unsigned int y) +sfColor sfSprite_GetPixel(const sfSprite* sprite, unsigned int x, unsigned int y) { sfColor color = {0, 0, 0, 0}; CSFML_CHECK_RETURN(sprite, color) diff --git a/CSFML/src/SFML/Graphics/SpriteStruct.h b/CSFML/src/SFML/Graphics/SpriteStruct.h index 191bade1..ecb8df98 100644 --- a/CSFML/src/SFML/Graphics/SpriteStruct.h +++ b/CSFML/src/SFML/Graphics/SpriteStruct.h @@ -38,9 +38,9 @@ //////////////////////////////////////////////////////////// struct sfSprite { - sf::Sprite This; - sfImage* Image; - sfIntRect SubRect; + sf::Sprite This; + const sfImage* Image; + sfIntRect SubRect; }; diff --git a/CSFML/src/SFML/Graphics/Text.cpp b/CSFML/src/SFML/Graphics/Text.cpp index 7d338ca5..7f8bb9c7 100644 --- a/CSFML/src/SFML/Graphics/Text.cpp +++ b/CSFML/src/SFML/Graphics/Text.cpp @@ -147,7 +147,7 @@ void sfText_SetBlendMode(sfText* text, sfBlendMode mode) //////////////////////////////////////////////////////////// /// Get the X position of a text //////////////////////////////////////////////////////////// -float sfText_GetX(sfText* text) +float sfText_GetX(const sfText* text) { CSFML_CALL_RETURN(text, GetPosition().x, 0.f) } @@ -156,7 +156,7 @@ float sfText_GetX(sfText* text) //////////////////////////////////////////////////////////// /// Get the Y position of a text //////////////////////////////////////////////////////////// -float sfText_GetY(sfText* text) +float sfText_GetY(const sfText* text) { CSFML_CALL_RETURN(text, GetPosition().y, 0.f) } @@ -165,7 +165,7 @@ float sfText_GetY(sfText* text) //////////////////////////////////////////////////////////// /// Get the horizontal scale of a text //////////////////////////////////////////////////////////// -float sfText_GetScaleX(sfText* text) +float sfText_GetScaleX(const sfText* text) { CSFML_CALL_RETURN(text, GetScale().x, 0.f) } @@ -174,7 +174,7 @@ float sfText_GetScaleX(sfText* text) //////////////////////////////////////////////////////////// /// Get the vertical scale of a text //////////////////////////////////////////////////////////// -float sfText_GetScaleY(sfText* text) +float sfText_GetScaleY(const sfText* text) { CSFML_CALL_RETURN(text, GetScale().y, 0.f) } @@ -183,7 +183,7 @@ float sfText_GetScaleY(sfText* text) //////////////////////////////////////////////////////////// /// Get the orientation of a text //////////////////////////////////////////////////////////// -float sfText_GetRotation(sfText* text) +float sfText_GetRotation(const sfText* text) { CSFML_CALL_RETURN(text, GetRotation(), 0.f) } @@ -192,7 +192,7 @@ float sfText_GetRotation(sfText* text) //////////////////////////////////////////////////////////// /// Get the X position of the origin a text //////////////////////////////////////////////////////////// -float sfText_GetOriginX(sfText* text) +float sfText_GetOriginX(const sfText* text) { CSFML_CALL_RETURN(text, GetOrigin().x, 0.f) } @@ -201,7 +201,7 @@ float sfText_GetOriginX(sfText* text) //////////////////////////////////////////////////////////// /// Get the top Y of the origin of a text //////////////////////////////////////////////////////////// -float sfText_GetOriginY(sfText* text) +float sfText_GetOriginY(const sfText* text) { CSFML_CALL_RETURN(text, GetOrigin().y, 0.f) } @@ -210,7 +210,7 @@ float sfText_GetOriginY(sfText* text) //////////////////////////////////////////////////////////// /// Get the color of a text //////////////////////////////////////////////////////////// -sfColor sfText_GetColor(sfText* text) +sfColor sfText_GetColor(const sfText* text) { sfColor color = {0, 0, 0, 0}; CSFML_CHECK_RETURN(text, color) @@ -223,7 +223,7 @@ sfColor sfText_GetColor(sfText* text) //////////////////////////////////////////////////////////// /// Get the current blending mode of a text //////////////////////////////////////////////////////////// -sfBlendMode sfText_GetBlendMode(sfText* text) +sfBlendMode sfText_GetBlendMode(const sfText* text) { CSFML_CHECK_RETURN(text, sfBlendNone) @@ -262,7 +262,7 @@ void sfText_Rotate(sfText* text, float angle) /// Transform a point from global coordinates into the text's local coordinates /// (ie it applies the inverse of object's origin, translation, rotation and scale to the point) //////////////////////////////////////////////////////////// -void sfText_TransformToLocal(sfText* text, float pointX, float pointY, float* x, float* y) +void sfText_TransformToLocal(const sfText* text, float pointX, float pointY, float* x, float* y) { CSFML_CHECK(text) @@ -276,7 +276,7 @@ void sfText_TransformToLocal(sfText* text, float pointX, float pointY, float* x, /// Transform a point from the text's local coordinates into global coordinates /// (ie it applies the object's origin, translation, rotation and scale to the point) //////////////////////////////////////////////////////////// -void sfText_TransformToGlobal(sfText* text, float pointX, float pointY, float* x, float* y) +void sfText_TransformToGlobal(const sfText* text, float pointX, float pointY, float* x, float* y) { CSFML_CHECK(text) @@ -308,7 +308,7 @@ void sfText_SetUnicodeString(sfText* text, const sfUint32* string) //////////////////////////////////////////////////////////// /// Set the font of a string //////////////////////////////////////////////////////////// -void sfText_SetFont(sfText* text, sfFont* font) +void sfText_SetFont(sfText* text, const sfFont* font) { CSFML_CHECK(font); @@ -338,7 +338,7 @@ void sfText_SetStyle(sfText* text, unsigned long style) //////////////////////////////////////////////////////////// /// Get the string of a text (returns a unicode string) //////////////////////////////////////////////////////////// -const sfUint32* sfText_GetUnicodeString(sfText* text) +const sfUint32* sfText_GetUnicodeString(const sfText* text) { CSFML_CHECK_RETURN(text, NULL) @@ -349,7 +349,7 @@ const sfUint32* sfText_GetUnicodeString(sfText* text) //////////////////////////////////////////////////////////// /// Get the string of a text (returns an ANSI string) //////////////////////////////////////////////////////////// -const char* sfText_GetString(sfText* text) +const char* sfText_GetString(const sfText* text) { CSFML_CHECK_RETURN(text, NULL) @@ -362,7 +362,7 @@ const char* sfText_GetString(sfText* text) //////////////////////////////////////////////////////////// /// Get the font used by a text //////////////////////////////////////////////////////////// -sfFont* sfText_GetFont(sfText* text) +const sfFont* sfText_GetFont(const sfText* text) { CSFML_CHECK_RETURN(text, NULL) @@ -373,7 +373,7 @@ sfFont* sfText_GetFont(sfText* text) //////////////////////////////////////////////////////////// /// Get the size of the characters of a text //////////////////////////////////////////////////////////// -float sfText_GetSize(sfText* text) +float sfText_GetSize(const sfText* text) { CSFML_CALL_RETURN(text, GetSize(), 0.f) } @@ -382,7 +382,7 @@ float sfText_GetSize(sfText* text) //////////////////////////////////////////////////////////// /// Get the style of a text //////////////////////////////////////////////////////////// -unsigned long sfText_GetStyle(sfText* text) +unsigned long sfText_GetStyle(const sfText* text) { CSFML_CALL_RETURN(text, GetStyle(), 0) } @@ -393,7 +393,7 @@ unsigned long sfText_GetStyle(sfText* text) /// in coordinates relative to the text /// (note : translation, origin, rotation and scale are not applied) //////////////////////////////////////////////////////////// -void sfText_GetCharacterPos(sfText* text, size_t index, float* x, float* y) +void sfText_GetCharacterPos(const sfText* text, size_t index, float* x, float* y) { CSFML_CHECK(text); @@ -406,7 +406,7 @@ void sfText_GetCharacterPos(sfText* text, size_t index, float* x, float* y) //////////////////////////////////////////////////////////// /// Get the bounding rectangle of a text on screen //////////////////////////////////////////////////////////// -sfFloatRect sfText_GetRect(sfText* text) +sfFloatRect sfText_GetRect(const sfText* text) { sfFloatRect rect = {0.f, 0.f, 0.f, 0.f}; CSFML_CHECK_RETURN(text, rect) diff --git a/CSFML/src/SFML/Graphics/TextStruct.h b/CSFML/src/SFML/Graphics/TextStruct.h index 9d00bad0..98af9f18 100644 --- a/CSFML/src/SFML/Graphics/TextStruct.h +++ b/CSFML/src/SFML/Graphics/TextStruct.h @@ -39,10 +39,10 @@ //////////////////////////////////////////////////////////// struct sfText { - sf::Text This; - std::string String; - sfFont* Font; - sfFloatRect Rect; + sf::Text This; + const sfFont* Font; + mutable std::string String; + mutable sfFloatRect Rect; }; diff --git a/CSFML/src/SFML/Graphics/View.cpp b/CSFML/src/SFML/Graphics/View.cpp index ac199201..3735c203 100644 --- a/CSFML/src/SFML/Graphics/View.cpp +++ b/CSFML/src/SFML/Graphics/View.cpp @@ -106,7 +106,7 @@ void sfView_Reset(sfView* View, sfFloatRect Rectangle) //////////////////////////////////////////////////////////// /// Get the X coordinate of the center of a view //////////////////////////////////////////////////////////// -float sfView_GetCenterX(sfView* View) +float sfView_GetCenterX(const sfView* View) { CSFML_CHECK_RETURN(View, 0.f); @@ -117,7 +117,7 @@ float sfView_GetCenterX(sfView* View) //////////////////////////////////////////////////////////// /// Get the Y coordinate of the center of a view //////////////////////////////////////////////////////////// -float sfView_GetCenterY(sfView* View) +float sfView_GetCenterY(const sfView* View) { CSFML_CHECK_RETURN(View, 0.f); @@ -128,7 +128,7 @@ float sfView_GetCenterY(sfView* View) //////////////////////////////////////////////////////////// /// Get the width of the view //////////////////////////////////////////////////////////// -float sfView_GetWidth(sfView* View) +float sfView_GetWidth(const sfView* View) { CSFML_CHECK_RETURN(View, 0.f); @@ -139,7 +139,7 @@ float sfView_GetWidth(sfView* View) //////////////////////////////////////////////////////////// /// Get the height of the view //////////////////////////////////////////////////////////// -float sfView_GetHeight(sfView* View) +float sfView_GetHeight(const sfView* View) { CSFML_CHECK_RETURN(View, 0.f); @@ -150,7 +150,7 @@ float sfView_GetHeight(sfView* View) //////////////////////////////////////////////////////////// /// Get the current rotation of a view //////////////////////////////////////////////////////////// -float sfView_GetRotation(sfView* View) +float sfView_GetRotation(const sfView* View) { CSFML_CALL_PTR_RETURN(View, GetRotation(), 0.f); } @@ -159,7 +159,7 @@ float sfView_GetRotation(sfView* View) //////////////////////////////////////////////////////////// /// Get the target viewport of a view //////////////////////////////////////////////////////////// -sfFloatRect sfView_GetViewport(sfView* View) +sfFloatRect sfView_GetViewport(const sfView* View) { sfFloatRect Rect = {0, 0, 0, 0}; CSFML_CHECK_RETURN(View, Rect); diff --git a/CSFML/src/SFML/Network/Ftp.cpp b/CSFML/src/SFML/Network/Ftp.cpp index 36150b78..05988434 100644 --- a/CSFML/src/SFML/Network/Ftp.cpp +++ b/CSFML/src/SFML/Network/Ftp.cpp @@ -43,7 +43,7 @@ void sfFtpListingResponse_Destroy(sfFtpListingResponse* ftpListingResponse) /// Convenience function to check if the response status code /// means a success //////////////////////////////////////////////////////////// -sfBool sfFtpListingResponse_IsOk(sfFtpListingResponse* ftpListingResponse) +sfBool sfFtpListingResponse_IsOk(const sfFtpListingResponse* ftpListingResponse) { CSFML_CALL_RETURN(ftpListingResponse, IsOk(), sfFalse); } @@ -51,7 +51,7 @@ sfBool sfFtpListingResponse_IsOk(sfFtpListingResponse* ftpListingResponse) //////////////////////////////////////////////////////////// /// Get the response status code //////////////////////////////////////////////////////////// -sfFtpStatus sfFtpListingResponse_GetStatus(sfFtpListingResponse* ftpListingResponse) +sfFtpStatus sfFtpListingResponse_GetStatus(const sfFtpListingResponse* ftpListingResponse) { CSFML_CHECK_RETURN(ftpListingResponse, sfFtpInvalidResponse); @@ -61,7 +61,7 @@ sfFtpStatus sfFtpListingResponse_GetStatus(sfFtpListingResponse* ftpListingRespo //////////////////////////////////////////////////////////// /// Get the full message contained in the response //////////////////////////////////////////////////////////// -const char* sfFtpListingResponse_GetMessage(sfFtpListingResponse* ftpListingResponse) +const char* sfFtpListingResponse_GetMessage(const sfFtpListingResponse* ftpListingResponse) { CSFML_CHECK_RETURN(ftpListingResponse, NULL); @@ -71,7 +71,7 @@ const char* sfFtpListingResponse_GetMessage(sfFtpListingResponse* ftpListingResp //////////////////////////////////////////////////////////// /// Get the number of filenames in the listing //////////////////////////////////////////////////////////// -size_t sfFtpListingResponse_GetCount(sfFtpListingResponse* ftpListingResponse) +size_t sfFtpListingResponse_GetCount(const sfFtpListingResponse* ftpListingResponse) { CSFML_CALL_RETURN(ftpListingResponse, GetCount(), 0); } @@ -79,7 +79,7 @@ size_t sfFtpListingResponse_GetCount(sfFtpListingResponse* ftpListingResponse) //////////////////////////////////////////////////////////// /// Get the Index-th filename in the directory //////////////////////////////////////////////////////////// -const char* sfFtpListingResponse_GetFilename(sfFtpListingResponse* ftpListingResponse, size_t index) +const char* sfFtpListingResponse_GetFilename(const sfFtpListingResponse* ftpListingResponse, size_t index) { CSFML_CHECK_RETURN(ftpListingResponse, NULL); @@ -99,7 +99,7 @@ void sfFtpDirectoryResponse_Destroy(sfFtpDirectoryResponse* ftpDirectoryResponse /// Convenience function to check if the response status code /// means a success //////////////////////////////////////////////////////////// -sfBool sfFtpDirectoryResponse_IsOk(sfFtpDirectoryResponse* ftpDirectoryResponse) +sfBool sfFtpDirectoryResponse_IsOk(const sfFtpDirectoryResponse* ftpDirectoryResponse) { CSFML_CALL_RETURN(ftpDirectoryResponse, IsOk(), sfFalse); } @@ -107,7 +107,7 @@ sfBool sfFtpDirectoryResponse_IsOk(sfFtpDirectoryResponse* ftpDirectoryResponse) //////////////////////////////////////////////////////////// /// Get the response status code //////////////////////////////////////////////////////////// -sfFtpStatus sfFtpDirectoryResponse_GetStatus(sfFtpDirectoryResponse* ftpDirectoryResponse) +sfFtpStatus sfFtpDirectoryResponse_GetStatus(const sfFtpDirectoryResponse* ftpDirectoryResponse) { CSFML_CHECK_RETURN(ftpDirectoryResponse, sfFtpInvalidResponse); @@ -117,7 +117,7 @@ sfFtpStatus sfFtpDirectoryResponse_GetStatus(sfFtpDirectoryResponse* ftpDirector //////////////////////////////////////////////////////////// /// Get the full message contained in the response //////////////////////////////////////////////////////////// -const char* sfFtpDirectoryResponse_GetMessage(sfFtpDirectoryResponse* ftpDirectoryResponse) +const char* sfFtpDirectoryResponse_GetMessage(const sfFtpDirectoryResponse* ftpDirectoryResponse) { CSFML_CHECK_RETURN(ftpDirectoryResponse, NULL); @@ -127,7 +127,7 @@ const char* sfFtpDirectoryResponse_GetMessage(sfFtpDirectoryResponse* ftpDirecto //////////////////////////////////////////////////////////// /// Get the directory returned in the response //////////////////////////////////////////////////////////// -const char* sfFtpDirectoryResponse_GetDirectory(sfFtpDirectoryResponse* ftpDirectoryResponse) +const char* sfFtpDirectoryResponse_GetDirectory(const sfFtpDirectoryResponse* ftpDirectoryResponse) { CSFML_CHECK_RETURN(ftpDirectoryResponse, NULL); @@ -148,7 +148,7 @@ void sfFtpResponse_Destroy(sfFtpResponse* ftpResponse) /// Convenience function to check if the response status code /// means a success //////////////////////////////////////////////////////////// -sfBool sfFtpResponse_IsOk(sfFtpResponse* ftpResponse) +sfBool sfFtpResponse_IsOk(const sfFtpResponse* ftpResponse) { CSFML_CALL_RETURN(ftpResponse, IsOk(), sfFalse); } @@ -157,7 +157,7 @@ sfBool sfFtpResponse_IsOk(sfFtpResponse* ftpResponse) //////////////////////////////////////////////////////////// /// Get the response status code //////////////////////////////////////////////////////////// -sfFtpStatus sfFtpResponse_GetStatus(sfFtpResponse* ftpResponse) +sfFtpStatus sfFtpResponse_GetStatus(const sfFtpResponse* ftpResponse) { CSFML_CHECK_RETURN(ftpResponse, sfFtpInvalidResponse); @@ -168,7 +168,7 @@ sfFtpStatus sfFtpResponse_GetStatus(sfFtpResponse* ftpResponse) //////////////////////////////////////////////////////////// /// Get the full message contained in the response //////////////////////////////////////////////////////////// -const char* sfFtpResponse_GetMessage(sfFtpResponse* ftpResponse) +const char* sfFtpResponse_GetMessage(const sfFtpResponse* ftpResponse) { CSFML_CHECK_RETURN(ftpResponse, NULL); diff --git a/CSFML/src/SFML/Network/Http.cpp b/CSFML/src/SFML/Network/Http.cpp index f50d7b33..2d307f9b 100644 --- a/CSFML/src/SFML/Network/Http.cpp +++ b/CSFML/src/SFML/Network/Http.cpp @@ -112,7 +112,7 @@ void sfHttpResponse_Destroy(sfHttpResponse* httpResponse) //////////////////////////////////////////////////////////// /// Get the value of a field; returns NULL if the field doesn't exist //////////////////////////////////////////////////////////// -const char* sfHttpResponse_GetField(sfHttpResponse* httpResponse, const char* field) +const char* sfHttpResponse_GetField(const sfHttpResponse* httpResponse, const char* field) { CSFML_CHECK_RETURN(httpResponse, NULL); if (!field) @@ -125,7 +125,7 @@ const char* sfHttpResponse_GetField(sfHttpResponse* httpResponse, const char* fi //////////////////////////////////////////////////////////// /// Get the status of a response //////////////////////////////////////////////////////////// -sfHttpStatus sfHttpResponse_GetStatus(sfHttpResponse* httpResponse) +sfHttpStatus sfHttpResponse_GetStatus(const sfHttpResponse* httpResponse) { CSFML_CHECK_RETURN(httpResponse, sfHttpInvalidResponse); @@ -136,7 +136,7 @@ sfHttpStatus sfHttpResponse_GetStatus(sfHttpResponse* httpResponse) //////////////////////////////////////////////////////////// /// Get the major HTTP version of a response //////////////////////////////////////////////////////////// -unsigned int sfHttpResponse_GetMajorVersion(sfHttpResponse* httpResponse) +unsigned int sfHttpResponse_GetMajorVersion(const sfHttpResponse* httpResponse) { CSFML_CALL_RETURN(httpResponse, GetMajorHttpVersion(), 0); } @@ -145,7 +145,7 @@ unsigned int sfHttpResponse_GetMajorVersion(sfHttpResponse* httpResponse) //////////////////////////////////////////////////////////// /// Get the minor HTTP version of a response //////////////////////////////////////////////////////////// -unsigned int sfHttpResponse_GetMinorVersion(sfHttpResponse* httpResponse) +unsigned int sfHttpResponse_GetMinorVersion(const sfHttpResponse* httpResponse) { CSFML_CALL_RETURN(httpResponse, GetMinorHttpVersion(), 0); } @@ -158,7 +158,7 @@ unsigned int sfHttpResponse_GetMinorVersion(sfHttpResponse* httpResponse) /// - nothing (for HEAD requests) /// - an error message (in case of an error) //////////////////////////////////////////////////////////// -const char* sfHttpResponse_GetBody(sfHttpResponse* httpResponse) +const char* sfHttpResponse_GetBody(const sfHttpResponse* httpResponse) { CSFML_CHECK_RETURN(httpResponse, NULL); @@ -201,7 +201,7 @@ void sfHttp_SetHost(sfHttp* http, const char* host, unsigned short port) /// not return instantly; use a thread if you don't want to block your /// application. //////////////////////////////////////////////////////////// -sfHttpResponse* sfHttp_SendRequest(sfHttp* http, sfHttpRequest* request, float timeout) +sfHttpResponse* sfHttp_SendRequest(sfHttp* http, const sfHttpRequest* request, float timeout) { CSFML_CHECK_RETURN(http, NULL); CSFML_CHECK_RETURN(request, NULL); diff --git a/CSFML/src/SFML/Network/Packet.cpp b/CSFML/src/SFML/Network/Packet.cpp index e90914d3..252608e5 100644 --- a/CSFML/src/SFML/Network/Packet.cpp +++ b/CSFML/src/SFML/Network/Packet.cpp @@ -79,7 +79,7 @@ void sfPacket_Destroy(sfPacket* packet) //////////////////////////////////////////////////////////// /// Append data to the end of a packet //////////////////////////////////////////////////////////// -void sfPacket_Append(sfPacket* packet, void* data, size_t sizeInBytes) +void sfPacket_Append(sfPacket* packet, const void* data, size_t sizeInBytes) { CSFML_CALL(packet, Append(data, sizeInBytes)); } @@ -99,7 +99,7 @@ void sfPacket_Clear(sfPacket* packet) /// Warning : the returned pointer may be invalid after you /// append data to the packet //////////////////////////////////////////////////////////// -const char* sfPacket_GetData(sfPacket* packet) +const char* sfPacket_GetData(const sfPacket* packet) { CSFML_CALL_RETURN(packet, GetData(), NULL); } @@ -108,7 +108,7 @@ const char* sfPacket_GetData(sfPacket* packet) //////////////////////////////////////////////////////////// /// Get the size of the data contained in a packet //////////////////////////////////////////////////////////// -size_t sfPacket_GetDataSize(sfPacket* packet) +size_t sfPacket_GetDataSize(const sfPacket* packet) { CSFML_CALL_RETURN(packet, GetDataSize(), 0); } @@ -117,7 +117,7 @@ size_t sfPacket_GetDataSize(sfPacket* packet) //////////////////////////////////////////////////////////// /// Tell if the reading position has reached the end of the packet //////////////////////////////////////////////////////////// -sfBool sfPacket_EndOfPacket(sfPacket* packet) +sfBool sfPacket_EndOfPacket(const sfPacket* packet) { CSFML_CALL_RETURN(packet, EndOfPacket(), sfFalse); } @@ -126,7 +126,7 @@ sfBool sfPacket_EndOfPacket(sfPacket* packet) //////////////////////////////////////////////////////////// /// Check if a packet is in a valid reading state //////////////////////////////////////////////////////////// -sfBool sfPacket_CanRead(sfPacket* packet) +sfBool sfPacket_CanRead(const sfPacket* packet) { CSFML_CALL_RETURN(packet, operator bool(), sfFalse); } diff --git a/CSFML/src/SFML/Network/Selector.cpp b/CSFML/src/SFML/Network/Selector.cpp index 4f186f50..2d3d3aec 100644 --- a/CSFML/src/SFML/Network/Selector.cpp +++ b/CSFML/src/SFML/Network/Selector.cpp @@ -78,13 +78,13 @@ unsigned int sfSelectorUDP_Wait(sfSelectorUDP* selector, float timeout) {CSFML_C /// ready for reading. The total number of sockets ready /// is the integer returned by the previous call to Wait() //////////////////////////////////////////////////////////// -sfSocketTCP* sfSelectorTCP_GetSocketReady(sfSelectorTCP* selector, unsigned int index) +sfSocketTCP* sfSelectorTCP_GetSocketReady(const sfSelectorTCP* selector, unsigned int index) { CSFML_CHECK_RETURN(selector, NULL); - return selector->Sockets[selector->This.GetSocketReady(index)]; + return selector->Sockets.find(selector->This.GetSocketReady(index))->second; } -sfSocketUDP* sfSelectorUDP_GetSocketReady(sfSelectorUDP* selector, unsigned int index) +sfSocketUDP* sfSelectorUDP_GetSocketReady(const sfSelectorUDP* selector, unsigned int index) { CSFML_CHECK_RETURN(selector, NULL); - return selector->Sockets[selector->This.GetSocketReady(index)]; + return selector->Sockets.find(selector->This.GetSocketReady(index))->second; } diff --git a/CSFML/src/SFML/Network/SocketTCP.cpp b/CSFML/src/SFML/Network/SocketTCP.cpp index a65d031d..9a920fc3 100644 --- a/CSFML/src/SFML/Network/SocketTCP.cpp +++ b/CSFML/src/SFML/Network/SocketTCP.cpp @@ -183,7 +183,7 @@ sfBool sfSocketTCP_Close(sfSocketTCP* socket) /// Check if a socket is in a valid state ; this function /// can be called any time to check if the socket is OK //////////////////////////////////////////////////////////// -sfBool sfSocketTCP_IsValid(sfSocketTCP* socket) +sfBool sfSocketTCP_IsValid(const sfSocketTCP* socket) { CSFML_CALL_RETURN(socket, IsValid(), sfFalse); } diff --git a/CSFML/src/SFML/Network/SocketUDP.cpp b/CSFML/src/SFML/Network/SocketUDP.cpp index 362f9d11..417cad02 100644 --- a/CSFML/src/SFML/Network/SocketUDP.cpp +++ b/CSFML/src/SFML/Network/SocketUDP.cpp @@ -47,7 +47,11 @@ sfSocketUDP* sfSocketUDP_Create() //////////////////////////////////////////////////////////// void sfSocketUDP_Destroy(sfSocketUDP* socket) { - delete socket; + if (socket) + { + socket->This.Close(); + delete socket; + } } @@ -178,7 +182,7 @@ sfBool sfSocketUDP_Close(sfSocketUDP* socket) /// Check if a socket is in a valid state ; this function /// can be called any time to check if the socket is OK //////////////////////////////////////////////////////////// -sfBool sfSocketUDP_IsValid(sfSocketUDP* socket) +sfBool sfSocketUDP_IsValid(const sfSocketUDP* socket) { CSFML_CALL_RETURN(socket, IsValid(), sfFalse); } diff --git a/CSFML/src/SFML/System/Clock.cpp b/CSFML/src/SFML/System/Clock.cpp index 675246e8..32df2d6a 100644 --- a/CSFML/src/SFML/System/Clock.cpp +++ b/CSFML/src/SFML/System/Clock.cpp @@ -51,7 +51,7 @@ void sfClock_Destroy(sfClock* clock) //////////////////////////////////////////////////////////// /// Get the time elapsed for a clock //////////////////////////////////////////////////////////// -float sfClock_GetTime(sfClock* clock) +float sfClock_GetTime(const sfClock* clock) { CSFML_CALL_RETURN(clock, GetElapsedTime(), 0.f) } diff --git a/CSFML/src/SFML/Window/Window.cpp b/CSFML/src/SFML/Window/Window.cpp index a173cf97..ac29a53b 100644 --- a/CSFML/src/SFML/Window/Window.cpp +++ b/CSFML/src/SFML/Window/Window.cpp @@ -34,7 +34,7 @@ //////////////////////////////////////////////////////////// /// Construct a new window //////////////////////////////////////////////////////////// -sfWindow* sfWindow_Create(sfVideoMode mode, const char* title, unsigned long style, sfContextSettings* settings) +sfWindow* sfWindow_Create(sfVideoMode mode, const char* title, unsigned long style, const sfContextSettings* settings) { // Convert video mode sf::VideoMode videoMode(mode.Width, mode.Height, mode.BitsPerPixel); @@ -62,7 +62,7 @@ sfWindow* sfWindow_Create(sfVideoMode mode, const char* title, unsigned long sty //////////////////////////////////////////////////////////// /// Construct a window from an existing control //////////////////////////////////////////////////////////// -sfWindow* sfWindow_CreateFromHandle(sfWindowHandle handle, sfContextSettings* settings) +sfWindow* sfWindow_CreateFromHandle(sfWindowHandle handle, const sfContextSettings* settings) { // Convert context settings sf::ContextSettings params; @@ -104,7 +104,7 @@ void sfWindow_Close(sfWindow* window) //////////////////////////////////////////////////////////// /// Tell whether or not a window is opened //////////////////////////////////////////////////////////// -sfBool sfWindow_IsOpened(sfWindow* window) +sfBool sfWindow_IsOpened(const sfWindow* window) { CSFML_CALL_RETURN(window, IsOpened(), sfFalse); } @@ -113,7 +113,7 @@ sfBool sfWindow_IsOpened(sfWindow* window) //////////////////////////////////////////////////////////// /// Get the width of the rendering region of a window //////////////////////////////////////////////////////////// -unsigned int sfWindow_GetWidth(sfWindow* window) +unsigned int sfWindow_GetWidth(const sfWindow* window) { CSFML_CALL_RETURN(window, GetWidth(), 0) } @@ -122,7 +122,7 @@ unsigned int sfWindow_GetWidth(sfWindow* window) //////////////////////////////////////////////////////////// /// Get the height of the rendering region of a window //////////////////////////////////////////////////////////// -unsigned int sfWindow_GetHeight(sfWindow* window) +unsigned int sfWindow_GetHeight(const sfWindow* window) { CSFML_CALL_RETURN(window, GetHeight(), 0) } @@ -131,7 +131,7 @@ unsigned int sfWindow_GetHeight(sfWindow* window) //////////////////////////////////////////////////////////// /// Get the creation settings of a window //////////////////////////////////////////////////////////// -sfContextSettings sfWindow_GetSettings(sfWindow* window) +sfContextSettings sfWindow_GetSettings(const sfWindow* window) { sfContextSettings settings = {0, 0, 0}; CSFML_CHECK_RETURN(window, settings); @@ -259,7 +259,7 @@ void sfWindow_EnableKeyRepeat(sfWindow* window, sfBool enabled) //////////////////////////////////////////////////////////// /// Change the window's icon //////////////////////////////////////////////////////////// -void sfWindow_SetIcon(sfWindow* window, unsigned int width, unsigned int height, sfUint8* pixels) +void sfWindow_SetIcon(sfWindow* window, unsigned int width, unsigned int height, const sfUint8* pixels) { CSFML_CALL(window, SetIcon(width, height, pixels)) } @@ -286,7 +286,7 @@ void sfWindow_Display(sfWindow* window) //////////////////////////////////////////////////////////// /// Get the input manager of a window //////////////////////////////////////////////////////////// -sfInput* sfWindow_GetInput(sfWindow* window) +const sfInput* sfWindow_GetInput(sfWindow* window) { CSFML_CHECK_RETURN(window, NULL); @@ -306,7 +306,7 @@ void sfWindow_SetFramerateLimit(sfWindow* window, unsigned int limit) //////////////////////////////////////////////////////////// /// Get time elapsed since last frame of a window //////////////////////////////////////////////////////////// -float sfWindow_GetFrameTime(sfWindow* window) +float sfWindow_GetFrameTime(const sfWindow* window) { CSFML_CALL_RETURN(window, GetFrameTime(), 0.f) } diff --git a/build/codeblocks/sfml-network.cbp b/build/codeblocks/sfml-network.cbp index df5312e8..cdeed91d 100644 --- a/build/codeblocks/sfml-network.cbp +++ b/build/codeblocks/sfml-network.cbp @@ -28,6 +28,7 @@ + @@ -52,6 +53,7 @@ + diff --git a/build/vc2005/SFML.sln b/build/vc2005/SFML.sln index e1562da7..a5b6a8fa 100644 --- a/build/vc2005/SFML.sln +++ b/build/vc2005/SFML.sln @@ -8,13 +8,16 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sfml-audio", "sfml-audio.vc EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sfml-graphics", "sfml-graphics.vcproj", "{FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}" ProjectSection(ProjectDependencies) = postProject - {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sfml-main", "sfml-main.vcproj", "{2BD26A09-E1B6-42E2-A0D0-63987B76BB97}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sfml-network", "sfml-network.vcproj", "{823DDC98-42D5-4A38-88CF-9DC06C788AE4}" + ProjectSection(ProjectDependencies) = postProject + {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sfml-system", "sfml-system.vcproj", "{C061A27D-7CA0-4179-9869-672FA04A86A8}" EndProject @@ -25,10 +28,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sfml-window", "sfml-window. EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "opengl", "..\..\samples\build\vc2005\opengl.vcproj", "{4CD9A872-16EF-4C53-81FC-C7E77E782718}" ProjectSection(ProjectDependencies) = postProject - {2BD26A09-E1B6-42E2-A0D0-63987B76BB97} = {2BD26A09-E1B6-42E2-A0D0-63987B76BB97} - {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} - {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} = {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} = {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} + {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} + {2BD26A09-E1B6-42E2-A0D0-63987B76BB97} = {2BD26A09-E1B6-42E2-A0D0-63987B76BB97} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sockets", "..\..\samples\build\vc2005\sockets.vcproj", "{E6ED898F-218E-4467-8B1D-92E393283E1B}" @@ -38,58 +41,58 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sockets", "..\..\samples\bu EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sound", "..\..\samples\build\vc2005\sound.vcproj", "{11E3764D-850E-4EDA-9823-F66383A11042}" ProjectSection(ProjectDependencies) = postProject - {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2} = {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2} {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2} = {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sound-capture", "..\..\samples\build\vc2005\sound-capture.vcproj", "{34EBDA13-AFA3-4AD9-AB64-2B2D40E09573}" ProjectSection(ProjectDependencies) = postProject - {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2} = {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2} + {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "voip", "..\..\samples\build\vc2005\voip.vcproj", "{4B169017-FFDD-4588-9658-6F1C9ABC6495}" ProjectSection(ProjectDependencies) = postProject - {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2} = {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2} - {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} {823DDC98-42D5-4A38-88CF-9DC06C788AE4} = {823DDC98-42D5-4A38-88CF-9DC06C788AE4} + {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2} = {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "win32", "..\..\samples\build\vc2005\win32.vcproj", "{303EC049-639D-4F9C-9F33-D4B7F702275B}" ProjectSection(ProjectDependencies) = postProject - {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} - {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} = {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} = {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "window", "..\..\samples\build\vc2005\window.vcproj", "{11E9ABEF-17A5-4FF7-91E5-994F34172F68}" ProjectSection(ProjectDependencies) = postProject - {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} - {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} {2BD26A09-E1B6-42E2-A0D0-63987B76BB97} = {2BD26A09-E1B6-42E2-A0D0-63987B76BB97} + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} + {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxwidgets", "..\..\samples\build\vc2005\wxwidgets.vcproj", "{8B3B274A-B3B7-4C6B-8D4A-5334E2116830}" ProjectSection(ProjectDependencies) = postProject - {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} - {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} = {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} = {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qt", "..\..\samples\build\vc2005\qt.vcproj", "{EAB1A0A4-8CCC-4A74-B3B5-9F60243581D2}" ProjectSection(ProjectDependencies) = postProject - {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} - {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} = {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} = {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} + {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pong", "..\..\samples\build\vc2005\pong.vcproj", "{DDDE27DC-5568-43EE-BD0E-57C581F73EDE}" ProjectSection(ProjectDependencies) = postProject - {2BD26A09-E1B6-42E2-A0D0-63987B76BB97} = {2BD26A09-E1B6-42E2-A0D0-63987B76BB97} - {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2} = {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2} - {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} - {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} = {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} = {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2} = {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2} + {2BD26A09-E1B6-42E2-A0D0-63987B76BB97} = {2BD26A09-E1B6-42E2-A0D0-63987B76BB97} EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SFML", "SFML", "{C6D36691-1669-4189-AAB8-06C9932C2A45}" @@ -98,16 +101,16 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{3EE1 EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftp", "..\..\samples\build\vc2005\ftp.vcproj", "{7236920B-254C-43A3-9DC1-778B477226DF}" ProjectSection(ProjectDependencies) = postProject - {823DDC98-42D5-4A38-88CF-9DC06C788AE4} = {823DDC98-42D5-4A38-88CF-9DC06C788AE4} {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} + {823DDC98-42D5-4A38-88CF-9DC06C788AE4} = {823DDC98-42D5-4A38-88CF-9DC06C788AE4} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shader", "..\..\samples\build\vc2005\shader.vcproj", "{E8B7727D-2308-4ADC-90AE-D3F46798447D}" ProjectSection(ProjectDependencies) = postProject - {2BD26A09-E1B6-42E2-A0D0-63987B76BB97} = {2BD26A09-E1B6-42E2-A0D0-63987B76BB97} - {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} - {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} = {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} = {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} + {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} + {2BD26A09-E1B6-42E2-A0D0-63987B76BB97} = {2BD26A09-E1B6-42E2-A0D0-63987B76BB97} EndProjectSection EndProject Global diff --git a/include/SFML/Network/Selector.hpp b/include/SFML/Network/Selector.hpp index ffb071a5..7eb97da9 100644 --- a/include/SFML/Network/Selector.hpp +++ b/include/SFML/Network/Selector.hpp @@ -89,7 +89,7 @@ public : /// \return The index-th socket /// //////////////////////////////////////////////////////////// - Type GetSocketReady(unsigned int index); + Type GetSocketReady(unsigned int index) const; private : diff --git a/include/SFML/Network/Selector.inl b/include/SFML/Network/Selector.inl index 2c905f1f..0a58f63f 100644 --- a/include/SFML/Network/Selector.inl +++ b/include/SFML/Network/Selector.inl @@ -85,7 +85,7 @@ unsigned int Selector::Wait(float timeout) /// is the integer returned by the previous call to Wait() //////////////////////////////////////////////////////////// template -Type Selector::GetSocketReady(unsigned int index) +Type Selector::GetSocketReady(unsigned int index) const { SocketHelper::SocketType socket = SelectorBase::GetSocketReady(index); diff --git a/include/SFML/Network/SelectorBase.hpp b/include/SFML/Network/SelectorBase.hpp index a032aa04..d31234e7 100644 --- a/include/SFML/Network/SelectorBase.hpp +++ b/include/SFML/Network/SelectorBase.hpp @@ -94,7 +94,7 @@ public : /// \return The index-th socket /// //////////////////////////////////////////////////////////// - SocketHelper::SocketType GetSocketReady(unsigned int index); + SocketHelper::SocketType GetSocketReady(unsigned int index) const; private : diff --git a/src/SFML/Network/SelectorBase.cpp b/src/SFML/Network/SelectorBase.cpp index 9e7b2f4e..c3e37e55 100644 --- a/src/SFML/Network/SelectorBase.cpp +++ b/src/SFML/Network/SelectorBase.cpp @@ -105,7 +105,7 @@ unsigned int SelectorBase::Wait(float timeout) /// ready for reading. The total number of sockets ready /// is the integer returned by the previous call to Wait() //////////////////////////////////////////////////////////// -SocketHelper::SocketType SelectorBase::GetSocketReady(unsigned int index) +SocketHelper::SocketType SelectorBase::GetSocketReady(unsigned int index) const { // The standard FD_xxx interface doesn't define a direct access, // so we must go through the whole set to find the socket we're looking for