mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-03-04 04:56:36 +00:00
adding support for changing window position
mlx_set_window_position(void *mlx, void *win, int x, int y)
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include <SDL2/SDL_video.h>
|
||||
#include <algorithm>
|
||||
#include <core/application.h>
|
||||
|
||||
@@ -71,6 +72,16 @@ namespace mlx::core
|
||||
_in->onEvent(_graphics[*static_cast<int*>(win)]->getWindow()->getID(), event, funct_ptr, param);
|
||||
}
|
||||
|
||||
void Application::setWindowPosition(void *win, int x, int y) {
|
||||
CHECK_WINDOW_PTR(win);
|
||||
if(!_graphics[*static_cast<int*>(win)]->hasWindow())
|
||||
{
|
||||
error::report(e_kind::warning, "trying to move a window that is targeting an image and not a real window, this is not allowed");
|
||||
return;
|
||||
}
|
||||
SDL_SetWindowPosition(_graphics[*static_cast<int*>(win)]->getWindow()->getNativeWindow(), x, y);
|
||||
}
|
||||
|
||||
void Application::getScreenSize(void* win, int* w, int* h) noexcept
|
||||
{
|
||||
CHECK_WINDOW_PTR(win);
|
||||
|
||||
Reference in New Issue
Block a user