| 1 |
/*************************************************************************** |
| 2 |
main.cpp - description |
| 3 |
------------------- |
| 4 |
begin : Thu Aug 17 15:27:08 ART 2000 |
| 5 |
copyright : (C) 2000 by Waldemar Baraldi |
| 6 |
email : [email protected] |
| 7 |
***************************************************************************/ |
| 8 |
|
| 9 |
/*************************************************************************** |
| 10 |
* * |
| 11 |
* This program is free software; you can redistribute it and/or modify * |
| 12 |
* it under the terms of the GNU General Public License as published by * |
| 13 |
* the Free Software Foundation; either version 2 of the License, or * |
| 14 |
* (at your option) any later version. * |
| 15 |
* * |
| 16 |
***************************************************************************/ |
| 17 |
|
| 18 |
#include "config.h" |
| 19 |
#include <stdlib.h> |
| 20 |
#include <stdio.h> |
| 21 |
#include <unistd.h> |
| 22 |
#include "pipenightdreams.h" |
| 23 |
#include "hash.h" |
| 24 |
#include "str.h" |
| 25 |
|
| 26 |
int main(int argc, char *argv[]) |
| 27 |
{ |
| 28 |
Str * data_dir=NULL; |
| 29 |
int level=1; |
| 30 |
bool fullscreen=false; |
| 31 |
int i=1; |
| 32 |
|
| 33 |
|
| 34 |
while (i<argc){ |
| 35 |
if (!strcmp("--datadir", argv[i])){ |
| 36 |
if (data_dir) delete data_dir; |
| 37 |
data_dir=new Str(argv[++i]); |
| 38 |
}else |
| •39 |
if (!strcmp("--level", argv[i])) { |
| 40 |
level = atoi(argv[++i]); |
| 41 |
} else if (!strcmp("--fullscreen", argv[i])) |
| 42 |
fullscreen=true; |
| 43 |
else{ |
| •44 |
printf("Invalid Data Dir\nUse pipenightdreams [--datadir <DATA DIR>] [--fullscreen] [--level <level>]\n"); |
| 45 |
printf("Using default: %s\n", GAME_DATADIR); |
| 46 |
} |
| 47 |
i++; |
| 48 |
} |
| 49 |
|
| 50 |
if (!data_dir) data_dir=new Str(GAME_DATADIR); |
| 51 |
|
| 52 |
PipeNightDreams * g = new PipeNightDreams(fullscreen); |
| 53 |
g->setDataDir(data_dir); |
| 54 |
g->setStartingLevel(level); |
| 55 |
g->run(); |
| 56 |
delete g; |
| 57 |
} |