adding graphics support class, refactoring the code

This commit is contained in:
kbz_8
2023-04-02 17:37:38 +02:00
parent 534bea942c
commit 7a5e280322
14 changed files with 318 additions and 148 deletions

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/04 21:53:12 by maldavid #+# #+# */
/* Updated: 2023/04/01 17:26:18 by maldavid ### ########.fr */
/* Updated: 2023/04/02 15:39:53 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
@@ -15,37 +15,24 @@
#include <SDL2/SDL.h>
#include <string>
#include <memory>
#include <renderer/renderer.h>
#include <renderer/images/texture.h>
#include <renderer/buffers/vk_buffer.h>
namespace mlx
{
class MLX_Window
{
public:
MLX_Window(std::size_t w, std::size_t h, std::string title, int id);
MLX_Window(std::size_t w, std::size_t h, std::string title);
inline int& get_id() noexcept { return _id; }
inline SDL_Window* getNativeWindow() const noexcept { return _win; }
inline int getWidth() const noexcept { return _width; }
inline int getHeight() const noexcept { return _height; }
bool beginFrame();
void clear();
void endFrame();
void pixel_put(int x, int y, int color);
void texture_put(std::shared_ptr<Texture> texture, int x, int y);
~MLX_Window();
private:
glm::mat4 _proj = glm::mat4(1.0);
std::unique_ptr<Renderer> _renderer;
SDL_Window* _win = nullptr;
int _width = 0;
int _height = 0;
int _id;
};
}