author | sheepluva |
Sun, 06 Feb 2011 10:28:59 +0100 | |
changeset 4926 | f9a13dd16f01 |
parent 3697 | d5b30d6373fc |
child 4927 | 95d1c90a626b |
permissions | -rw-r--r-- |
3495
a6b4f351d400
now engine can be optionally built as library, there's an example wrapper of how to use it
koda
parents:
diff
changeset
|
1 |
/* |
a6b4f351d400
now engine can be optionally built as library, there's an example wrapper of how to use it
koda
parents:
diff
changeset
|
2 |
This is an experimental main to use with hwLibary |
a6b4f351d400
now engine can be optionally built as library, there's an example wrapper of how to use it
koda
parents:
diff
changeset
|
3 |
- create the library with `cmake . -DBUILD_ENGINE_LIBRARY=1' and `make hwengine' |
a6b4f351d400
now engine can be optionally built as library, there's an example wrapper of how to use it
koda
parents:
diff
changeset
|
4 |
- compile this file with `gcc libhwLibrary.dylib libSDLmain.a wrapper.c -o wrapper -framework Cocoa -framework SDL' |
a6b4f351d400
now engine can be optionally built as library, there's an example wrapper of how to use it
koda
parents:
diff
changeset
|
5 |
(in Mac OS X, but this command line shouldn't be much different in other OSes; make sure to set the correct files/paths) |
a6b4f351d400
now engine can be optionally built as library, there's an example wrapper of how to use it
koda
parents:
diff
changeset
|
6 |
- this executable expect a save file "Save.hws" and the data folder "Data" to be in the same launching directory |
a6b4f351d400
now engine can be optionally built as library, there's an example wrapper of how to use it
koda
parents:
diff
changeset
|
7 |
*/ |
a6b4f351d400
now engine can be optionally built as library, there's an example wrapper of how to use it
koda
parents:
diff
changeset
|
8 |
|
a6b4f351d400
now engine can be optionally built as library, there's an example wrapper of how to use it
koda
parents:
diff
changeset
|
9 |
#import <stdlib.h> |
a6b4f351d400
now engine can be optionally built as library, there's an example wrapper of how to use it
koda
parents:
diff
changeset
|
10 |
|
a6b4f351d400
now engine can be optionally built as library, there's an example wrapper of how to use it
koda
parents:
diff
changeset
|
11 |
extern void Game (const char **); |
a6b4f351d400
now engine can be optionally built as library, there's an example wrapper of how to use it
koda
parents:
diff
changeset
|
12 |
|
4926
f9a13dd16f01
update lib wrapper.c so that it actually supplies all arguments required by current Game(), instead of causing a segfault ;D
sheepluva
parents:
3697
diff
changeset
|
13 |
int SDL_main (int argc, const char **argv) |
f9a13dd16f01
update lib wrapper.c so that it actually supplies all arguments required by current Game(), instead of causing a segfault ;D
sheepluva
parents:
3697
diff
changeset
|
14 |
{ |
f9a13dd16f01
update lib wrapper.c so that it actually supplies all arguments required by current Game(), instead of causing a segfault ;D
sheepluva
parents:
3697
diff
changeset
|
15 |
// Note: if you get a segfault or other unexpected crashes on startup |
f9a13dd16f01
update lib wrapper.c so that it actually supplies all arguments required by current Game(), instead of causing a segfault ;D
sheepluva
parents:
3697
diff
changeset
|
16 |
// make sure that these arguments are up-to-date with the ones actual needed |
3697 | 17 |
|
4926
f9a13dd16f01
update lib wrapper.c so that it actually supplies all arguments required by current Game(), instead of causing a segfault ;D
sheepluva
parents:
3697
diff
changeset
|
18 |
// Note: Data dir is expected to be in current working directory |
f9a13dd16f01
update lib wrapper.c so that it actually supplies all arguments required by current Game(), instead of causing a segfault ;D
sheepluva
parents:
3697
diff
changeset
|
19 |
|
f9a13dd16f01
update lib wrapper.c so that it actually supplies all arguments required by current Game(), instead of causing a segfault ;D
sheepluva
parents:
3697
diff
changeset
|
20 |
const char **gameArgs = (const char**) malloc(sizeof(char *) * 11); |
3697 | 21 |
|
4926
f9a13dd16f01
update lib wrapper.c so that it actually supplies all arguments required by current Game(), instead of causing a segfault ;D
sheepluva
parents:
3697
diff
changeset
|
22 |
gameArgs[ 0] = "0"; //ipcPort |
f9a13dd16f01
update lib wrapper.c so that it actually supplies all arguments required by current Game(), instead of causing a segfault ;D
sheepluva
parents:
3697
diff
changeset
|
23 |
gameArgs[ 1] = "1024"; //cScreenWidth |
f9a13dd16f01
update lib wrapper.c so that it actually supplies all arguments required by current Game(), instead of causing a segfault ;D
sheepluva
parents:
3697
diff
changeset
|
24 |
gameArgs[ 2] = "768"; //cScreenHeight |
f9a13dd16f01
update lib wrapper.c so that it actually supplies all arguments required by current Game(), instead of causing a segfault ;D
sheepluva
parents:
3697
diff
changeset
|
25 |
gameArgs[ 3] = "0"; //cReducedQuality |
f9a13dd16f01
update lib wrapper.c so that it actually supplies all arguments required by current Game(), instead of causing a segfault ;D
sheepluva
parents:
3697
diff
changeset
|
26 |
gameArgs[ 4] = "en.txt"; //cLocaleFName |
f9a13dd16f01
update lib wrapper.c so that it actually supplies all arguments required by current Game(), instead of causing a segfault ;D
sheepluva
parents:
3697
diff
changeset
|
27 |
gameArgs[ 5] = "wrapper"; //UserNick |
f9a13dd16f01
update lib wrapper.c so that it actually supplies all arguments required by current Game(), instead of causing a segfault ;D
sheepluva
parents:
3697
diff
changeset
|
28 |
gameArgs[ 6] = "1"; //isSoundEnabled |
f9a13dd16f01
update lib wrapper.c so that it actually supplies all arguments required by current Game(), instead of causing a segfault ;D
sheepluva
parents:
3697
diff
changeset
|
29 |
gameArgs[ 7] = "1"; //isMusicEnabled |
f9a13dd16f01
update lib wrapper.c so that it actually supplies all arguments required by current Game(), instead of causing a segfault ;D
sheepluva
parents:
3697
diff
changeset
|
30 |
gameArgs[ 8] = "1"; //cAltDamage |
f9a13dd16f01
update lib wrapper.c so that it actually supplies all arguments required by current Game(), instead of causing a segfault ;D
sheepluva
parents:
3697
diff
changeset
|
31 |
gameArgs[ 9] = "0.0"; //rotationQt |
f9a13dd16f01
update lib wrapper.c so that it actually supplies all arguments required by current Game(), instead of causing a segfault ;D
sheepluva
parents:
3697
diff
changeset
|
32 |
gameArgs[10] = "Save.hws"; //recordFileName |
3697 | 33 |
|
3495
a6b4f351d400
now engine can be optionally built as library, there's an example wrapper of how to use it
koda
parents:
diff
changeset
|
34 |
Game(gameArgs); |
a6b4f351d400
now engine can be optionally built as library, there's an example wrapper of how to use it
koda
parents:
diff
changeset
|
35 |
free(gameArgs); |
3697 | 36 |
|
3495
a6b4f351d400
now engine can be optionally built as library, there's an example wrapper of how to use it
koda
parents:
diff
changeset
|
37 |
return 0; |
a6b4f351d400
now engine can be optionally built as library, there's an example wrapper of how to use it
koda
parents:
diff
changeset
|
38 |
} |