parent
cd234e695d
commit
a44b31b256
@ -1,6 +1,8 @@ |
|||||||
#pragma once |
#pragma once |
||||||
|
|
||||||
#define INSTANCE_COUNT 5 |
constexpr const int WINDOW_WIDTH=1280; |
||||||
|
constexpr const int WINDOW_HEIGHT=720; |
||||||
const unsigned int SCR_WIDTH = 1792; |
constexpr const int FRAME_LIMIT=60; |
||||||
const unsigned int SCR_HEIGHT = 1008; |
constexpr const bool VSYNC=true; |
||||||
|
constexpr const int CONTROL_WIDTH=1000; |
||||||
|
constexpr const int CONTROL_HEIGHT=1000; |
||||||
|
|||||||
@ -0,0 +1,50 @@ |
|||||||
|
#include "options.hpp" |
||||||
|
#include <fmt/core.h> |
||||||
|
#include <unistd.h> |
||||||
|
|
||||||
|
void print_usage() { |
||||||
|
fmt::println("USAGE: bezos [-W width] [-H height] [-p PORT] [-h] [-F] [-C] -d deck.md"); |
||||||
|
} |
||||||
|
|
||||||
|
Options parse_options(int argc, char* argv[]) { |
||||||
|
int opt = 0; |
||||||
|
Options result; |
||||||
|
|
||||||
|
while((opt = getopt(argc, argv, "hpFCd:W:H:")) != -1) { |
||||||
|
switch(opt) { |
||||||
|
case 'h': |
||||||
|
print_usage(); |
||||||
|
return {.help=true}; |
||||||
|
break; |
||||||
|
case 'p': |
||||||
|
result.port = std::stoi(optarg); |
||||||
|
break; |
||||||
|
case 'd': |
||||||
|
result.deck_given=true; |
||||||
|
result.deck_file = optarg; |
||||||
|
break; |
||||||
|
case 'W': |
||||||
|
result.pres_size.x = std::stoi(optarg); |
||||||
|
break; |
||||||
|
case 'H': |
||||||
|
result.pres_size.y = std::stoi(optarg); |
||||||
|
break; |
||||||
|
case 'F': |
||||||
|
result.full_screen = true; |
||||||
|
break; |
||||||
|
case 'C': |
||||||
|
result.control_window = false; |
||||||
|
break; |
||||||
|
default: |
||||||
|
print_usage(); |
||||||
|
return {.error=true}; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if(!result.deck_given) { |
||||||
|
print_usage(); |
||||||
|
result.error = true; |
||||||
|
} |
||||||
|
|
||||||
|
return result; |
||||||
|
} |
||||||
@ -0,0 +1,19 @@ |
|||||||
|
#pragma once |
||||||
|
#include <string> |
||||||
|
#include <glm/glm.hpp> |
||||||
|
#include "config.hpp" |
||||||
|
|
||||||
|
struct Options { |
||||||
|
std::string deck_file{}; |
||||||
|
bool deck_given{false}; |
||||||
|
bool help{false}; |
||||||
|
glm::vec2 pres_size{WINDOW_WIDTH, WINDOW_HEIGHT}; |
||||||
|
glm::vec2 control_size{CONTROL_WIDTH, CONTROL_HEIGHT}; |
||||||
|
bool error{false}; |
||||||
|
unsigned short port=9898; |
||||||
|
bool full_screen = false; |
||||||
|
bool control_window = true; |
||||||
|
}; |
||||||
|
|
||||||
|
void print_usage(); |
||||||
|
Options parse_options(int argc, char* argv[]); |
||||||
Loading…
Reference in new issue