mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-12 07:03:34 +00:00
implementing mouse move and get screen size, removing warnings
This commit is contained in:
@@ -7,10 +7,14 @@
|
||||
|
||||
static void* __mlx_ptr = nullptr;
|
||||
|
||||
#define MLX_CHECK_APPLICATION_POINTER(ptr) \
|
||||
if(ptr != __mlx_ptr || ptr == NULL) \
|
||||
mlx::FatalError("invalid mlx pointer passed to '%'", MLX_FUNC_SIG); \
|
||||
else {} // just to avoid issues with possible if-else statements outside this macro
|
||||
#ifndef DISABLE_ALL_SAFETIES
|
||||
#define MLX_CHECK_APPLICATION_POINTER(ptr) \
|
||||
if(ptr != __mlx_ptr || ptr == NULL) \
|
||||
mlx::FatalError("invalid mlx pointer passed to '%'", MLX_FUNC_SIG); \
|
||||
else {} // just to avoid issues with possible if-else statements outside this macro
|
||||
#else
|
||||
#define MLX_CHECK_APPLICATION_POINTER(ptr)
|
||||
#endif
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
@@ -6,8 +6,6 @@ namespace mlx
|
||||
GraphicsSupport::GraphicsSupport(std::size_t w, std::size_t h, NonOwningPtr<Texture> render_target, int id) :
|
||||
m_put_pixel_manager(&m_renderer),
|
||||
p_window(nullptr),
|
||||
m_width(w),
|
||||
m_height(h),
|
||||
m_id(id),
|
||||
m_has_window(false)
|
||||
{
|
||||
@@ -24,8 +22,6 @@ namespace mlx
|
||||
GraphicsSupport::GraphicsSupport(std::size_t w, std::size_t h, std::string title, int id) :
|
||||
m_put_pixel_manager(&m_renderer),
|
||||
p_window(std::make_shared<Window>(w, h, title)),
|
||||
m_width(w),
|
||||
m_height(h),
|
||||
m_id(id),
|
||||
m_has_window(true)
|
||||
{
|
||||
|
||||
@@ -159,6 +159,20 @@ namespace mlx
|
||||
return Vec2ui{ extent };
|
||||
}
|
||||
|
||||
void SDLManager::MoveMouseOnWindow(Handle window, int x, int y) const noexcept
|
||||
{
|
||||
SDL_WarpMouseInWindow(static_cast<SDL_Window*>(window), x, y);
|
||||
SDL_PumpEvents();
|
||||
}
|
||||
|
||||
void SDLManager::GetScreenSizeWindowIsOn(Handle window, int* x, int* y) const noexcept
|
||||
{
|
||||
SDL_DisplayMode DM;
|
||||
SDL_GetDesktopDisplayMode(SDL_GetWindowDisplayIndex(static_cast<SDL_Window*>(window)), &DM);
|
||||
*x = DM.w;
|
||||
*y = DM.h;
|
||||
}
|
||||
|
||||
std::int32_t SDLManager::GetX() const noexcept
|
||||
{
|
||||
int dummy;
|
||||
|
||||
Reference in New Issue
Block a user