diff options
author | Chuyan Zhang <me@zcy.moe> | 2024-09-05 01:11:42 -0700 |
---|---|---|
committer | Chuyan Zhang <me@zcy.moe> | 2024-09-05 01:11:42 -0700 |
commit | 8c7926588b616988e7b016eaf704acee0ee77cc9 (patch) | |
tree | a1bb11131aea964f9fa0bca76196c3351530c01d /src | |
download | iris-8c7926588b616988e7b016eaf704acee0ee77cc9.tar.gz iris-8c7926588b616988e7b016eaf704acee0ee77cc9.zip |
Initial setup
Diffstat (limited to 'src')
-rw-r--r-- | src/app.cpp | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/src/app.cpp b/src/app.cpp new file mode 100644 index 0000000..7ef2310 --- /dev/null +++ b/src/app.cpp @@ -0,0 +1,63 @@ +#include "imgui.h" +#include "imgui_impl_glfw.h" +#include "imgui_impl_vulkan.h" +#include "argparse/argparse.hpp" +#include <GLFW/glfw3.h> + +#include <iostream> + +GLFWwindow *start_up(int width, int height) { + return nullptr; +} + +void main_loop(GLFWwindow *window) { + +} + +void shut_down(GLFWwindow *window) { + +} + +int main(int argc, char** argv) { + argparse::ArgumentParser program("IrisRenderer"); + program.add_argument("width") + .help("display width of the window") + .scan<'i', int>(); + program.add_argument("height") + .help("display height of the window") + .scan<'i', int>(); + + try { + program.parse_args(argc, argv); + } catch (const std::exception& err) { + std::cerr << err.what() << std::endl; + std::cerr << program; + return 1; + } + + int window_width = program.get<int>("width"); + int window_height = program.get<int>("height"); + + if (!glfwInit()) { + const char* description = nullptr; + glfwGetError(&description); + if (description != nullptr) { + std::cerr << "Error: " << description << std::endl; + } else { + std::cerr << "Failed to initialize GLFW" << std::endl; + } + + glfwTerminate(); + return -1; + } + + auto window = start_up(window_width, window_height); + if (window == nullptr) { + return -2; + } + while (!glfwWindowShouldClose(window)) { + main_loop(window); + } + shut_down(window); + return 0; +}
\ No newline at end of file |