mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-12 15:13:34 +00:00
adding SDL initialisation and quit, improving inputs code readability
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/10/04 22:10:52 by maldavid #+# #+# */
|
||||
/* Updated: 2023/04/25 15:12:57 by maldavid ### ########.fr */
|
||||
/* Updated: 2023/08/28 10:19:53 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -14,10 +14,17 @@
|
||||
#include <renderer/images/texture.h>
|
||||
#include <renderer/core/render_core.h>
|
||||
#include <array>
|
||||
#include <core/errors.h>
|
||||
#include <utils/endian.h>
|
||||
|
||||
namespace mlx::core
|
||||
{
|
||||
Application::Application() : _in(std::make_unique<Input>())
|
||||
{
|
||||
if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS | SDL_INIT_TIMER) != 0)
|
||||
error::report(e_kind::fatal_error, "SDL error : unable to init all subsystems : %s", SDL_GetError());
|
||||
}
|
||||
|
||||
void Application::run() noexcept
|
||||
{
|
||||
while(_in->is_running())
|
||||
@@ -52,4 +59,9 @@ namespace mlx::core
|
||||
Texture* texture = static_cast<Texture*>(ptr);
|
||||
texture->destroy();
|
||||
}
|
||||
|
||||
Application::~Application()
|
||||
{
|
||||
SDL_Quit();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/10/04 21:49:46 by maldavid #+# #+# */
|
||||
/* Updated: 2023/04/25 15:23:31 by maldavid ### ########.fr */
|
||||
/* Updated: 2023/08/28 10:19:35 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace mlx::core
|
||||
class Application
|
||||
{
|
||||
public:
|
||||
Application() : _in(std::make_unique<Input>()) {}
|
||||
Application();
|
||||
|
||||
inline void getMousePos(int* x, int* y) noexcept;
|
||||
inline void mouseMove(void* win, int x, int y) noexcept;
|
||||
@@ -58,7 +58,7 @@ namespace mlx::core
|
||||
|
||||
void run() noexcept;
|
||||
|
||||
~Application() = default;
|
||||
~Application();
|
||||
|
||||
private:
|
||||
std::list<Texture> _textures;
|
||||
|
||||
Reference in New Issue
Block a user