big refactoring ! ci skip

This commit is contained in:
Kbz-8
2024-09-02 09:44:42 +02:00
parent 7ecee717f8
commit d5eeef9559
581 changed files with 42971 additions and 99170 deletions

View File

@@ -1,15 +1,3 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Application.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/04 21:49:46 by maldavid #+# #+# */
/* Updated: 2024/07/05 14:04:19 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef __MLX_APPLICATION__
#define __MLX_APPLICATION__
@@ -26,32 +14,32 @@ namespace mlx
Application();
inline void GetMousePos(int* x, int* y) noexcept;
inline void MouseMove(void* win, int x, int y) noexcept;
inline void MouseMove(Handle win, int x, int y) noexcept;
inline void OnEvent(void* win, int event, int (*funct_ptr)(int, void*), void* param) noexcept;
inline void OnEvent(Handle win, int event, int (*funct_ptr)(int, void*), void* param) noexcept;
inline void GetScreenSize(void* win, int* w, int* h) noexcept;
inline void GetScreenSize(Handle win, int* w, int* h) noexcept;
inline void SetFPSCap(std::uint32_t fps) noexcept;
inline void* NewGraphicsSuport(std::size_t w, std::size_t h, const char* title);
inline void ClearGraphicsSupport(void* win);
inline void DestroyGraphicsSupport(void* win);
inline Handle NewGraphicsSuport(std::size_t w, std::size_t h, const char* title);
inline void ClearGraphicsSupport(Handle win);
inline void DestroyGraphicsSupport(Handle win);
inline void PixelPut(void* win, int x, int y, std::uint32_t color) const noexcept;
inline void StringPut(void* win, int x, int y, std::uint32_t color, char* str);
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);
void* NewTexture(int w, int h);
void* NewStbTexture(char* file, int* w, int* h); // stb textures are image files (png, jpg, bpm, ...)
inline void TexturePut(void* win, void* img, int x, int y);
inline int GetTexturePixel(void* img, int x, int y);
inline void SetTexturePixel(void* img, int x, int y, std::uint32_t color);
void DestroyTexture(void* ptr);
Handle NewTexture(int w, int h);
Handle NewStbTexture(char* file, int* w, int* h); // stb textures are image files (png, jpg, bpm, ...)
inline void TexturePut(Handle win, Handle img, int x, int y);
inline int GetTexturePixel(Handle img, int x, int y);
inline void SetTexturePixel(Handle img, int x, int y, std::uint32_t color);
void DestroyTexture(Handle ptr);
inline void LoopHook(int (*f)(void*), void* param);
inline void LoopEnd() noexcept;
inline void LoadFont(void* win, const std::filesystem::path& filepath, float scale);
inline void LoadFont(Handle win, const std::filesystem::path& filepath, float scale);
void Run() noexcept;
@@ -62,8 +50,8 @@ namespace mlx
Inputs m_in;
ImageRegistry m_image_registry;
std::vector<std::unique_ptr<GraphicsSupport>> m_graphics;
std::function<int(void*)> f_loop_hook;
void* p_param = nullptr;
std::function<int(Handle)> f_loop_hook;
Handle p_param = nullptr;
};
}

View File

@@ -1,15 +1,4 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Application.inl :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/04 21:49:46 by maldavid #+# #+# */
/* Updated: 2024/04/23 14:45:07 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
#pragma once
#include <Core/Application.h>
#define CHECK_WINDOW_PTR(win) \

View File

@@ -1,15 +1,3 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Enums.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/27 17:15:24 by maldavid #+# #+# */
/* Updated: 2024/07/05 13:23:10 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef __MLX_CORE_ENUMS__
#define __MLX_CORE_ENUMS__
@@ -27,8 +15,18 @@ namespace mlx
EndEnum
};
constexpr std::size_t LogTypeCount = static_cast<std::size_t>(LogType::EndEnum);
enum class Event
{
ResizeEventCode = 56,
FrameBeginEventCode = 57,
FatalErrorEventCode = 168,
QuitEventCode = 168,
EndEnum
};
constexpr std::size_t EventCount = static_cast<std::size_t>(Event::EndEnum);
}
#endif

View File

@@ -1,15 +1,3 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* EventBase.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/27 17:27:22 by maldavid #+# #+# */
/* Updated: 2024/03/27 17:31:16 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef __MLX_BASE_EVENT__
#define __MLX_BASE_EVENT__

View File

@@ -1,15 +1,3 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* EventBus.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/27 17:30:36 by maldavid #+# #+# */
/* Updated: 2024/03/27 17:31:41 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef __MLX_EVENT_BUS__
#define __MLX_EVENT_BUS__

View File

@@ -1,15 +1,3 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* EventListener.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/27 17:28:17 by maldavid #+# #+# */
/* Updated: 2024/03/27 17:37:53 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef __MLX_EVENT_LISTENER__
#define __MLX_EVENT_LISTENER__

View File

@@ -1,15 +1,3 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Format.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/27 17:11:09 by maldavid #+# #+# */
/* Updated: 2024/03/27 17:12:03 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef __MLX_FORMAT__
#define __MLX_FORMAT__

View File

@@ -1,15 +1,4 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Format.inl :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/27 17:11:09 by maldavid #+# #+# */
/* Updated: 2024/03/27 17:12:03 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
#pragma once
#include <Core/Format.h>
#include <sstream>
#include <ostream>

View File

@@ -1,15 +1,3 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Fps.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/18 14:53:30 by maldavid #+# #+# */
/* Updated: 2024/03/27 20:52:06 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef __MLX_FPS__
#define __MLX_FPS__

View File

@@ -1,15 +1,3 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Graphics.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/02 14:49:49 by maldavid #+# #+# */
/* Updated: 2024/07/05 13:46:58 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef __MLX_GRAPHICS__
#define __MLX_GRAPHICS__

View File

@@ -1,15 +1,4 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* graphics.inl :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/02 15:13:55 by maldavid #+# #+# */
/* Updated: 2023/04/02 15:26:16 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
#pragma once
#include <Core/Graphics.h>
namespace mlx

View File

@@ -1,15 +1,3 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ImagesRegistry.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/03 15:11:47 by maldavid #+# #+# */
/* Updated: 2024/04/21 20:31:00 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef __MLX_CORE_IMAGES_REGISTRY__
#define __MLX_CORE_IMAGES_REGISTRY__

View File

@@ -1,8 +1,3 @@
// This file is a part of Akel
// Authors : @kbz_8
// Created : 21/04/2024
// Updated : 21/04/2024
#pragma once
#include <Core/ImagesRegistry.h>

View File

@@ -1,15 +1,3 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Logs.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/27 17:14:10 by maldavid #+# #+# */
/* Updated: 2024/03/27 17:19:23 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef __MLX_LOGS__
#define __MLX_LOGS__

View File

@@ -1,15 +1,4 @@
/* **************************************************************************** */
/* */
/* ::: :::::::: */
/* Logs.inl :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/27 17:19:47 by maldavid #+# #+# */
/* Updated: 2024/03/27 17:19:47 by maldavid ### ########.fr */
/* */
/* **************************************************************************** */
#pragma once
#include <Core/Logs.h>
#include <Core/Format.h>

View File

@@ -1,15 +1,3 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Memory.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/12/07 16:31:51 by kbz_8 #+# #+# */
/* Updated: 2024/03/27 21:16:44 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef __MLX_MEMORY__
#define __MLX_MEMORY__

View File

@@ -1,15 +1,3 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Profiler.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/10 13:35:45 by maldavid #+# #+# */
/* Updated: 2024/07/05 13:24:17 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef __MLX_PROFILER__
#define __MLX_PROFILER__

View File

@@ -1,19 +1,7 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* SDLManager.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/25 15:28:59 by maldavid #+# #+# */
/* Updated: 2024/07/05 22:15:22 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef __MLX_SDL_MANAGER__
#define __MLX_SDL_MANAGER__
#include <Utils/Singleton.h>
#include <Maths/Vec2.h>
namespace mlx
{
@@ -25,17 +13,27 @@ namespace mlx
void Init() noexcept;
void Shutdown() noexcept;
void* CreateWindow(const std::string& title, std::size_t w, std::size_t h);
void DestroyWindow(void* window) noexcept;
Handle CreateWindow(const std::string& title, std::size_t w, std::size_t h, bool hidden);
void DestroyWindow(Handle window) noexcept;
void SetEventCallback();
VkSurfaceKHR CreateVulkanSurface(Handle window, VkInstance instance) const noexcept;
std::vector<const char*> GetRequiredVulkanInstanceExtentions(Handle window) const noexcept;
Vec2ui GetVulkanDrawableSize(Handle window) const noexcept;
inline void SetEventCallback(func::function<void(mlx_event_type, int, void*)> functor, void* userdata) { f_callback = std::move(functor); p_callback_data = userdata; }
private:
SDLManager() = default;
~SDLManager() = default;
private:
std::unordered_set<void*> m_windows_registry;
std::unordered_set<Handle> m_windows_registry;
func::function<void(mlx_event_type, int, void*)> f_callback;
void* p_callback_data = nullptr;
std::int32_t m_x;
std::int32_t m_y;
std::int32_t m_rel_x;
std::int32_t m_rel_y;
bool m_drop_sdl_responsability = false;
};
}

View File

@@ -1,15 +1,3 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* UUID.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/06 11:13:23 by maldavid #+# #+# */
/* Updated: 2024/03/27 21:19:18 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef __MLX_UUID__
#define __MLX_UUID__