This commit is contained in:
j3d1 2016-09-27 20:58:56 +02:00
commit d78a9fa7af
3 changed files with 83 additions and 6 deletions

View file

@ -1,4 +1,9 @@
Klassische Kepler Kriege
===
========================
Game based on NewtonWars (https://github.com/Draradech/NewtonWars), rewritten in C++ with some more fancy OpenGL shitz.
dependencies
------------
libepoxy-dev

View file

@ -1,12 +1,63 @@
#include "opengl.hpp"
#include <iostream>
#include <getopt.h>
#include "game_window.hpp"
#include "options.hpp"
int main(int argc, const char *argv[]) {
GameWindow window(500, 500);
window.set_maxfps(60.0);
window.loop();
window.stop();
uint64_t optionsFlags;
using namespace std;
int main(int argc, char *argv[]) {
char c;
static struct option long_options[] =
{
/* These options set a flag. */
// {"verbose", no_argument, &verbose_flag, 1},
// {"brief", no_argument, &verbose_flag, 0},
/* These options dont set a flag.
We distinguish them by their indices. */
// {"add", no_argument, 0, 'a'},
// {"append", no_argument, 0, 'b'},
// {"delete", required_argument, 0, 'd'},
// {"create", required_argument, 0, 'c'},
{"fps", no_argument, 0, 'f'},
{0, 0, 0, 0}
};
int option_index = 0;
while(1){
c = getopt_long (argc, argv, "abc:d:f",
long_options, &option_index);
if (c == -1)
break;
switch (c)
{
case 'f':
SET_FLAG(SHOW_FPS,true);
break;
/*case 'c':
cvalue = optarg;
break;
*/
case '?':
/* getopt_long already printed an error message. */
break;
default:
abort();
}
}
GameWindow window(500, 500);
window.set_maxfps(60.0);
window.loop();
window.stop();
}

21
game/options.hpp Normal file
View file

@ -0,0 +1,21 @@
#define TEST_FLAG1 0
#define SHOW_FPS 1
#define TEST_FLAG2 2
//...
#define SET_FLAG(x,y) optionsFlags&=(~((1)<<x));optionsFlags|=((y&1)<<x)
#define ISSET_FLAG(x) (optionsFlags&((1)<<x))
extern uint64_t optionsFlags;
/*
* usage:
* SET_FLAG(SHOW_FPS,true);
*
* if(ISSET_FLAG(SHOW_FPS)){
* ...
* }
*/