mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-11 14:43:34 +00:00
adding missing function implementation
This commit is contained in:
@@ -80,6 +80,51 @@ extern "C"
|
||||
gs->GetWindow()->SetPosition(x, y);
|
||||
}
|
||||
|
||||
void mlx_set_window_size(mlx_context mlx, mlx_window win, int width, int height)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
mlx::NonOwningPtr<mlx::GraphicsSupport> gs = mlx->app->GetGraphicsSupport(win);
|
||||
if(!gs && !gs->HasWindow())
|
||||
return;
|
||||
gs->GetWindow()->SetSize(width, height);
|
||||
}
|
||||
|
||||
void mlx_set_window_title(mlx_context mlx, mlx_window win, const char* title)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
mlx::NonOwningPtr<mlx::GraphicsSupport> gs = mlx->app->GetGraphicsSupport(win);
|
||||
if(!gs && !gs->HasWindow())
|
||||
return;
|
||||
gs->GetWindow()->SetTitle(title);
|
||||
}
|
||||
|
||||
void mlx_set_window_fullscreen(mlx_context mlx, mlx_window win, bool enable)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
mlx::NonOwningPtr<mlx::GraphicsSupport> gs = mlx->app->GetGraphicsSupport(win);
|
||||
if(!gs && !gs->HasWindow())
|
||||
return;
|
||||
gs->GetWindow()->SetFullscreen(enable);
|
||||
}
|
||||
|
||||
void mlx_get_window_position(mlx_context mlx, mlx_window win, int* x, int* y)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
mlx::NonOwningPtr<mlx::GraphicsSupport> gs = mlx->app->GetGraphicsSupport(win);
|
||||
if(!gs && !gs->HasWindow())
|
||||
return;
|
||||
gs->GetWindow()->GetPosition(x, y);
|
||||
}
|
||||
|
||||
void mlx_get_window_size(mlx_context mlx, mlx_window win, int* x, int* y)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
mlx::NonOwningPtr<mlx::GraphicsSupport> gs = mlx->app->GetGraphicsSupport(win);
|
||||
if(!gs && !gs->HasWindow())
|
||||
return;
|
||||
gs->GetWindow()->GetSize(x, y);
|
||||
}
|
||||
|
||||
void mlx_clear_window(mlx_context mlx, mlx_window win, int color)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
|
||||
@@ -133,6 +133,31 @@ namespace mlx
|
||||
SDL_SetWindowPosition(static_cast<Internal::WindowInfos*>(window)->window, x, y);
|
||||
}
|
||||
|
||||
void SDLManager::SetWindowSize(Handle window, int x, int y) const noexcept
|
||||
{
|
||||
SDL_SetWindowSize(static_cast<Internal::WindowInfos*>(window)->window, x, y);
|
||||
}
|
||||
|
||||
void SDLManager::SetWindowTitle(Handle window, std::string_view title) const noexcept
|
||||
{
|
||||
SDL_SetWindowTitle(static_cast<Internal::WindowInfos*>(window)->window, title.data());
|
||||
}
|
||||
|
||||
void SDLManager::SetWindowFullscreen(Handle window, bool enable) const noexcept
|
||||
{
|
||||
SDL_SetWindowFullscreen(static_cast<Internal::WindowInfos*>(window)->window, (enable ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0));
|
||||
}
|
||||
|
||||
void SDLManager::GetWindowPosition(Handle window, int* x, int* y) const noexcept
|
||||
{
|
||||
SDL_GetWindowPosition(static_cast<Internal::WindowInfos*>(window)->window, x, y);
|
||||
}
|
||||
|
||||
void SDLManager::GetWindowSize(Handle window, int* x, int* y) const noexcept
|
||||
{
|
||||
SDL_GetWindowSize(static_cast<Internal::WindowInfos*>(window)->window, x, y);
|
||||
}
|
||||
|
||||
void SDLManager::HideCursor() noexcept
|
||||
{
|
||||
SDL_ShowCursor(SDL_DISABLE);
|
||||
|
||||
@@ -214,6 +214,7 @@ namespace mlx
|
||||
return;
|
||||
if(!m_staging_buffer.has_value())
|
||||
OpenCPUBuffer();
|
||||
// Needs to reverse bytes order because why not
|
||||
unsigned char bytes[4];
|
||||
bytes[0] = (color >> 24) & 0xFF;
|
||||
bytes[1] = (color >> 16) & 0xFF;
|
||||
|
||||
Reference in New Issue
Block a user