mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-11 14:43:34 +00:00
begenning the refactor
This commit is contained in:
71
runtime/Includes/Core/Application.h
git.filemode.normal_file
71
runtime/Includes/Core/Application.h
git.filemode.normal_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__
|
||||
Reference in New Issue
Block a user