mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-11 06:33:35 +00:00
working on colors issue
This commit is contained in:
35
4
35
4
@@ -1,35 +0,0 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* window.cpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/10/04 17:36:44 by maldavid #+# #+# */
|
||||
/* Updated: 2023/04/12 18:35:51 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include <platform/window.h>
|
||||
#include <core/errors.h>
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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;
|
||||
|
||||
|
||||
@@ -32,12 +32,12 @@ namespace mlx::core
|
||||
_in->onEvent(_graphics[*static_cast<int*>(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();
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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 */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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<VkFormat>& 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;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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<VkFormat>& candidates, VkImageTiling tiling, VkFormatFeatureFlags features);
|
||||
uint32_t formatSize(VkFormat format);
|
||||
|
||||
class Image
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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<unsigned char*>(_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<uint32_t*>(mem) = new_color;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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 */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
run
|
||||
bt
|
||||
q
|
||||
run*
|
||||
bt
|
||||
q
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user