diff --git a/4 b/4 deleted file mode 100644 index 82888f1..0000000 --- a/4 +++ /dev/null @@ -1,35 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* window.cpp :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: maldavid +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2022/10/04 17:36:44 by maldavid #+# #+# */ -/* Updated: 2023/04/12 18:35:51 by maldavid ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include -#include - -namespace mlx -{ - MLX_Window::MLX_Window(std::size_t w, std::size_t h, std::string title) : _width(w), _height(h) - { - _win = SDL_CreateWindow(title.c_str(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, w, h, SDL_WINDOW_VULKAN | SDL_WINDOW_SHOWN); - if(!_win) - core::error::report(e_kind::fatal_error, std::string("unable to open a new window, ") + SDL_GetError()); - } - - void MLX_Window::destroy() noexcept - { - if(_win) - SDL_DestroyWindow(_win); - } - - MLX_Window::~MLX_Window() - { - destroy(); - } -} diff --git a/src/core/application.h b/src/core/application.h index 86d57a7..fb46936 100644 --- a/src/core/application.h +++ b/src/core/application.h @@ -6,7 +6,7 @@ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/10/04 21:49:46 by maldavid #+# #+# */ -/* Updated: 2023/04/12 19:34:45 by maldavid ### ########.fr */ +/* Updated: 2023/04/13 10:56:19 by maldavid ### ########.fr */ /* */ /* ************************************************************************** */ @@ -39,8 +39,8 @@ namespace mlx::core inline void onEvent(void* win, int event, int (*funct_ptr)(int, void*), void* param) noexcept; - inline constexpr void enableAutoRepeat() noexcept; - inline constexpr void disableAutoRepeat() noexcept; + inline void enableAutoRepeat() noexcept; + inline void disableAutoRepeat() noexcept; inline void getScreenSize(int* w, int* h) noexcept; diff --git a/src/core/application.inl b/src/core/application.inl index 5be920d..5111fb2 100644 --- a/src/core/application.inl +++ b/src/core/application.inl @@ -32,12 +32,12 @@ namespace mlx::core _in->onEvent(_graphics[*static_cast(win)]->getWindow()->getID(), event, funct_ptr, param); } - constexpr void Application::enableAutoRepeat() noexcept + void Application::enableAutoRepeat() noexcept { _in->enableAutoRepeat(); } - constexpr void Application::disableAutoRepeat() noexcept + void Application::disableAutoRepeat() noexcept { _in->disableAutoRepeat(); } diff --git a/src/platform/inputs.h b/src/platform/inputs.h index 147bd4e..af3296b 100644 --- a/src/platform/inputs.h +++ b/src/platform/inputs.h @@ -6,7 +6,7 @@ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/10/05 16:27:35 by maldavid #+# #+# */ -/* Updated: 2023/04/12 20:02:44 by maldavid ### ########.fr */ +/* Updated: 2023/04/13 10:55:46 by maldavid ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/src/renderer/images/vk_image.cpp b/src/renderer/images/vk_image.cpp index 7854993..10f32f4 100644 --- a/src/renderer/images/vk_image.cpp +++ b/src/renderer/images/vk_image.cpp @@ -6,7 +6,7 @@ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/01/25 11:59:07 by maldavid #+# #+# */ -/* Updated: 2023/04/11 16:21:23 by maldavid ### ########.fr */ +/* Updated: 2023/04/13 15:07:01 by maldavid ### ########.fr */ /* */ /* ************************************************************************** */ @@ -17,21 +17,6 @@ namespace mlx { - VkFormat findSupportedFormat(const std::vector& candidates, VkImageTiling tiling, VkFormatFeatureFlags features) - { - for(VkFormat format : candidates) - { - VkFormatProperties props; - vkGetPhysicalDeviceFormatProperties(Render_Core::get().getDevice().getPhysicalDevice(), format, &props); - if(tiling == VK_IMAGE_TILING_LINEAR && (props.linearTilingFeatures & features) == features) - return format; - else if(tiling == VK_IMAGE_TILING_OPTIMAL && (props.optimalTilingFeatures & features) == features) - return format; - } - core::error::report(e_kind::fatal_error, "Vulkan : failed to find image format"); - return VK_FORMAT_R8G8B8A8_UNORM; // to avoid warning; - } - void Image::create(uint32_t width, uint32_t height, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, VkMemoryPropertyFlags properties) { _width = width; diff --git a/src/renderer/images/vk_image.h b/src/renderer/images/vk_image.h index 1b83001..6afa88c 100644 --- a/src/renderer/images/vk_image.h +++ b/src/renderer/images/vk_image.h @@ -6,7 +6,7 @@ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/01/25 11:54:21 by maldavid #+# #+# */ -/* Updated: 2023/04/08 18:41:26 by maldavid ### ########.fr */ +/* Updated: 2023/04/13 10:59:04 by maldavid ### ########.fr */ /* */ /* ************************************************************************** */ @@ -19,7 +19,6 @@ namespace mlx { - VkFormat findSupportedFormat(const std::vector& candidates, VkImageTiling tiling, VkFormatFeatureFlags features); uint32_t formatSize(VkFormat format); class Image diff --git a/src/renderer/pipeline/pipeline.cpp b/src/renderer/pipeline/pipeline.cpp index be0a3df..d2fea99 100644 --- a/src/renderer/pipeline/pipeline.cpp +++ b/src/renderer/pipeline/pipeline.cpp @@ -6,7 +6,7 @@ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/12/18 21:27:38 by maldavid #+# #+# */ -/* Updated: 2023/04/01 15:21:00 by maldavid ### ########.fr */ +/* Updated: 2023/04/13 14:52:57 by maldavid ### ########.fr */ /* */ /* ************************************************************************** */ @@ -24,7 +24,7 @@ namespace mlx layout(location = 1) in vec4 aColor; layout(location = 2) in vec2 aUV; - layout(set=0, binding=0) uniform uProjection { + layout(set = 0, binding = 0) uniform uProjection { mat4 mat; } uProj; @@ -109,7 +109,7 @@ namespace mlx layout(location = 0) out vec4 fColor; - layout(set=1, binding=0) uniform sampler2D sTexture; + layout(set = 1, binding = 0) uniform sampler2D sTexture; layout(location = 0) in struct { vec4 Color; diff --git a/src/renderer/pixel_put.cpp b/src/renderer/pixel_put.cpp index c6652d4..0902329 100644 --- a/src/renderer/pixel_put.cpp +++ b/src/renderer/pixel_put.cpp @@ -6,7 +6,7 @@ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/03/31 15:14:50 by maldavid #+# #+# */ -/* Updated: 2023/04/05 00:28:29 by maldavid ### ########.fr */ +/* Updated: 2023/04/13 14:51:37 by maldavid ### ########.fr */ /* */ /* ************************************************************************** */ @@ -37,7 +37,7 @@ namespace mlx if(!_buffer.isMapped()) _buffer.mapMem(&_map); unsigned char* mem = static_cast(_map) + (y * _width * sizeof(uint32_t)) + (x * sizeof(uint32_t)); - int new_color = color & 0xFFFFFF00; + uint32_t new_color = color & 0xFFFFFF00; new_color >>= 8; new_color |= (color << 24) & 0xFF000000; *reinterpret_cast(mem) = new_color; diff --git a/src/renderer/text_pipeline.cpp b/src/renderer/text_pipeline.cpp index 35458ec..7b2801c 100644 --- a/src/renderer/text_pipeline.cpp +++ b/src/renderer/text_pipeline.cpp @@ -6,7 +6,7 @@ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/04/06 16:41:13 by maldavid #+# #+# */ -/* Updated: 2023/04/12 13:21:42 by maldavid ### ########.fr */ +/* Updated: 2023/04/13 10:49:04 by maldavid ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/test/.gdb_history b/test/.gdb_history deleted file mode 100644 index 93747ee..0000000 --- a/test/.gdb_history +++ /dev/null @@ -1,6 +0,0 @@ -run -bt -q -run* -bt -q diff --git a/test/main.c b/test/main.c index 5770334..ab12830 100644 --- a/test/main.c +++ b/test/main.c @@ -6,7 +6,7 @@ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/10/04 17:55:21 by maldavid #+# #+# */ -/* Updated: 2023/04/12 19:42:33 by maldavid ### ########.fr */ +/* Updated: 2023/04/13 14:59:32 by maldavid ### ########.fr */ /* */ /* ************************************************************************** */ @@ -30,7 +30,7 @@ int update(t_mlx *mlx) j = 0; while (j < 400) { - mlx_pixel_put(mlx->mlx, mlx->win, j, j, 0xFF0000FF); + mlx_pixel_put(mlx->mlx, mlx->win, j, j, 0xFF00FF01); mlx_pixel_put(mlx->mlx, mlx->win, 399 - j, j, 0xFF0000FF); j++; }