/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* application.h :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/10/04 21:49:46 by maldavid #+# #+# */ /* Updated: 2024/01/10 14:17:24 by maldavid ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef __MLX_APPLICATION__ #define __MLX_APPLICATION__ #include #include #include #include #include #include #include #include #include #include #include namespace mlx::core { 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(int* w, int* h) 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, uint32_t color) const noexcept; inline void stringPut(void* win, int x, int y, int color, char* str); void* newTexture(int w, int h); void* newStbTexture(char* file, int* w, int* h); // stb textures are format managed by stb image (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, 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: std::list _textures; std::vector> _graphics; std::function _loop_hook; std::unique_ptr _in; void* _param = nullptr; }; } #include #endif // __MLX_APPLICATION__