Пример #1
0
int main( int argc, char *argv[]){

	/* parse options */
	int option_index = 0, opt;

	int gui = 1;
	static struct option loptions[] = {
			{"help",       no_argument,       0, 'h'},
			{"port",       required_argument, 0, 'p'},
			{"nongui",     required_argument, 0, 'n'},
			{"quiet",      no_argument,       0, 'q'},
			{0,         0,                 0, 0}
	};

	do {
		opt = getopt_long (argc, argv, "hp:nq",
				loptions, &option_index);

		switch (opt) {
		case '0':
			break;
		case 'p':
			device = strdup(optarg);
			break;
		case 'n':
			gui = 0;
			run = 1;
			break;
		case 'h':
			usagePrint();
			break;
			//default:
		}
	} while(opt != -1);

	if (device == NULL) {
		device = strdup(DEFAULT_DEVICE);
	}

	fd = setupSerial(device);

	if (gui) {
		return doGUI(argc, argv);
	} else {
		return doConsole(argc, argv);
	}
	return 0;
}
Пример #2
0
void Game::tick(float dt) {

    m_level.tick(dt);
    m_elapsed_time += dt;
    countFPS(dt);

    if (m_elapsed_time >= FRAME_TIME) {
        m_fps_counter++;
        m_context.renderer->beginFrame();
        m_level.render();
        m_hud.render();
        doGUI();
        m_context.renderer->renderText(m_fps_text, "arial", 0, 0);
        m_context.renderer->endFrame();
        m_elapsed_time -= FRAME_TIME;
    }

    m_running = !glfwGetKey(GLFW_KEY_ESC) && glfwGetWindowParam(GLFW_OPENED);
}