File: main.cpp

package info (click to toggle)
pipenightdreams 0.10.0-14
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 4,336 kB
  • ctags: 955
  • sloc: sh: 7,860; cpp: 4,155; lex: 599; makefile: 53; ansic: 2
file content (57 lines) | stat: -rw-r--r-- 1,968 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/***************************************************************************
                          main.cpp  -  description
                             -------------------
    begin                : Thu Aug 17 15:27:08 ART 2000
    copyright            : (C) 2000 by Waldemar Baraldi
    email                : baraldi@lacasilla.com.ar
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include "pipenightdreams.h"
#include "hash.h"
#include "str.h"

int main(int argc, char *argv[])
{
  Str * data_dir=NULL;
  int level=1;
  bool fullscreen=false;
  int i=1;


  while (i<argc){
    if (!strcmp("--datadir", argv[i])){
      if (data_dir) delete data_dir;
      data_dir=new Str(argv[++i]);
    }else
      if (!strcmp("--level", argv[i])) {
	level = atoi(argv[++i]);
      } else if (!strcmp("--fullscreen", argv[i]))
        fullscreen=true;
      else{
        printf("Invalid Data Dir\nUse pipenightdreams [--datadir <DATA DIR>] [--fullscreen] [--level <level>]\n");
        printf("Using default: %s\n", GAME_DATADIR);
      }
    i++;
  }

  if (!data_dir) data_dir=new Str(GAME_DATADIR);

  PipeNightDreams * g = new PipeNightDreams(fullscreen);
  g->setDataDir(data_dir);
  g->setStartingLevel(level);
  g->run();
  delete g;
}