Compare commits
No commits in common. "b07d6e2ff63ee36bb5b5686e73ce16b6b1ac3ba2" and "4c651d1b6f6738f2223c35f31fca1542f9f666fc" have entirely different histories.
b07d6e2ff6
...
4c651d1b6f
|
@ -63,7 +63,7 @@ COMPILE_COMMANDS=(
|
||||||
"$CXX_WITH_FLAGS src/tools/arraydump.cpp -I./include -Lbin/lib -l:file.so -l:cli.so -o bin/tools/arraydump"
|
"$CXX_WITH_FLAGS src/tools/arraydump.cpp -I./include -Lbin/lib -l:file.so -l:cli.so -o bin/tools/arraydump"
|
||||||
"$CXX_WITH_FLAGS src/tools/baseconvert.cpp -I./include -Lbin/lib -l:cli.so -o bin/tools/baseconvert"
|
"$CXX_WITH_FLAGS src/tools/baseconvert.cpp -I./include -Lbin/lib -l:cli.so -o bin/tools/baseconvert"
|
||||||
"$CXX_WITH_FLAGS -pthread src/tools/hexnet.cpp -I./include -Lbin/lib -l:cli.so -l:libsockpp.so -o bin/tools/hexnet"
|
"$CXX_WITH_FLAGS -pthread src/tools/hexnet.cpp -I./include -Lbin/lib -l:cli.so -l:libsockpp.so -o bin/tools/hexnet"
|
||||||
"$CXX_WITH_FLAGS -DFOSSVG_DEBUG src/fossvg.cpp -I./include -Lbin/lib -l:cli.so -lglfw -lvulkan -o bin/fossvg"
|
"$CXX_WITH_FLAGS src/fossvg.cpp -I./include -Lbin/lib -l:cli.so -lglfw -o bin/fossvg"
|
||||||
"$CXX_WITH_FLAGS src/fossvgd.cpp -I./include -Lbin/lib -l:cli.so -o bin/fossvgd"
|
"$CXX_WITH_FLAGS src/fossvgd.cpp -I./include -Lbin/lib -l:cli.so -o bin/fossvgd"
|
||||||
)
|
)
|
||||||
for command in ${!COMPILE_COMMANDS[@]}; do
|
for command in ${!COMPILE_COMMANDS[@]}; do
|
||||||
|
|
|
@ -21,10 +21,7 @@
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#define GLFW_INCLUDE_VULKAN
|
|
||||||
extern "C" {
|
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
}
|
|
||||||
|
|
||||||
#include "./lib/cli.hpp"
|
#include "./lib/cli.hpp"
|
||||||
|
|
||||||
|
@ -32,27 +29,24 @@ extern "C" {
|
||||||
#define EXIT_RUNTIME 1
|
#define EXIT_RUNTIME 1
|
||||||
#define EXIT_USAGE 2
|
#define EXIT_USAGE 2
|
||||||
|
|
||||||
uint32_t windowWidth = 1366;
|
|
||||||
uint32_t windowHeight = 768;
|
|
||||||
|
|
||||||
//TODO: check the TODO above glfwInit() in void main()
|
//TODO: check the TODO above glfwInit() in void main()
|
||||||
// #### Callbacks ##############################################################
|
// #### Callbacks ##############################################################
|
||||||
void cursorPositionCallback([[maybe_unused]] GLFWwindow* window, [[maybe_unused]] double x, [[maybe_unused]] double y) {
|
void cursorPositionCallback(GLFWwindow* window, double x, double y) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void keyCallback([[maybe_unused]] GLFWwindow* window, [[maybe_unused]] int32_t key, [[maybe_unused]] int32_t scancode, [[maybe_unused]] int32_t action, [[maybe_unused]] int32_t mods) {
|
void keyCallback(GLFWwindow* window, int32_t key, int32_t scancode, int32_t action, int32_t mods) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void textInputCallback([[maybe_unused]] GLFWwindow* window, [[maybe_unused]] uint32_t codepoint) {
|
void textInputCallback(GLFWwindow* window, uint32_t codepoint) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void cursorEnterLeaveCallback([[maybe_unused]] GLFWwindow* window, [[maybe_unused]] int32_t entered) {
|
void cursorEnterLeaveCallback(GLFWwindow* window, int32_t entered) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void mouseButtonCallback([[maybe_unused]] GLFWwindow* window, [[maybe_unused]] int32_t button, [[maybe_unused]] int32_t action, [[maybe_unused]] int32_t mods) {
|
void mouseButtonCallback(GLFWwindow* window, int32_t button, int32_t action, int32_t mods) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void scrollCallback([[maybe_unused]] GLFWwindow* window, [[maybe_unused]] double x, [[maybe_unused]] double y) {
|
void scrollCallback(GLFWwindow* window, double x, double y) {
|
||||||
}
|
}
|
||||||
// #### End Callbacks ##########################################################
|
// #### End Callbacks ##########################################################
|
||||||
|
|
||||||
|
@ -61,8 +55,6 @@ int main(int argc, char* argv[]) {
|
||||||
flags.push_back(CLI::Flag('h', "help", "print help and exit"));
|
flags.push_back(CLI::Flag('h', "help", "print help and exit"));
|
||||||
flags.push_back(CLI::Flag('l', "license", "print license information and exit"));
|
flags.push_back(CLI::Flag('l', "license", "print license information and exit"));
|
||||||
std::vector<CLI::Option> options;
|
std::vector<CLI::Option> options;
|
||||||
options.push_back(CLI::Option('x', "window-width", "PIXELS", "window width on startup"));
|
|
||||||
options.push_back(CLI::Option('y', "window-height", "PIXELS", "window height on startup"));
|
|
||||||
std::vector<CLI::Argument> arguments;
|
std::vector<CLI::Argument> arguments;
|
||||||
CLI::ArgumentsParser cliParser = CLI::ArgumentsParser(argc, argv, flags, options, arguments, "FOSS-VG Client");
|
CLI::ArgumentsParser cliParser = CLI::ArgumentsParser(argc, argv, flags, options, arguments, "FOSS-VG Client");
|
||||||
|
|
||||||
|
@ -96,14 +88,6 @@ int main(int argc, char* argv[]) {
|
||||||
return EXIT_USAGE;
|
return EXIT_USAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cliParser.getOption("window-width").errorCode != ErrorCodes::NOT_PRESENT) {
|
|
||||||
windowWidth = std::stoi(cliParser.getOption("window-width").value);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cliParser.getOption("window-height").errorCode != ErrorCodes::NOT_PRESENT) {
|
|
||||||
windowHeight = std::stoi(cliParser.getOption("window-height").value);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// TODO: Find a better place for this
|
// TODO: Find a better place for this
|
||||||
// Ideally, the window management and rendering portion of FOSS-VG should
|
// Ideally, the window management and rendering portion of FOSS-VG should
|
||||||
|
@ -115,11 +99,9 @@ int main(int argc, char* argv[]) {
|
||||||
return EXIT_RUNTIME;
|
return EXIT_RUNTIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
// do not create OpenGL context
|
//TODO: allow to set startup window size using CLI options
|
||||||
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
|
uint32_t windowWidth = 1366;
|
||||||
|
uint32_t windowHeight = 768;
|
||||||
glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);
|
|
||||||
|
|
||||||
//TODO: add a version macro
|
//TODO: add a version macro
|
||||||
// (for example Git commit hash passed on the compiler command line)
|
// (for example Git commit hash passed on the compiler command line)
|
||||||
std::string windowTitle = "FOSS-VG";
|
std::string windowTitle = "FOSS-VG";
|
||||||
|
@ -131,6 +113,9 @@ int main(int argc, char* argv[]) {
|
||||||
return EXIT_RUNTIME;
|
return EXIT_RUNTIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// What dis do? It was in a tutorial.
|
||||||
|
glfwMakeContextCurrent(window);
|
||||||
|
|
||||||
glfwSetCursorPosCallback(window, cursorPositionCallback);
|
glfwSetCursorPosCallback(window, cursorPositionCallback);
|
||||||
glfwSetKeyCallback(window, keyCallback);
|
glfwSetKeyCallback(window, keyCallback);
|
||||||
glfwSetCharCallback(window, textInputCallback);
|
glfwSetCharCallback(window, textInputCallback);
|
||||||
|
@ -139,10 +124,12 @@ int main(int argc, char* argv[]) {
|
||||||
glfwSetScrollCallback(window, scrollCallback);
|
glfwSetScrollCallback(window, scrollCallback);
|
||||||
|
|
||||||
while (!glfwWindowShouldClose(window)) {
|
while (!glfwWindowShouldClose(window)) {
|
||||||
|
|
||||||
|
glfwSwapBuffers(window);
|
||||||
|
|
||||||
glfwPollEvents();
|
glfwPollEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
glfwDestroyWindow(window);
|
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue