Skip to content

Commit 49b1558

Browse files
committed
Add missing SetMinimum/MaximumSize to the window classes
1 parent 5ba0328 commit 49b1558

File tree

3 files changed

+89
-5
lines changed

3 files changed

+89
-5
lines changed

src/SFML.Graphics/RenderWindow.cs

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,28 @@ public override Vector2u Size
143143
////////////////////////////////////////////////////////////
144144
public bool IsSrgb => sfRenderWindow_isSrgb(CPointer);
145145

146+
////////////////////////////////////////////////////////////
147+
/// <summary>
148+
/// Set the minimum window rendering region size
149+
/// </summary>
150+
/// <param name="minimumSize">New minimum size, in pixels, null to reset the minimum size</param>
151+
////////////////////////////////////////////////////////////
152+
public override void SetMinimumSize(Vector2u? minimumSize)
153+
{
154+
sfRenderWindow_setMinimumSize(CPointer, minimumSizeRef);
155+
}
156+
157+
////////////////////////////////////////////////////////////
158+
/// <summary>
159+
/// Set the maximum window rendering region size
160+
/// </summary>
161+
/// <param name="maximumSize">New maximum size, in pixels, null to reset the maximum size</param>
162+
////////////////////////////////////////////////////////////
163+
public override void SetMaximumSize(Vector2u? maximumSize)
164+
{
165+
sfRenderWindow_setMaximumSize(CPointer, maximumSizeRef);
166+
}
167+
146168
////////////////////////////////////////////////////////////
147169
/// <summary>
148170
/// Change the title of the window
@@ -210,7 +232,7 @@ public override void SetIcon(Vector2u size, byte[] pixels)
210232
/// Grab or release the mouse cursor
211233
/// </summary>
212234
/// <param name="grabbed">True to grab, false to release</param>
213-
///
235+
///
214236
/// <remarks>
215237
/// If set, grabs the mouse cursor inside this window's client
216238
/// area so it may no longer be moved outside its bounds.
@@ -329,7 +351,7 @@ public override void SetIcon(Vector2u size, byte[] pixels)
329351
/// The specified stencil value is truncated to the bit
330352
/// width of the current stencil buffer.
331353
/// </summary>
332-
/// <param name="color">Fill color to use to clear the render target</param>
354+
/// <param name="color">Fill color to use to clear the render target</param>
333355
/// <param name="stencilValue">Stencil value to clear to</param>
334356
////////////////////////////////////////////////////////////
335357
public void Clear(Color color, StencilValue stencilValue) => sfRenderWindow_clearColorAndStencil(CPointer, color, stencilValue);
@@ -548,7 +570,7 @@ public void Draw(Vertex[] vertices, uint start, uint count, PrimitiveType type,
548570
/// <summary>
549571
/// Save the current OpenGL render states and matrices.
550572
/// </summary>
551-
///
573+
///
552574
/// <example>
553575
/// // OpenGL code here...
554576
/// window.PushGLStates();
@@ -602,7 +624,7 @@ public void Draw(Vertex[] vertices, uint start, uint count, PrimitiveType type,
602624
/// states needed by SFML are set, so that subsequent Draw()
603625
/// calls will work as expected.
604626
/// </remarks>
605-
///
627+
///
606628
/// <example>
607629
/// // OpenGL code here...
608630
/// glPushAttrib(...);
@@ -761,6 +783,12 @@ private void Initialize()
761783
[DllImport(CSFML.Graphics, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
762784
private static extern void sfRenderWindow_setSize(IntPtr cPointer, Vector2u size);
763785

786+
[DllImport(CSFML.Graphics, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
787+
private static extern void sfRenderWindow_setMinimumSize(IntPtr cPointer, Vector2u* minimumSize);
788+
789+
[DllImport(CSFML.Graphics, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
790+
private static extern void sfRenderWindow_setMaximumSize(IntPtr cPointer, Vector2u* maximumSize);
791+
764792
[DllImport(CSFML.Graphics, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
765793
private static extern void sfRenderWindow_setUnicodeTitle(IntPtr cPointer, IntPtr title);
766794

src/SFML.Window/Window.cs

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,28 @@ public override void SetTitle(string title)
162162
}
163163
}
164164

165+
////////////////////////////////////////////////////////////
166+
/// <summary>
167+
/// Set the minimum window rendering region size
168+
/// </summary>
169+
/// <param name="minimumSize">New minimum size, in pixels, null to reset the minimum size</param>
170+
////////////////////////////////////////////////////////////
171+
public override void SetMinimumSize(Vector2u? minimumSize)
172+
{
173+
sfWindow_setMinimumSize(CPointer, minimumSizeRef);
174+
}
175+
176+
////////////////////////////////////////////////////////////
177+
/// <summary>
178+
/// Set the maximum window rendering region size
179+
/// </summary>
180+
/// <param name="maximumSize">New maximum size, in pixels, null to reset the maximum size</param>
181+
////////////////////////////////////////////////////////////
182+
public override void SetMaximumSize(Vector2u? maximumSize)
183+
{
184+
sfWindow_setMaximumSize(CPointer, maximumSizeRef);
185+
}
186+
165187
////////////////////////////////////////////////////////////
166188
/// <summary>
167189
/// Change the window's icon
@@ -201,7 +223,7 @@ public override void SetIcon(Vector2u size, byte[] pixels)
201223
/// Grab or release the mouse cursor
202224
/// </summary>
203225
/// <param name="grabbed">True to grab, false to release</param>
204-
///
226+
///
205227
/// <remarks>
206228
/// If set, grabs the mouse cursor inside this window's client
207229
/// area so it may no longer be moved outside its bounds.
@@ -441,6 +463,12 @@ protected Window(IntPtr cPointer, int dummy) :
441463
[DllImport(CSFML.Window, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
442464
private static extern void sfWindow_setSize(IntPtr cPointer, Vector2u size);
443465

466+
[DllImport(CSFML.Window, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
467+
private static extern void sfWindow_setMinimumSize(IntPtr cPointer, Vector2u* minimumSize);
468+
469+
[DllImport(CSFML.Window, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
470+
private static extern void sfWindow_setMaximumSize(IntPtr cPointer, Vector2u* maximumSize);
471+
444472
[DllImport(CSFML.Window, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
445473
private static extern void sfWindow_setUnicodeTitle(IntPtr cPointer, IntPtr title);
446474

src/SFML.Window/WindowBase.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,28 @@ public virtual Vector2u Size
139139
set => sfWindowBase_setSize(CPointer, value);
140140
}
141141

142+
////////////////////////////////////////////////////////////
143+
/// <summary>
144+
/// Set the minimum window rendering region size
145+
/// </summary>
146+
/// <param name="minimumSize">New minimum size, in pixels, null to reset the minimum size</param>
147+
////////////////////////////////////////////////////////////
148+
public virtual void SetMinimumSize(Vector2u? minimumSize)
149+
{
150+
sfWindowBase_setMinimumSize(CPointer, minimumSizeRef);
151+
}
152+
153+
////////////////////////////////////////////////////////////
154+
/// <summary>
155+
/// Set the maximum window rendering region size
156+
/// </summary>
157+
/// <param name="maximumSize">New maximum size, in pixels, null to reset the maximum size</param>
158+
////////////////////////////////////////////////////////////
159+
public virtual void SetMaximumSize(Vector2u? maximumSize)
160+
{
161+
sfWindowBase_setMaximumSize(CPointer, maximumSizeRef);
162+
}
163+
142164
////////////////////////////////////////////////////////////
143165
/// <summary>
144166
/// Change the title of the window
@@ -615,6 +637,12 @@ private void CallEventHandler(Event e)
615637
[DllImport(CSFML.Window, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
616638
private static extern void sfWindowBase_setSize(IntPtr cPointer, Vector2u size);
617639

640+
[DllImport(CSFML.Window, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
641+
private static extern void sfWindowBase_setMinimumSize(IntPtr cPointer, Vector2u* minimumSize);
642+
643+
[DllImport(CSFML.Window, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
644+
private static extern void sfWindowBase_setMaximumSize(IntPtr cPointer, Vector2u* maximumSize);
645+
618646
[DllImport(CSFML.Window, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
619647
private static extern void sfWindowBase_setUnicodeTitle(IntPtr cPointer, IntPtr title);
620648

0 commit comments

Comments
 (0)