mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-12 07:03:34 +00:00
working on event system
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/10/04 21:49:46 by maldavid #+# #+# */
|
||||
/* Updated: 2023/04/02 23:38:05 by maldavid ### ########.fr */
|
||||
/* Updated: 2023/04/03 11:18:41 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -35,6 +35,9 @@ namespace mlx::core
|
||||
inline void getMousePos(int* x, int* y) noexcept;
|
||||
inline void mouseMove(void* win_ptr, int x, int y) noexcept;
|
||||
|
||||
inline constexpr void enableAutoRepeat() noexcept;
|
||||
inline constexpr void disableAutoRepeat() noexcept;
|
||||
|
||||
inline void getScreenSize(int* w, int* h) noexcept;
|
||||
|
||||
inline void* newGraphicsSuport(std::size_t w, std::size_t h, std::string title);
|
||||
|
||||
@@ -27,6 +27,16 @@ namespace mlx::core
|
||||
SDL_FlushEvent(SDL_MOUSEMOTION);
|
||||
}
|
||||
|
||||
constexpr void Application::enableAutoRepeat() noexcept
|
||||
{
|
||||
_in.enableAutoRepeat();
|
||||
}
|
||||
|
||||
constexpr void Application::disableAutoRepeat() noexcept
|
||||
{
|
||||
_in.disableAutoRepeat();
|
||||
}
|
||||
|
||||
void Application::getScreenSize(int* w, int* h) noexcept
|
||||
{
|
||||
SDL_DisplayMode DM;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/10/04 17:35:20 by maldavid #+# #+# */
|
||||
/* Updated: 2023/04/02 22:23:40 by maldavid ### ########.fr */
|
||||
/* Updated: 2023/04/03 14:18:50 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "errors.h"
|
||||
#include "application.h"
|
||||
#include <renderer/core/render_core.h>
|
||||
#include <filesystem>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
@@ -68,6 +69,18 @@ extern "C"
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mlx_do_key_autorepeaton(void* mlx)
|
||||
{
|
||||
static_cast<mlx::core::Application*>(mlx)->enableAutoRepeat();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mlx_do_key_autorepeatoff(void* mlx)
|
||||
{
|
||||
static_cast<mlx::core::Application*>(mlx)->disableAutoRepeat();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void* mlx_new_image(void* mlx, int width, int height)
|
||||
{
|
||||
return static_cast<mlx::core::Application*>(mlx)->newTexture(width, height);
|
||||
@@ -92,6 +105,34 @@ extern "C"
|
||||
|
||||
void* mlx_png_file_to_image(void* mlx_ptr, char* filename, int* width, int* height)
|
||||
{
|
||||
std::filesystem::path file(filename);
|
||||
if(file.extension() != ".png")
|
||||
{
|
||||
mlx::core::error::report(e_kind::error, "PNG loader : not a png file '%s'", filename);
|
||||
return nullptr;
|
||||
}
|
||||
return static_cast<mlx::core::Application*>(mlx_ptr)->newStbTexture(filename, width, height);
|
||||
}
|
||||
|
||||
void* mlx_jpg_file_to_image(void* mlx_ptr, char* filename, int* width, int* height)
|
||||
{
|
||||
std::filesystem::path file(filename);
|
||||
if(file.extension() != ".jpg" && file.extension() != ".jpeg")
|
||||
{
|
||||
mlx::core::error::report(e_kind::error, "PNG loader : not a jpg file '%s'", filename);
|
||||
return nullptr;
|
||||
}
|
||||
return static_cast<mlx::core::Application*>(mlx_ptr)->newStbTexture(filename, width, height);
|
||||
}
|
||||
|
||||
void* mlx_bmp_file_to_image(void* mlx_ptr, char* filename, int* width, int* height)
|
||||
{
|
||||
std::filesystem::path file(filename);
|
||||
if(file.extension() != ".bmp" && file.extension() != ".dib")
|
||||
{
|
||||
mlx::core::error::report(e_kind::error, "PNG loader : not a jpg file '%s'", filename);
|
||||
return nullptr;
|
||||
}
|
||||
return static_cast<mlx::core::Application*>(mlx_ptr)->newStbTexture(filename, width, height);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/04/02 14:49:49 by maldavid #+# #+# */
|
||||
/* Updated: 2023/04/02 15:36:49 by maldavid ### ########.fr */
|
||||
/* Updated: 2023/04/03 14:23:57 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include <platform/window.h>
|
||||
#include <renderer/renderer.h>
|
||||
#include <renderer/pixel_put.h>
|
||||
#include <utils/non_copyable.h>
|
||||
#include <renderer/images/texture.h>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user