Skip to content

Commit e39a0b1

Browse files
eXpl0it3rChrisThrasher
authored andcommitted
Add missing setMinimumSize and setMaximumSize window methods
1 parent aa236c2 commit e39a0b1

File tree

6 files changed

+164
-0
lines changed

6 files changed

+164
-0
lines changed

include/CSFML/Graphics/RenderWindow.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,28 @@ CSFML_GRAPHICS_API bool sfRenderWindow_isSrgb(const sfRenderWindow* renderWindow
216216
////////////////////////////////////////////////////////////
217217
CSFML_GRAPHICS_API void sfRenderWindow_setSize(sfRenderWindow* renderWindow, sfVector2u size);
218218

219+
////////////////////////////////////////////////////////////
220+
/// \brief Set the minimum window rendering region size
221+
///
222+
/// Pass a `NULL` vector to unset the minimum size
223+
///
224+
/// \param renderWindow Render window object
225+
/// \param minimumSize New minimum size, in pixels
226+
///
227+
////////////////////////////////////////////////////////////
228+
CSFML_GRAPHICS_API void sfRenderWindow_setMinimumSize(sfRenderWindow* renderWindow, const sfVector2u* minimumSize);
229+
230+
////////////////////////////////////////////////////////////
231+
/// \brief Set the maximum window rendering region size
232+
///
233+
/// Pass a `NULL` vector to unset the maximum size
234+
///
235+
/// \param renderWindow Render window object
236+
/// \param maximumSize New maximum size, in pixels
237+
///
238+
////////////////////////////////////////////////////////////
239+
CSFML_GRAPHICS_API void sfRenderWindow_setMaximumSize(sfRenderWindow* renderWindow, const sfVector2u* maximumSize);
240+
219241
////////////////////////////////////////////////////////////
220242
/// \brief Change the title of a render window
221243
///

include/CSFML/Window/Window.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,28 @@ CSFML_WINDOW_API sfVector2u sfWindow_getSize(const sfWindow* window);
280280
////////////////////////////////////////////////////////////
281281
CSFML_WINDOW_API void sfWindow_setSize(sfWindow* window, sfVector2u size);
282282

283+
////////////////////////////////////////////////////////////
284+
/// \brief Set the minimum window rendering region size
285+
///
286+
/// Pass a `NULL` vector to unset the minimum size
287+
///
288+
/// \param window Window object
289+
/// \param minimumSize New minimum size, in pixels
290+
///
291+
////////////////////////////////////////////////////////////
292+
CSFML_WINDOW_API void sfWindow_setMinimumSize(sfWindow* window, const sfVector2u* minimumSize);
293+
294+
////////////////////////////////////////////////////////////
295+
/// \brief Set the maximum window rendering region size
296+
///
297+
/// Pass a `NULL` vector to unset the maximum size
298+
///
299+
/// \param window Window object
300+
/// \param maximumSize New maximum size, in pixels
301+
///
302+
////////////////////////////////////////////////////////////
303+
CSFML_WINDOW_API void sfWindow_setMaximumSize(sfWindow* window, const sfVector2u* maximumSize);
304+
283305
////////////////////////////////////////////////////////////
284306
/// \brief Change the title of a window
285307
///

include/CSFML/Window/WindowBase.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,28 @@ CSFML_WINDOW_API sfVector2u sfWindowBase_getSize(const sfWindowBase* windowBase)
236236
////////////////////////////////////////////////////////////
237237
CSFML_WINDOW_API void sfWindowBase_setSize(sfWindowBase* windowBase, sfVector2u size);
238238

239+
////////////////////////////////////////////////////////////
240+
/// \brief Set the minimum window rendering region size
241+
///
242+
/// Pass a `NULL` vector to unset the minimum size
243+
///
244+
/// \param windowBase Window object
245+
/// \param minimumSize New minimum size, in pixels
246+
///
247+
////////////////////////////////////////////////////////////
248+
CSFML_WINDOW_API void sfWindowBase_setMinimumSize(sfWindowBase* windowBase, const sfVector2u* minimumSize);
249+
250+
////////////////////////////////////////////////////////////
251+
/// \brief Set the maximum window rendering region size
252+
///
253+
/// Pass a `NULL` vector to unset the maximum size
254+
///
255+
/// \param windowBase Window object
256+
/// \param maximumSize New maximum size, in pixels
257+
///
258+
////////////////////////////////////////////////////////////
259+
CSFML_WINDOW_API void sfWindowBase_setMaximumSize(sfWindowBase* windowBase, const sfVector2u* maximumSize);
260+
239261
////////////////////////////////////////////////////////////
240262
/// \brief Change the title of a window
241263
///

src/CSFML/Graphics/RenderWindow.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,38 @@ void sfRenderWindow_setSize(sfRenderWindow* renderWindow, sfVector2u size)
198198
}
199199

200200

201+
////////////////////////////////////////////////////////////
202+
void sfRenderWindow_setMinimumSize(sfRenderWindow* renderWindow, const sfVector2u* minimumSize)
203+
{
204+
assert(renderWindow);
205+
206+
if (minimumSize == nullptr)
207+
{
208+
renderWindow->setMinimumSize(std::nullopt);
209+
}
210+
else
211+
{
212+
renderWindow->setMinimumSize(convertVector2(*minimumSize));
213+
}
214+
}
215+
216+
217+
////////////////////////////////////////////////////////////
218+
void sfRenderWindow_setMaximumSize(sfRenderWindow* renderWindow, const sfVector2u* maximumSize)
219+
{
220+
assert(renderWindow);
221+
222+
if (maximumSize == nullptr)
223+
{
224+
renderWindow->setMaximumSize(std::nullopt);
225+
}
226+
else
227+
{
228+
renderWindow->setMaximumSize(convertVector2(*maximumSize));
229+
}
230+
}
231+
232+
201233
////////////////////////////////////////////////////////////
202234
void sfRenderWindow_setTitle(sfRenderWindow* renderWindow, const char* title)
203235
{

src/CSFML/Window/Window.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,38 @@ void sfWindow_setSize(sfWindow* window, sfVector2u size)
159159
}
160160

161161

162+
////////////////////////////////////////////////////////////
163+
void sfWindow_setMinimumSize(sfWindow* window, const sfVector2u* minimumSize)
164+
{
165+
assert(window);
166+
167+
if (minimumSize == nullptr)
168+
{
169+
window->setMinimumSize(std::nullopt);
170+
}
171+
else
172+
{
173+
window->setMinimumSize(convertVector2(*minimumSize));
174+
}
175+
}
176+
177+
178+
////////////////////////////////////////////////////////////
179+
void sfWindow_setMaximumSize(sfWindow* window, const sfVector2u* maximumSize)
180+
{
181+
assert(window);
182+
183+
if (maximumSize == nullptr)
184+
{
185+
window->setMaximumSize(std::nullopt);
186+
}
187+
else
188+
{
189+
window->setMaximumSize(convertVector2(*maximumSize));
190+
}
191+
}
192+
193+
162194
////////////////////////////////////////////////////////////
163195
void sfWindow_setTitle(sfWindow* window, const char* title)
164196
{

src/CSFML/Window/WindowBase.cpp

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434

3535
#include <SFML/Window/VideoMode.hpp>
3636

37+
#include <optional>
38+
3739

3840
////////////////////////////////////////////////////////////
3941
sfWindowBase* sfWindowBase_create(sfVideoMode mode, const char* title, uint32_t style, sfWindowState state)
@@ -141,6 +143,38 @@ void sfWindowBase_setSize(sfWindowBase* windowBase, sfVector2u size)
141143
}
142144

143145

146+
////////////////////////////////////////////////////////////
147+
void sfWindowBase_setMinimumSize(sfWindowBase* windowBase, const sfVector2u* minimumSize)
148+
{
149+
assert(windowBase);
150+
151+
if (minimumSize == nullptr)
152+
{
153+
windowBase->setMinimumSize(std::nullopt);
154+
}
155+
else
156+
{
157+
windowBase->setMinimumSize(convertVector2(*minimumSize));
158+
}
159+
}
160+
161+
162+
////////////////////////////////////////////////////////////
163+
void sfWindowBase_setMaximumSize(sfWindowBase* windowBase, const sfVector2u* maximumSize)
164+
{
165+
assert(windowBase);
166+
167+
if (maximumSize == nullptr)
168+
{
169+
windowBase->setMaximumSize(std::nullopt);
170+
}
171+
else
172+
{
173+
windowBase->setMaximumSize(convertVector2(*maximumSize));
174+
}
175+
}
176+
177+
144178
////////////////////////////////////////////////////////////
145179
void sfWindowBase_setTitle(sfWindowBase* windowBase, const char* title)
146180
{

0 commit comments

Comments
 (0)