Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ jobs:
- { name: macOS x64, os: macos-13 }
- { name: macOS ARM64, os: macos-14 }
dotnet:
- { name: .NET 6, version: "6.0.x" }
- { name: .NET 7, version: "7.0.x" }
- { name: .NET 8, version: "8.0.x" }
- { name: .NET 9, version: "9.0.x" }
- { name: .NET 10, version: "10.0.x" }

steps:
- name: Check out SFML.Net
Expand All @@ -48,15 +47,15 @@ jobs:
- name: Build SFML.Net
run: dotnet build --configuration Release --no-restore
- name: Test SFML.Net
if: matrix.dotnet.name == '.NET 6'
if: matrix.dotnet.name == '.NET 8'
run: dotnet test --configuration Release --no-restore
- name: Pack SFML.Net
run: dotnet pack --configuration Release -o Publish

- name: Install SFML.Net Examples Dependencies
run: dotnet restore examples/Examples.sln
- name: Build SFML.Net Examples
run: dotnet build --configuration Release --no-restore examples/Examples.sln
run: dotnet build --configuration Release --no-restore examples/Examples.sln

- name: Upload Artifact
uses: actions/upload-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion SFML.Module.props
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CSFML" Version="[3.0.0-rc.1, 3.1)" />
<PackageReference Include="CSFML" Version="[3.0.0-rc.3, 3.1)" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions SFML.NuGet.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<PackageProjectUrl>https://www.sfml-dev.org/</PackageProjectUrl>
<RepositoryUrl>https://github.com/SFML/SFML.Net</RepositoryUrl>
<PackageIcon>sfml-icon.png</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageReadmeFile>readme.md</PackageReadmeFile>

<PublishRepositoryUrl>true</PublishRepositoryUrl>
</PropertyGroup>
Expand All @@ -23,7 +23,7 @@
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="all" />

<None Include="../../sfml-icon.png" Pack="true" PackagePath=""/>
<None Include="README.md" Pack="true" PackagePath="."/>
<None Include="readme.md" Pack="true" PackagePath="."/>
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions SFML.sln
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
SFML.Module.props = SFML.Module.props
SFML.NuGet.props = SFML.NuGet.props
SFML.CodeStyle.props = SFML.CodeStyle.props
.github\workflows\ci.yml = .github\workflows\ci.yml
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SFML.System.Test", "test\SFML.System.Test\SFML.System.Test.csproj", "{958AC8B0-2D99-4C65-97C1-2979A090C82D}"
Expand Down
2 changes: 1 addition & 1 deletion examples/netcore/netcore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<Version>2.6.0</Version>
<Version>3.0.0</Version>
<Platforms>AnyCPU;x64;x86</Platforms>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion examples/netcore/README.md → examples/netcore/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ This project showcases how SFML.Net can be run on .NET core with NuGet packages.
To execute this example, just run `dotnet run` inside of this directory.

Please note that platform availability is still limited by native CSFML libraries.
For more information on that, check [the main README](/README.md).
For more information on that, check [the main readme](/readme.md).
2 changes: 1 addition & 1 deletion examples/opengl/opengl.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<RootNamespace>opengl</RootNamespace>
<AssemblyName>opengl</AssemblyName>
<Configurations>Debug;Release</Configurations>
<Version>2.6.0</Version>
<Version>3.0.0</Version>
<Platforms>AnyCPU;x64;x86</Platforms>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion examples/shader/shader.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<RootNamespace>shader</RootNamespace>
<AssemblyName>shader</AssemblyName>
<Configurations>Debug;Release</Configurations>
<Version>2.6.0</Version>
<Version>3.0.0</Version>
<Platforms>AnyCPU;x64;x86</Platforms>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion examples/sound/sound.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<RootNamespace>sound</RootNamespace>
<AssemblyName>sound</AssemblyName>
<Configurations>Debug;Release</Configurations>
<Version>2.6.0</Version>
<Version>3.0.0</Version>
<Platforms>AnyCPU;x64;x86</Platforms>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion examples/sound_capture/sound_capture.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<RootNamespace>sound_capture</RootNamespace>
<AssemblyName>sound_capture</AssemblyName>
<Configurations>Debug;Release</Configurations>
<Version>2.6.0</Version>
<Version>3.0.0</Version>
<Platforms>AnyCPU;x64;x86</Platforms>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion examples/visualbasic/visualbasic.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<UseWindowsForms>true</UseWindowsForms>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
<Version>2.6.0</Version>
<Version>3.0.0</Version>
<Platforms>AnyCPU;x64;x86</Platforms>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
Expand Down
2 changes: 1 addition & 1 deletion examples/window/window.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<RootNamespace>window</RootNamespace>
<AssemblyName>window</AssemblyName>
<Configurations>Debug;Release</Configurations>
<Version>2.6.0</Version>
<Version>3.0.0</Version>
<Platforms>AnyCPU;x64;x86</Platforms>
</PropertyGroup>

Expand Down
12 changes: 1 addition & 11 deletions license.txt → license.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
SFML.Net
--------

SFML.Net - Copyright (C) 2007-2023 Laurent Gomila - laurent@sfml-dev.org
SFML.Net - Copyright (C) 2007-2025 Laurent Gomila - laurent@sfml-dev.org

This software is provided 'as-is', without any express or
implied warranty. In no event will the authors be held
Expand All @@ -22,10 +19,3 @@ it freely, subject to the following restrictions:

3. This notice may not be removed or altered from any
source distribution.



External libraries used by SFML.Net
-----------------------------------

* CSFML is under the zlib/png license
4 changes: 4 additions & 0 deletions README.md → readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,7 @@ SFML and SFML.Net are open-source projects, and they need your help to go on gro
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/SFML.Net/issues/).
You can even fork the project on GitHub, maintain your own version and send us pull requests periodically to merge your work.

## External libraries used by SFML.Net

* [CSFML](https://github.com/SFML/CSFML/) is under the zlib/png license
58 changes: 54 additions & 4 deletions src/SFML.Graphics/RenderWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,50 @@ public override Vector2u Size
////////////////////////////////////////////////////////////
public bool IsSrgb => sfRenderWindow_isSrgb(CPointer);

////////////////////////////////////////////////////////////
/// <summary>
/// Set the minimum window rendering region size
/// </summary>
/// <param name="minimumSize">New minimum size, in pixels, null to reset the minimum size</param>
////////////////////////////////////////////////////////////
public override void SetMinimumSize(Vector2u? minimumSize)
{
unsafe
{
if (minimumSize.HasValue)
{
var minimumSizeRef = minimumSize.Value;
sfRenderWindow_setMinimumSize(CPointer, &minimumSizeRef);
}
else
{
sfRenderWindow_setMinimumSize(CPointer, null);
}
}
}

////////////////////////////////////////////////////////////
/// <summary>
/// Set the maximum window rendering region size
/// </summary>
/// <param name="maximumSize">New maximum size, in pixels, null to reset the maximum size</param>
////////////////////////////////////////////////////////////
public override void SetMaximumSize(Vector2u? maximumSize)
{
unsafe
{
if (maximumSize.HasValue)
{
var maximumSizeRef = maximumSize.Value;
sfRenderWindow_setMaximumSize(CPointer, &maximumSizeRef);
}
else
{
sfRenderWindow_setMaximumSize(CPointer, null);
}
}
}

////////////////////////////////////////////////////////////
/// <summary>
/// Change the title of the window
Expand Down Expand Up @@ -210,7 +254,7 @@ public override void SetIcon(Vector2u size, byte[] pixels)
/// Grab or release the mouse cursor
/// </summary>
/// <param name="grabbed">True to grab, false to release</param>
///
///
/// <remarks>
/// If set, grabs the mouse cursor inside this window's client
/// area so it may no longer be moved outside its bounds.
Expand Down Expand Up @@ -329,7 +373,7 @@ public override void SetIcon(Vector2u size, byte[] pixels)
/// The specified stencil value is truncated to the bit
/// width of the current stencil buffer.
/// </summary>
/// <param name="color">Fill color to use to clear the render target</param>
/// <param name="color">Fill color to use to clear the render target</param>
/// <param name="stencilValue">Stencil value to clear to</param>
////////////////////////////////////////////////////////////
public void Clear(Color color, StencilValue stencilValue) => sfRenderWindow_clearColorAndStencil(CPointer, color, stencilValue);
Expand Down Expand Up @@ -548,7 +592,7 @@ public void Draw(Vertex[] vertices, uint start, uint count, PrimitiveType type,
/// <summary>
/// Save the current OpenGL render states and matrices.
/// </summary>
///
///
/// <example>
/// // OpenGL code here...
/// window.PushGLStates();
Expand Down Expand Up @@ -602,7 +646,7 @@ public void Draw(Vertex[] vertices, uint start, uint count, PrimitiveType type,
/// states needed by SFML are set, so that subsequent Draw()
/// calls will work as expected.
/// </remarks>
///
///
/// <example>
/// // OpenGL code here...
/// glPushAttrib(...);
Expand Down Expand Up @@ -761,6 +805,12 @@ private void Initialize()
[DllImport(CSFML.Graphics, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
private static extern void sfRenderWindow_setSize(IntPtr cPointer, Vector2u size);

[DllImport(CSFML.Graphics, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
private static extern unsafe void sfRenderWindow_setMinimumSize(IntPtr cPointer, Vector2u* minimumSize);

[DllImport(CSFML.Graphics, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
private static extern unsafe void sfRenderWindow_setMaximumSize(IntPtr cPointer, Vector2u* maximumSize);

[DllImport(CSFML.Graphics, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
private static extern void sfRenderWindow_setUnicodeTitle(IntPtr cPointer, IntPtr title);

Expand Down
21 changes: 18 additions & 3 deletions src/SFML.Graphics/Texture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,15 @@ public Texture(Texture copy) :
////////////////////////////////////////////////////////////
public Image CopyToImage() => new Image(sfTexture_copyToImage(CPointer));

////////////////////////////////////////////////////////////
/// <summary>
/// Resize the texture.
/// </summary>
/// <param name="size">Width and height of the texture</param>
/// <param name="srgb">True to enable sRGB conversion, false to disable it</param>
////////////////////////////////////////////////////////////
public bool Resize(Vector2u size, bool srgb = false) => srgb ? sfTexture_resizeSrgb(CPointer, size) : sfTexture_resize(CPointer, size);

////////////////////////////////////////////////////////////
/// <summary>
/// Update a texture from an array of pixels
Expand Down Expand Up @@ -346,7 +355,7 @@ public void Update(byte[] pixels, Vector2u size, Vector2u dest)
/// <summary>
/// Generate a mipmap using the current texture data
/// </summary>
///
///
/// <remarks>
/// <para>Mipmaps are pre-computed chains of optimized textures. Each
/// level of texture in a mipmap is generated by halving each of
Expand All @@ -365,7 +374,7 @@ public void Update(byte[] pixels, Vector2u size, Vector2u dest)
/// modified, at which point this function will have to be called again to
/// regenerate it.</para>
/// </remarks>
///
///
/// <returns>True if mipmap generation was successful, false if unsuccessful</returns>
////////////////////////////////////////////////////////////
public bool GenerateMipmap() => sfTexture_generateMipmap(CPointer);
Expand Down Expand Up @@ -393,7 +402,7 @@ public bool Smooth
/// <summary>
/// Enable or disable conversion from sRGB
/// </summary>
///
///
/// <remarks>
/// <para>When providing texture data from an image file or memory, it can
/// either be stored in a linear color space or an sRGB color space.
Expand Down Expand Up @@ -538,6 +547,12 @@ protected override void Destroy(bool disposing)
[DllImport(CSFML.Graphics, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
private static extern void sfTexture_destroy(IntPtr texture);

[DllImport(CSFML.Graphics, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
private static extern bool sfTexture_resize(IntPtr texture, Vector2u size);

[DllImport(CSFML.Graphics, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
private static extern bool sfTexture_resizeSrgb(IntPtr texture, Vector2u size);

[DllImport(CSFML.Graphics, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
private static extern Vector2u sfTexture_getSize(IntPtr texture);

Expand Down
52 changes: 51 additions & 1 deletion src/SFML.Window/Window.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,50 @@ public override void SetTitle(string title)
}
}

////////////////////////////////////////////////////////////
/// <summary>
/// Set the minimum window rendering region size
/// </summary>
/// <param name="minimumSize">New minimum size, in pixels, null to reset the minimum size</param>
////////////////////////////////////////////////////////////
public override void SetMinimumSize(Vector2u? minimumSize)
{
unsafe
{
if (minimumSize.HasValue)
{
var minimumSizeRef = minimumSize.Value;
sfWindow_setMinimumSize(CPointer, &minimumSizeRef);
}
else
{
sfWindow_setMinimumSize(CPointer, null);
}
}
}

////////////////////////////////////////////////////////////
/// <summary>
/// Set the maximum window rendering region size
/// </summary>
/// <param name="maximumSize">New maximum size, in pixels, null to reset the maximum size</param>
////////////////////////////////////////////////////////////
public override void SetMaximumSize(Vector2u? maximumSize)
{
unsafe
{
if (maximumSize.HasValue)
{
var maximumSizeRef = maximumSize.Value;
sfWindow_setMaximumSize(CPointer, &maximumSizeRef);
}
else
{
sfWindow_setMaximumSize(CPointer, null);
}
}
}

////////////////////////////////////////////////////////////
/// <summary>
/// Change the window's icon
Expand Down Expand Up @@ -201,7 +245,7 @@ public override void SetIcon(Vector2u size, byte[] pixels)
/// Grab or release the mouse cursor
/// </summary>
/// <param name="grabbed">True to grab, false to release</param>
///
///
/// <remarks>
/// If set, grabs the mouse cursor inside this window's client
/// area so it may no longer be moved outside its bounds.
Expand Down Expand Up @@ -441,6 +485,12 @@ protected Window(IntPtr cPointer, int dummy) :
[DllImport(CSFML.Window, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
private static extern void sfWindow_setSize(IntPtr cPointer, Vector2u size);

[DllImport(CSFML.Window, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
private static extern unsafe void sfWindow_setMinimumSize(IntPtr cPointer, Vector2u* minimumSize);

[DllImport(CSFML.Window, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
private static extern unsafe void sfWindow_setMaximumSize(IntPtr cPointer, Vector2u* maximumSize);

[DllImport(CSFML.Window, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
private static extern void sfWindow_setUnicodeTitle(IntPtr cPointer, IntPtr title);

Expand Down
Loading
Loading