begenning the refactor

This commit is contained in:
2024-03-27 23:03:54 +01:00
parent e5ff232065
commit 6bbf1e196d
131 changed files with 2135 additions and 1192 deletions

71
runtime/Includes/Core/Application.h git.filemode.normal_file
View File

@@ -0,0 +1,71 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Application.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/04 21:49:46 by maldavid #+# #+# */
/* Updated: 2024/03/27 21:00:53 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef __MLX_APPLICATION__
#define __MLX_APPLICATION__
#include <Core/Graphics.h>
#include <Platform/Inputs.h>
#include <Core/Fps.h>
namespace mlx
{
class Application
{
public:
Application();
inline void GetMousePos(int* x, int* y) noexcept;
inline void MouseMove(void* win, int x, int y) noexcept;
inline void OnEvent(void* win, int event, int (*funct_ptr)(int, void*), void* param) noexcept;
inline void GetScreenSize(void* 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 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);
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);
inline void LoopHook(int (*f)(void*), void* param);
inline void LoopEnd() noexcept;
inline void LoadFont(void* win, const std::filesystem::path& filepath, float scale);
void Run() noexcept;
~Application();
private:
FpsManager m_fps;
std::list<Texture> m_textures;
std::vector<std::unique_ptr<GraphicsSupport>> m_graphics;
std::function<int(void*)> f_loop_hook;
std::unique_ptr<Input> p_in;
void* p_param = nullptr;
};
}
#include <core/application.inl>
#endif // __MLX_APPLICATION__