mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-11 22:53:34 +00:00
fixing warnings in kvf
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/10/04 16:56:35 by maldavid #+# #+# */
|
/* Created: 2022/10/04 16:56:35 by maldavid #+# #+# */
|
||||||
/* Updated: 2024/01/18 14:36:12 by maldavid ### ########.fr */
|
/* Updated: 2024/09/15 09:23:48 by maldavid ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -54,6 +54,17 @@ MLX_API void* mlx_init();
|
|||||||
MLX_API void* mlx_new_window(void* mlx, int w, int h, const char* title);
|
MLX_API void* mlx_new_window(void* mlx, int w, int h, const char* title);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Creates a new window
|
||||||
|
*
|
||||||
|
* @param mlx Internal MLX application
|
||||||
|
* @param win Internal window to move
|
||||||
|
* @param x New x position
|
||||||
|
* @param y New y position
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
MLX_API void mlx_set_window_position(void *mlx, void *win, int x, int y);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Gives a function to be executed at each loop turn
|
* @brief Gives a function to be executed at each loop turn
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ namespace mlx
|
|||||||
inline Handle NewGraphicsSuport(std::size_t w, std::size_t h, const char* title);
|
inline Handle NewGraphicsSuport(std::size_t w, std::size_t h, const char* title);
|
||||||
inline void ClearGraphicsSupport(Handle win);
|
inline void ClearGraphicsSupport(Handle win);
|
||||||
inline void DestroyGraphicsSupport(Handle win);
|
inline void DestroyGraphicsSupport(Handle win);
|
||||||
|
inline void SetGraphicsSupportPosition(Handle win, int x, int y);
|
||||||
|
|
||||||
inline void PixelPut(Handle win, int x, int y, std::uint32_t color) const noexcept;
|
inline void PixelPut(Handle win, int x, int y, std::uint32_t color) const noexcept;
|
||||||
inline void StringPut(Handle win, int x, int y, std::uint32_t color, char* str);
|
inline void StringPut(Handle win, int x, int y, std::uint32_t color, char* str);
|
||||||
|
|||||||
@@ -104,6 +104,15 @@ namespace mlx
|
|||||||
m_graphics.erase(m_graphics.begin() + *static_cast<int*>(win));
|
m_graphics.erase(m_graphics.begin() + *static_cast<int*>(win));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Application::SetGraphicsSupportPosition(Handle win, int x, int y)
|
||||||
|
{
|
||||||
|
CHECK_WINDOW_PTR(win);
|
||||||
|
if(!m_graphics[*static_cast<int*>(win)]->HasWindow())
|
||||||
|
Warning("trying to move a window that is targeting an image and not a real window, this is not allowed");
|
||||||
|
else
|
||||||
|
m_graphics[*static_cast<int*>(win)]->GetWindow()->SetPosition(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
void Application::PixelPut(Handle win, int x, int y, std::uint32_t color) const noexcept
|
void Application::PixelPut(Handle win, int x, int y, std::uint32_t color) const noexcept
|
||||||
{
|
{
|
||||||
MLX_PROFILE_FUNCTION();
|
MLX_PROFILE_FUNCTION();
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ namespace mlx
|
|||||||
Vec2ui GetVulkanDrawableSize(Handle window) const noexcept;
|
Vec2ui GetVulkanDrawableSize(Handle window) const noexcept;
|
||||||
void MoveMouseOnWindow(Handle window, int x, int y) const noexcept;
|
void MoveMouseOnWindow(Handle window, int x, int y) const noexcept;
|
||||||
void GetScreenSizeWindowIsOn(Handle window, int* x, int* y) const noexcept;
|
void GetScreenSizeWindowIsOn(Handle window, int* x, int* y) const noexcept;
|
||||||
|
void SetWindowPosition(Handle window, int x, int y) const noexcept;
|
||||||
|
|
||||||
inline void SetEventCallback(func::function<void(mlx_event_type, int, int, void*)> functor, void* userdata) { f_callback = std::move(functor); p_callback_data = userdata; }
|
inline void SetEventCallback(func::function<void(mlx_event_type, int, int, void*)> functor, void* userdata) { f_callback = std::move(functor); p_callback_data = userdata; }
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ namespace mlx
|
|||||||
|
|
||||||
inline void MoveMouse(int x, int y) { SDLManager::Get().MoveMouseOnWindow(p_window, x, y); }
|
inline void MoveMouse(int x, int y) { SDLManager::Get().MoveMouseOnWindow(p_window, x, y); }
|
||||||
inline void GetScreenSizeWindowIsOn(int* x, int* y) { SDLManager::Get().GetScreenSizeWindowIsOn(p_window, x, y); }
|
inline void GetScreenSizeWindowIsOn(int* x, int* y) { SDLManager::Get().GetScreenSizeWindowIsOn(p_window, x, y); }
|
||||||
|
inline void SetPosition(int x, int y) { SDLManager::Get().SetWindowPosition(p_window, x, y); }
|
||||||
|
|
||||||
inline VkSurfaceKHR CreateVulkanSurface(VkInstance instance) const noexcept { return SDLManager::Get().CreateVulkanSurface(p_window, instance); }
|
inline VkSurfaceKHR CreateVulkanSurface(VkInstance instance) const noexcept { return SDLManager::Get().CreateVulkanSurface(p_window, instance); }
|
||||||
inline std::vector<const char*> GetRequiredVulkanInstanceExtentions() const noexcept { return SDLManager::Get().GetRequiredVulkanInstanceExtentions(p_window); }
|
inline std::vector<const char*> GetRequiredVulkanInstanceExtentions() const noexcept { return SDLManager::Get().GetRequiredVulkanInstanceExtentions(p_window); }
|
||||||
|
|||||||
@@ -45,6 +45,12 @@ extern "C"
|
|||||||
return static_cast<mlx::Application*>(mlx)->NewGraphicsSuport(w, h, title);
|
return static_cast<mlx::Application*>(mlx)->NewGraphicsSuport(w, h, title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mlx_set_window_position(void *mlx, void *win, int x, int y)
|
||||||
|
{
|
||||||
|
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||||
|
static_cast<mlx::Application*>(mlx)->SetGraphicsSupportPosition(win, x, y);
|
||||||
|
}
|
||||||
|
|
||||||
int mlx_loop_hook(void* mlx, int (*f)(void*), void* param)
|
int mlx_loop_hook(void* mlx, int (*f)(void*), void* param)
|
||||||
{
|
{
|
||||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||||
|
|||||||
@@ -173,6 +173,11 @@ namespace mlx
|
|||||||
*y = DM.h;
|
*y = DM.h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SDLManager::SetWindowPosition(Handle window, int x, int y) const noexcept
|
||||||
|
{
|
||||||
|
SDL_SetWindowPosition(static_cast<SDL_Window*>(window), x, y);
|
||||||
|
}
|
||||||
|
|
||||||
std::int32_t SDLManager::GetX() const noexcept
|
std::int32_t SDLManager::GetX() const noexcept
|
||||||
{
|
{
|
||||||
int dummy;
|
int dummy;
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#include <mlx_profile.h>
|
||||||
#include <PreCompiled.h>
|
#include <PreCompiled.h>
|
||||||
|
|
||||||
#define KVF_IMPLEMENTATION
|
#define KVF_IMPLEMENTATION
|
||||||
@@ -5,7 +6,14 @@
|
|||||||
#define KVF_ENABLE_VALIDATION_LAYERS
|
#define KVF_ENABLE_VALIDATION_LAYERS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <kvf.h>
|
#if defined(MLX_COMPILER_GCC) || defined(MLX_COMPILER_CLANG)
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wmissing-field-initializers"
|
||||||
|
#include <kvf.h>
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
#else
|
||||||
|
#include <kvf.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <Renderer/RenderCore.h>
|
#include <Renderer/RenderCore.h>
|
||||||
#include <Renderer/Vulkan/VulkanLoader.h>
|
#include <Renderer/Vulkan/VulkanLoader.h>
|
||||||
|
|||||||
1
third_party/kvf.h
vendored
1
third_party/kvf.h
vendored
@@ -1062,6 +1062,7 @@ void kvfAddLayer(const char* layer)
|
|||||||
strcpy(__kvf_extra_layers[__kvf_extra_layers_count], layer);
|
strcpy(__kvf_extra_layers[__kvf_extra_layers_count], layer);
|
||||||
__kvf_extra_layers_count++;
|
__kvf_extra_layers_count++;
|
||||||
#else
|
#else
|
||||||
|
(void)layer;
|
||||||
if(__kvf_validation_error_callback != NULL)
|
if(__kvf_validation_error_callback != NULL)
|
||||||
{
|
{
|
||||||
char buffer[4096];
|
char buffer[4096];
|
||||||
|
|||||||
Reference in New Issue
Block a user