mirror of
https://github.com/SFML/CSFML.git
synced 2026-10-24 21:53:37 +02:00
Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf80a809f3 | ||
|
|
e39a0b1ab8 | ||
|
|
aa236c2207 | ||
|
|
17039984c5 | ||
|
|
f1e6cccb56 | ||
|
|
82884b379f |
No files matched your search
@@ -22,8 +22,6 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform:
|
||||
- { name: Windows VS2019 x86, os: windows-2019, flags: -AWin32 }
|
||||
- { name: Windows VS2019 x64, os: windows-2019, flags: -Ax64 }
|
||||
- { name: Windows VS2022 x86, os: windows-2022, flags: -AWin32 }
|
||||
- { name: Windows VS2022 x64, os: windows-2022, flags: -Ax64 }
|
||||
- { name: Windows ClangCL, os: windows-2022, flags: -T ClangCL }
|
||||
@@ -42,6 +40,7 @@ jobs:
|
||||
- name: Get CMake and Ninja
|
||||
uses: lukka/get-cmake@latest
|
||||
with:
|
||||
cmakeVersion: ${{ runner.os == 'Windows' && '3.25' || '3.22' }}
|
||||
ninjaVersion: latest
|
||||
|
||||
- name: Install Linux Dependencies
|
||||
|
||||
@@ -216,6 +216,28 @@ CSFML_GRAPHICS_API bool sfRenderWindow_isSrgb(const sfRenderWindow* renderWindow
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_setSize(sfRenderWindow* renderWindow, sfVector2u size);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the minimum window rendering region size
|
||||
///
|
||||
/// Pass a `NULL` vector to unset the minimum size
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
/// \param minimumSize New minimum size, in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_setMinimumSize(sfRenderWindow* renderWindow, const sfVector2u* minimumSize);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the maximum window rendering region size
|
||||
///
|
||||
/// Pass a `NULL` vector to unset the maximum size
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
/// \param maximumSize New maximum size, in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_setMaximumSize(sfRenderWindow* renderWindow, const sfVector2u* maximumSize);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change the title of a render window
|
||||
///
|
||||
|
||||
@@ -280,6 +280,28 @@ CSFML_WINDOW_API sfVector2u sfWindow_getSize(const sfWindow* window);
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_WINDOW_API void sfWindow_setSize(sfWindow* window, sfVector2u size);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the minimum window rendering region size
|
||||
///
|
||||
/// Pass a `NULL` vector to unset the minimum size
|
||||
///
|
||||
/// \param window Window object
|
||||
/// \param minimumSize New minimum size, in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_WINDOW_API void sfWindow_setMinimumSize(sfWindow* window, const sfVector2u* minimumSize);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the maximum window rendering region size
|
||||
///
|
||||
/// Pass a `NULL` vector to unset the maximum size
|
||||
///
|
||||
/// \param window Window object
|
||||
/// \param maximumSize New maximum size, in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_WINDOW_API void sfWindow_setMaximumSize(sfWindow* window, const sfVector2u* maximumSize);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change the title of a window
|
||||
///
|
||||
|
||||
@@ -236,6 +236,28 @@ CSFML_WINDOW_API sfVector2u sfWindowBase_getSize(const sfWindowBase* windowBase)
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_WINDOW_API void sfWindowBase_setSize(sfWindowBase* windowBase, sfVector2u size);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the minimum window rendering region size
|
||||
///
|
||||
/// Pass a `NULL` vector to unset the minimum size
|
||||
///
|
||||
/// \param windowBase Window object
|
||||
/// \param minimumSize New minimum size, in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_WINDOW_API void sfWindowBase_setMinimumSize(sfWindowBase* windowBase, const sfVector2u* minimumSize);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the maximum window rendering region size
|
||||
///
|
||||
/// Pass a `NULL` vector to unset the maximum size
|
||||
///
|
||||
/// \param windowBase Window object
|
||||
/// \param maximumSize New maximum size, in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_WINDOW_API void sfWindowBase_setMaximumSize(sfWindowBase* windowBase, const sfVector2u* maximumSize);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change the title of a window
|
||||
///
|
||||
|
||||
@@ -18,6 +18,7 @@ Development is focused on the next major version in the `master` branch. No more
|
||||
- Lukas Dürrenberger (eXpl0it3r@sfml-dev.org)
|
||||
- Chris Thrasher (thrasher@sfml-dev.org)
|
||||
- Zachariah Brown (contact@zbrown.net)
|
||||
- And many other members of the SFML community
|
||||
|
||||
## Download
|
||||
|
||||
|
||||
@@ -198,6 +198,38 @@ void sfRenderWindow_setSize(sfRenderWindow* renderWindow, sfVector2u size)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfRenderWindow_setMinimumSize(sfRenderWindow* renderWindow, const sfVector2u* minimumSize)
|
||||
{
|
||||
assert(renderWindow);
|
||||
|
||||
if (minimumSize == nullptr)
|
||||
{
|
||||
renderWindow->setMinimumSize(std::nullopt);
|
||||
}
|
||||
else
|
||||
{
|
||||
renderWindow->setMinimumSize(convertVector2(*minimumSize));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfRenderWindow_setMaximumSize(sfRenderWindow* renderWindow, const sfVector2u* maximumSize)
|
||||
{
|
||||
assert(renderWindow);
|
||||
|
||||
if (maximumSize == nullptr)
|
||||
{
|
||||
renderWindow->setMaximumSize(std::nullopt);
|
||||
}
|
||||
else
|
||||
{
|
||||
renderWindow->setMaximumSize(convertVector2(*maximumSize));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfRenderWindow_setTitle(sfRenderWindow* renderWindow, const char* title)
|
||||
{
|
||||
|
||||
@@ -159,6 +159,38 @@ void sfWindow_setSize(sfWindow* window, sfVector2u size)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfWindow_setMinimumSize(sfWindow* window, const sfVector2u* minimumSize)
|
||||
{
|
||||
assert(window);
|
||||
|
||||
if (minimumSize == nullptr)
|
||||
{
|
||||
window->setMinimumSize(std::nullopt);
|
||||
}
|
||||
else
|
||||
{
|
||||
window->setMinimumSize(convertVector2(*minimumSize));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfWindow_setMaximumSize(sfWindow* window, const sfVector2u* maximumSize)
|
||||
{
|
||||
assert(window);
|
||||
|
||||
if (maximumSize == nullptr)
|
||||
{
|
||||
window->setMaximumSize(std::nullopt);
|
||||
}
|
||||
else
|
||||
{
|
||||
window->setMaximumSize(convertVector2(*maximumSize));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfWindow_setTitle(sfWindow* window, const char* title)
|
||||
{
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
|
||||
#include <SFML/Window/VideoMode.hpp>
|
||||
|
||||
#include <optional>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
sfWindowBase* sfWindowBase_create(sfVideoMode mode, const char* title, uint32_t style, sfWindowState state)
|
||||
@@ -141,6 +143,38 @@ void sfWindowBase_setSize(sfWindowBase* windowBase, sfVector2u size)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfWindowBase_setMinimumSize(sfWindowBase* windowBase, const sfVector2u* minimumSize)
|
||||
{
|
||||
assert(windowBase);
|
||||
|
||||
if (minimumSize == nullptr)
|
||||
{
|
||||
windowBase->setMinimumSize(std::nullopt);
|
||||
}
|
||||
else
|
||||
{
|
||||
windowBase->setMinimumSize(convertVector2(*minimumSize));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfWindowBase_setMaximumSize(sfWindowBase* windowBase, const sfVector2u* maximumSize)
|
||||
{
|
||||
assert(windowBase);
|
||||
|
||||
if (maximumSize == nullptr)
|
||||
{
|
||||
windowBase->setMaximumSize(std::nullopt);
|
||||
}
|
||||
else
|
||||
{
|
||||
windowBase->setMaximumSize(convertVector2(*maximumSize));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfWindowBase_setTitle(sfWindowBase* windowBase, const char* title)
|
||||
{
|
||||
|
||||
+2
-1
@@ -53,13 +53,14 @@ add_executable(test-csfml-graphics
|
||||
Graphics/RenderStates.test.cpp
|
||||
Graphics/Shape.test.cpp
|
||||
Graphics/StencilMode.test.cpp
|
||||
Graphics/Texture.test.cpp
|
||||
Graphics/Transform.test.cpp
|
||||
Graphics/VertexArray.test.cpp
|
||||
Graphics/View.test.cpp
|
||||
)
|
||||
target_link_libraries(test-csfml-graphics PRIVATE csfml-graphics Catch2::Catch2WithMain SFML::Graphics)
|
||||
set_target_warnings(test-csfml-graphics)
|
||||
catch_discover_tests(test-csfml-graphics)
|
||||
catch_discover_tests(test-csfml-graphics WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
add_executable(test-csfml-network
|
||||
Network/Ftp.test.cpp
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
#include <CSFML/Graphics/Texture.h>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <catch2/generators/catch_generators.hpp>
|
||||
|
||||
TEST_CASE("[Graphics] sfTexture")
|
||||
{
|
||||
SECTION("sfTexture_create")
|
||||
{
|
||||
const sfTexture* texture = sfTexture_create({100, 100});
|
||||
REQUIRE(texture);
|
||||
CHECK(sfTexture_getSize(texture).x == 100);
|
||||
CHECK(sfTexture_getSize(texture).y == 100);
|
||||
CHECK(!sfTexture_isSmooth(texture));
|
||||
CHECK(!sfTexture_isSrgb(texture));
|
||||
CHECK(!sfTexture_isRepeated(texture));
|
||||
CHECK(sfTexture_getNativeHandle(texture) != 0);
|
||||
sfTexture_destroy(texture);
|
||||
}
|
||||
|
||||
SECTION("sfTexture_createSrgb")
|
||||
{
|
||||
const sfTexture* texture = sfTexture_createSrgb({100, 100});
|
||||
REQUIRE(texture);
|
||||
CHECK(sfTexture_getSize(texture).x == 100);
|
||||
CHECK(sfTexture_getSize(texture).y == 100);
|
||||
CHECK(!sfTexture_isSmooth(texture));
|
||||
CHECK(sfTexture_isSrgb(texture));
|
||||
CHECK(!sfTexture_isRepeated(texture));
|
||||
CHECK(sfTexture_getNativeHandle(texture) != 0);
|
||||
sfTexture_destroy(texture);
|
||||
}
|
||||
|
||||
SECTION("sfTexture_createFromFile")
|
||||
{
|
||||
const char* fileExtension = GENERATE("bmp", "gif", "jpg", "png", "psd");
|
||||
const auto filename = std::string("Graphics/sfml-logo-big.") + fileExtension;
|
||||
INFO("Filename: " << filename);
|
||||
const sfTexture* texture = sfTexture_createFromFile(filename.c_str(), nullptr);
|
||||
REQUIRE(texture);
|
||||
CHECK(sfTexture_getSize(texture).x > 0);
|
||||
CHECK(sfTexture_getSize(texture).y > 0);
|
||||
CHECK(!sfTexture_isSmooth(texture));
|
||||
CHECK(!sfTexture_isSrgb(texture));
|
||||
CHECK(!sfTexture_isRepeated(texture));
|
||||
CHECK(sfTexture_getNativeHandle(texture) != 0);
|
||||
sfTexture_destroy(texture);
|
||||
}
|
||||
|
||||
SECTION("sfTexture_createSrgbFromFile")
|
||||
{
|
||||
const char* fileExtension = GENERATE("bmp", "gif", "jpg", "png", "psd");
|
||||
const auto filename = std::string("Graphics/sfml-logo-big.") + fileExtension;
|
||||
INFO("Filename: " << filename);
|
||||
const sfTexture* texture = sfTexture_createSrgbFromFile(filename.c_str(), nullptr);
|
||||
REQUIRE(texture);
|
||||
CHECK(sfTexture_getSize(texture).x > 0);
|
||||
CHECK(sfTexture_getSize(texture).y > 0);
|
||||
CHECK(!sfTexture_isSmooth(texture));
|
||||
CHECK(sfTexture_isSrgb(texture));
|
||||
CHECK(!sfTexture_isRepeated(texture));
|
||||
CHECK(sfTexture_getNativeHandle(texture) != 0);
|
||||
sfTexture_destroy(texture);
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 892 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 38 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 35 KiB |
Binary file not shown.
@@ -22,7 +22,8 @@ TEST_CASE("[Network] sfIpAddress")
|
||||
SECTION("sfIpAddress_fromString")
|
||||
{
|
||||
CHECK(sfIpAddress_toInteger(sfIpAddress_fromString("")) == 0);
|
||||
CHECK(sfIpAddress_toInteger(sfIpAddress_fromString("invalid address")) == 0);
|
||||
CHECK(sfIpAddress_toInteger(sfIpAddress_fromString("256.256.256.256")) == 0);
|
||||
CHECK(sfIpAddress_toInteger(sfIpAddress_fromString("localhost")) == 0x7F000001);
|
||||
CHECK(sfIpAddress_toInteger(sfIpAddress_fromString("192.168.0.1")) == 0xC0A80001);
|
||||
CHECK(sfIpAddress_toInteger(sfIpAddress_fromString("8.8.8.8")) == 0x08080808);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
|
||||
<Version>3.0.0</Version>
|
||||
<Version>3.0.0-rc.2</Version>
|
||||
<Authors>Laurent Gomila</Authors>
|
||||
<PackageTags>sfml csfml</PackageTags>
|
||||
<Copyright>Copyright © Laurent Gomila</Copyright>
|
||||
@@ -13,6 +13,7 @@
|
||||
<PackageProjectUrl>https://www.sfml-dev.org/</PackageProjectUrl>
|
||||
<PackageIconUrl>https://www.sfml-dev.org/images/sfml-icon.png</PackageIconUrl>
|
||||
<PackageIcon>sfml-icon.png</PackageIcon>
|
||||
<PackageReadmeFile>readme.md</PackageReadmeFile>
|
||||
|
||||
<PublishRepositoryUrl>true</PublishRepositoryUrl>
|
||||
<IncludeBuildOutput>false</IncludeBuildOutput>
|
||||
@@ -31,6 +32,7 @@
|
||||
<None Pack="True" Include="runtimes/**" PackagePath="runtimes" />
|
||||
<None Pack="True" Include="build/**" PackagePath="build" />
|
||||
<None Pack="True" Include="sfml-icon.png" PackagePath="/" />
|
||||
<None Pack="True" Include="readme.md" PackagePath="/" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,33 @@
|
||||
# CSFML - Simple and Fast Multimedia Library for C
|
||||
|
||||
SFML is a simple, fast, cross-platform and object-oriented multimedia API.
|
||||
It provides access to windowing, graphics, audio and network.
|
||||
It is originally written in C++, and this project is its official binding for the C language.
|
||||
|
||||
This NuGet package is designed to provide the required native CSFML libraries for SFML.Net.
|
||||
|
||||
## Authors
|
||||
|
||||
- Laurent Gomila (laurent@sfml-dev.org)
|
||||
- Lukas Dürrenberger (eXpl0it3r@sfml-dev.org)
|
||||
- Chris Thrasher (thrasher@sfml-dev.org)
|
||||
- Zachariah Brown (contact@zbrown.net)
|
||||
- And many other members of the SFML community
|
||||
|
||||
## Learn
|
||||
|
||||
There is no tutorial for CSFML, but since it's a binding you can use the C++ resources:
|
||||
|
||||
* The [official tutorials](https://www.sfml-dev.org/tutorials/)
|
||||
* The [online API documentation](https://www.sfml-dev.org/documentation/)
|
||||
* The [community wiki](https://github.com/SFML/SFML/wiki/)
|
||||
* The [community forum](https://en.sfml-dev.org/forums/) (or [French](https://fr.sfml-dev.org/forums/))
|
||||
|
||||
Of course, you can also find the CSFML API documentation in the SDK.
|
||||
|
||||
|
||||
## Contribute
|
||||
|
||||
SFML and CSFML are open-source projects, and they need your help to go on growing and improving.
|
||||
Don't hesitate to post suggestions or bug reports on [the forum](https://en.sfml-dev.org/forums/), or post new bugs/features requests on the [issue tracker](https://github.com/SFML/CSFML/issues/).
|
||||
You can even fork the project on GitHub, maintain your own version and send us pull requests periodically to merge your work.
|
||||
Reference in new issue
Block a user