mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-12 07:03:34 +00:00
working
This commit is contained in:
35
runtime/Includes/Drivers/DriverInstance.h
git.filemode.normal_file
35
runtime/Includes/Drivers/DriverInstance.h
git.filemode.normal_file
@@ -0,0 +1,35 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* DriverInstance.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/02 16:57:20 by maldavid #+# #+# */
|
||||
/* Updated: 2024/04/02 17:01:03 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef __MLX_DRIVER_INSTANCE__
|
||||
#define __MLX_DRIVER_INSTANCE__
|
||||
|
||||
namespace mlx
|
||||
{
|
||||
class DriverInstance
|
||||
{
|
||||
public:
|
||||
DriverInstance() = default;
|
||||
|
||||
virtual bool InitDriver() { m_is_up = true; return true; }
|
||||
virtual void ShutdownDriver() { m_is_up = false; }
|
||||
|
||||
inline bool IsRunning() const noexcept { return m_is_up; }
|
||||
|
||||
virtual ~DriverInstance() = default;
|
||||
|
||||
private:
|
||||
bool m_is_up = false;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
34
runtime/Includes/Drivers/GLFW/GLFWDriverInstance.h
git.filemode.normal_file
34
runtime/Includes/Drivers/GLFW/GLFWDriverInstance.h
git.filemode.normal_file
@@ -0,0 +1,34 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* GLFWDriverInstance.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/02 17:01:51 by maldavid #+# #+# */
|
||||
/* Updated: 2024/04/02 17:04:12 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef __MLX_GLFW_DRIVER_INSTANCE__
|
||||
#define __MLX_GLFW_DRIVER_INSTANCE__
|
||||
|
||||
#include <Drivers/DriverInstance.h>
|
||||
|
||||
namespace mlx
|
||||
{
|
||||
class GLFWDriverInstance : public DriverInstance
|
||||
{
|
||||
public:
|
||||
GLFWDriverInstance() = default;
|
||||
|
||||
inline bool InitDriver() override;
|
||||
inline void ShutdownDriver() override;
|
||||
|
||||
~GLFWDriverInstance() override = default;
|
||||
};
|
||||
}
|
||||
|
||||
#include <Drivers/GLFW/GLFWDriverInstance.inl>
|
||||
|
||||
#endif
|
||||
32
runtime/Includes/Drivers/GLFW/GLFWDriverInstance.inl
git.filemode.normal_file
32
runtime/Includes/Drivers/GLFW/GLFWDriverInstance.inl
git.filemode.normal_file
@@ -0,0 +1,32 @@
|
||||
/* **************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* GLFWDriverInstance.inl :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/02 17:04:23 by maldavid #+# #+# */
|
||||
/* Updated: 2024/04/02 17:04:23 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* **************************************************************************** */
|
||||
|
||||
#include <Drivers/GLFW/GLFWDriverInstance.h>
|
||||
|
||||
namespace mlx
|
||||
{
|
||||
bool GLFWDriverInstance::InitDriver()
|
||||
{
|
||||
glfwSetErrorCallback([]([[maybe_unused]] int code, const char* desc)
|
||||
{
|
||||
FatalError("GLFW Driver Error : %", desc);
|
||||
});
|
||||
glfwInit();
|
||||
DebugLog("GLFW Driver loaded");
|
||||
}
|
||||
|
||||
void GLFWDriverInstance::ShutdownDriver()
|
||||
{
|
||||
glfwTerminate();
|
||||
DebugLog("GLFW Driver shutted down");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user