From c37701d41d9248a6131c67f31477e23ec2ead051 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Thu, 6 Mar 2014 15:28:32 +0100 Subject: accept --fullscreen option Conflicts: linux/main.cpp --- linux/main.cpp | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) (limited to 'linux') diff --git a/linux/main.cpp b/linux/main.cpp index 9923588084..a2271eb296 100644 --- a/linux/main.cpp +++ b/linux/main.cpp @@ -3,12 +3,15 @@ #include #include +#include #include "settings.hpp" #include "request.hpp" std::forward_list requests; +static int fullscreen_flag = 0; + class MapView { public: MapView() : @@ -29,7 +32,9 @@ public: GLFWmonitor *monitor = nullptr; #ifdef GL_ES_VERSION_2_0 - monitor = glfwGetPrimaryMonitor(); + if (fullscreen_flag) { + monitor = glfwGetPrimaryMonitor(); + } glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); @@ -59,9 +64,8 @@ public: glfwGetFramebufferSize(window, &fb_width, &fb_height); settings.load(); - map.setup((double)fb_width / width); - settings.load(); + map.setup((double)fb_width / width); resize(window, 0, 0); @@ -133,6 +137,8 @@ public: int fb_width, fb_height; glfwGetFramebufferSize(window, &fb_width, &fb_height); + fprintf(stderr, "window size: %d/%d\n", width, height); + mapView->map.resize(width, height, fb_width, fb_height); } @@ -282,13 +288,26 @@ void quit_handler(int s) { } } -int main() { - // sigint handling - struct sigaction sigIntHandler; - sigIntHandler.sa_handler = quit_handler; - sigemptyset(&sigIntHandler.sa_mask); - sigIntHandler.sa_flags = 0; - sigaction(SIGINT, &sigIntHandler, NULL); + + +static struct option long_options[] = { + {"fullscreen", no_argument, &fullscreen_flag, 1}, + {0, 0, 0, 0} +}; + +int main(int argc, char *argv[]) { + while (true) { + int option_index = 0; + int c = getopt_long(argc, argv, "f", long_options, &option_index); + if (c == -1) break; + } + + // // sigint handling + // struct sigaction sigIntHandler; + // sigIntHandler.sa_handler = quit_handler; + // sigemptyset(&sigIntHandler.sa_mask); + // sigIntHandler.sa_flags = 0; + // sigaction(SIGINT, &sigIntHandler, NULL); // curl init -- cgit v1.2.1