begenning the refactor

This commit is contained in:
Kbz-8
2024-03-27 23:03:54 +01:00
parent b5983ac24b
commit 0e04356ea7
131 changed files with 2135 additions and 1192 deletions

39
runtime/Sources/Platform/Inputs.cpp git.filemode.normal_file
View File

@@ -0,0 +1,39 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* inputs.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/05 16:30:19 by maldavid #+# #+# */
/* Updated: 2024/03/27 15:50:07 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
#include <pre_compiled.h>
#include "inputs.h"
#include <mlx.h>
#include <core/profiler.h>
namespace mlx
{
void Input::update()
{
MLX_PROFILE_FUNCTION();
_xRel = 0;
_yRel = 0;
glfwPollEvents();
static int i = 0;
i++;
if(i >= 500)
{
auto& hooks = _events_hooks[0];
auto& win_hook = hooks[MLX_WINDOW_EVENT];
if(win_hook.hook)
win_hook.hook(0, win_hook.param);
}
}
}

40
runtime/Sources/Platform/Window.cpp git.filemode.normal_file
View File

@@ -0,0 +1,40 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* window.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/04 17:36:44 by maldavid #+# #+# */
/* Updated: 2024/03/26 23:03:59 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
#include <pre_compiled.h>
#include <platform/window.h>
#include <core/errors.h>
#include <utils/icon_mlx.h>
namespace mlx
{
Window::Window(std::size_t w, std::size_t h, const std::string& title) : _width(w), _height(h)
{
static std::uint64_t ids = 0;
if(title.find("vvaas") != std::string::npos)
core::error::report(e_kind::message, "vvaas est mauvais");
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
_win = glfwCreateWindow(_width, _height, title.c_str(), NULL, NULL);;
_id = ids++;
}
void Window::destroy() noexcept
{
if(_win != nullptr)
{
glfwDestroyWindow(_win);
_win = nullptr;
}
}
}