diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | src/utils.cpp | 12 | ||||
| -rw-r--r-- | src/window.cpp | 2 |
3 files changed, 14 insertions, 4 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 048a159..91cdf43 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -3,7 +3,7 @@ add_definitions(-DNOMINMAX -D_USE_MATH_DEFINES) include_directories(${CMAKE_SOURCE_DIR}/include) include_directories(${Vulkan_INCLUDE_DIRS}) -if(${CMAKE_SYSTEM_NAME} EQUAL "Linux") +if(UNIX AND NOT APPLE) include_directories(${X11_xcb_INCLUDE_PATH}) endif() @@ -23,7 +23,7 @@ add_executable( window.cpp ) -if(${CMAKE_SYSTEM_NAME} EQUAL "Linux") +if(UNIX AND NOT APPLE) list(APPEND LIBRARIES ${CMAKE_DL_LIBS} ${X11_xcb_LIB} ${X11_xkbcommon_LIB} ${X11_xkbcommon_X11_LIB}) endif() diff --git a/src/utils.cpp b/src/utils.cpp index b228e82..eb119e8 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -4,16 +4,26 @@ #include <cstring> #include <iostream> +#include "defines.hpp" #include "material.hpp" std::vector<uint8_t> get_shader_code(const char* path) { +#if defined(WINDOWS) FILE* f = nullptr; errno_t err = fopen_s(&f, path, "rb"); if (err != 0) { - std::cerr << "Cannot open compute shader file !" << std::endl; + std::cerr << "Cannot open shader file !" << std::endl; return {}; } +#elif defined(LINUX) + FILE* f = fopen(path, "rb"); + + if (!f) { + std::cerr << "Cannot open shader file !" << std::endl; + return {}; + } +#endif if (fseek(f, 0, SEEK_END) != 0) { return {}; diff --git a/src/window.cpp b/src/window.cpp index 793f67d..a5b1032 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -149,7 +149,7 @@ void window::poll_events() { events.push_back({ .x = motion_event->event_x, .y = motion_event->event_y, - .type = EVENT_TYPES::MOVE, + .type = EVENT_TYPES::MOUSE_MOVE, }); break; } |
