Skip to content

Commit

Permalink
removing GLFW support
Browse files Browse the repository at this point in the history
  • Loading branch information
Kbz-8 committed May 25, 2024
1 parent edb4407 commit 37e9410
Show file tree
Hide file tree
Showing 17 changed files with 152 additions and 259 deletions.
9 changes: 4 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2022/10/04 16:43:41 by maldavid #+# #+# #
# Updated: 2024/03/27 21:30:44 by maldavid ### ########.fr #
# Updated: 2024/05/25 16:08:57 by maldavid ### ########.fr #
# #
# **************************************************************************** #

Expand All @@ -16,7 +16,6 @@ SRCS = $(wildcard $(addsuffix /*.cpp, ./runtime/Sources/Core))
SRCS += $(wildcard $(addsuffix /*.cpp, ./runtime/Sources/Platform))
SRCS += $(wildcard $(addsuffix /*.cpp, ./runtime/Sources/Renderer))
SRCS += $(wildcard $(addsuffix /*.cpp, ./runtime/Sources/Renderer/**))
SRCS += $(wildcard $(addsuffix /*.cpp, ./runtime/Sources/Drivers/**))

OBJ_DIR = objs/makefile
OBJS = $(addprefix $(OBJ_DIR)/, $(SRCS:.cpp=.o))
Expand All @@ -31,7 +30,7 @@ IMAGES_OPTIMIZED ?= true
FORCE_INTEGRATED_GPU ?= false
GRAPHICS_MEMORY_DUMP ?= false
PROFILER ?= false
LEGACY ?= false
FORCE_WAYLAND ?= false

MODE = "release"

Expand Down Expand Up @@ -73,8 +72,8 @@ ifeq ($(PROFILER), true)
CXXFLAGS += -D PROFILER
endif

ifeq ($(LEGACY), true)
CXXFLAGS += -D LEGACY
ifeq ($(FORCE_WAYLAND), true)
CXXFLAGS += -D FORCE_WAYLAND
endif

RM = rm -rf
Expand Down
6 changes: 2 additions & 4 deletions runtime/Includes/Core/Application.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/04 21:49:46 by maldavid #+# #+# */
/* Updated: 2024/04/21 20:39:33 by maldavid ### ########.fr */
/* Updated: 2024/05/25 15:26:36 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */

Expand All @@ -15,7 +15,6 @@

#include <Core/Graphics.h>
#include <Platform/Inputs.h>
#include <Core/DriverLoader.h>
#include <Core/ImagesRegistry.h>
#include <Core/Fps.h>

Expand Down Expand Up @@ -61,14 +60,13 @@ namespace mlx
private:
FpsManager m_fps;
Input m_in;
DriverLoader m_driver_loader;
ImageRegistry m_image_registry;
std::vector<std::unique_ptr<GraphicsSupport>> m_graphics;
std::function<int(void*)> f_loop_hook;
void* p_param = nullptr;
};
}

#include <core/application.inl>
#include <Core/Application.inl>

#endif // __MLX_APPLICATION__
30 changes: 0 additions & 30 deletions runtime/Includes/Core/DriverLoader.inl

This file was deleted.

4 changes: 2 additions & 2 deletions runtime/Includes/Core/Graphics.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/02 14:49:49 by maldavid #+# #+# */
/* Updated: 2024/04/23 14:02:48 by maldavid ### ########.fr */
/* Updated: 2024/05/25 01:00:10 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -70,6 +70,6 @@ namespace mlx
};
}

#include <core/graphics.inl>
#include <Core/Graphics.inl>

#endif
Original file line number Diff line number Diff line change
@@ -1,39 +1,41 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* DriverLoader.h :+: :+: :+: */
/* SDLManager.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/02 16:56:10 by maldavid #+# #+# */
/* Updated: 2024/04/03 15:02:44 by maldavid ### ########.fr */
/* Created: 2024/05/25 15:28:59 by maldavid #+# #+# */
/* Updated: 2024/05/25 16:11:50 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */

#ifndef __MLX_CORE_DRIVER_LOADER__
#define __MLX_CORE_DRIVER_LOADER__
#ifndef __MLX_SDL_MANAGER__
#define __MLX_SDL_MANAGER__

#include <Drivers/DriverInstance.h>
#include <Utils/Singleton.h>

namespace mlx
{
class DriverLoader
class SDLManager : public Singleton<SDLManager>
{
public:
DriverLoader() = default;
friend class Singleton<SDLManager>;

template <typename T>
inline bool LoadDriver();
public:
void Init() noexcept;
void Shutdown() noexcept;

inline void ShutdownAllDrivers();
void* CreateWindow(const std::string& title, std::size_t w, std::size_t h);
void DestroyWindow(void* window) noexcept;

~DriverLoader() = default;
private:
SDLManager() = default;
~SDLManager() = default;

private:
std::vector<std::unique_ptr<DriverInstance> > m_instances;
std::unordered_set<void*> m_windows_registry;
bool m_drop_sdl_responsability = false;
};
}

#include <Core/DriverLoader.inl>

#endif
35 changes: 0 additions & 35 deletions runtime/Includes/Drivers/DriverInstance.h

This file was deleted.

34 changes: 0 additions & 34 deletions runtime/Includes/Drivers/GLFW/GLFWDriverInstance.h

This file was deleted.

32 changes: 0 additions & 32 deletions runtime/Includes/Drivers/GLFW/GLFWDriverInstance.inl

This file was deleted.

44 changes: 0 additions & 44 deletions runtime/Includes/Drivers/GLFW/GLFWInputs.h

This file was deleted.

11 changes: 3 additions & 8 deletions runtime/Includes/Platform/Window.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/04 21:53:12 by maldavid #+# #+# */
/* Updated: 2024/03/27 21:58:18 by maldavid ### ########.fr */
/* Updated: 2024/05/25 16:11:00 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */

Expand All @@ -15,18 +15,12 @@

namespace mlx
{
#ifdef LEGACY
using WindowHandle = SDL_Window;
#else
using WindowHandle = GLFWwindow;
#endif

class Window
{
public:
Window(std::size_t w, std::size_t h, const std::string& title);

inline NonOwningPtr<WindowHandle> GetWindowHandle() const noexcept = 0;
inline void* GetWindowHandle() const noexcept { return p_window; }
inline int GetWidth() const noexcept { return m_width; }
inline int GetHeight() const noexcept { return m_height; }
inline std::uint32_t GetID() const noexcept { return m_id; }
Expand All @@ -36,6 +30,7 @@ namespace mlx
~Window() = default;

private:
void* p_window = nullptr;
std::uint32_t m_id = -1;
int m_width = 0;
int m_height = 0;
Expand Down
10 changes: 3 additions & 7 deletions runtime/Includes/PreCompiled.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/25 17:37:23 by maldavid #+# #+# */
/* Updated: 2024/04/23 13:49:52 by maldavid ### ########.fr */
/* Updated: 2024/05/25 15:46:37 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */

Expand All @@ -23,12 +23,8 @@
#include <iostream>
#include <volk.h>

#ifdef MLX_LEGACY
#include <SDL2/SDL.h>
#include <SDL2/SDL_vulkan.h>
#else
#include <GLFW/glfw3.h>
#endif
#include <SDL2/SDL.h>
#include <SDL2/SDL_vulkan.h>

#include <functional>
#include <memory>
Expand Down
Loading

0 comments on commit 37e9410

Please sign in to comment.