/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* Application.h :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/10/04 21:49:46 by maldavid #+# #+# */ /* Updated: 2024/05/25 15:26:36 by maldavid ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef __MLX_APPLICATION__ #define __MLX_APPLICATION__ #include #include #include #include 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; Input m_in; ImageRegistry m_image_registry; std::vector> m_graphics; std::function f_loop_hook; void* p_param = nullptr; }; } #include #endif // __MLX_APPLICATION__