misc/wrapper.c
changeset 4926 f9a13dd16f01
parent 3697 d5b30d6373fc
child 4927 95d1c90a626b
equal deleted inserted replaced
4925:3d90fd7f738a 4926:f9a13dd16f01
     4  - compile this file with `gcc libhwLibrary.dylib libSDLmain.a wrapper.c -o wrapper -framework Cocoa -framework SDL'
     4  - compile this file with `gcc libhwLibrary.dylib libSDLmain.a wrapper.c -o wrapper -framework Cocoa -framework SDL'
     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)
     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)
     6  - this executable expect a save file "Save.hws" and the data folder "Data" to be in the same launching directory
     6  - this executable expect a save file "Save.hws" and the data folder "Data" to be in the same launching directory
     7  */
     7  */
     8 
     8 
     9 #import <stdio.h>
       
    10 #import <stdlib.h>
     9 #import <stdlib.h>
    11 
    10 
    12 extern void Game (const char **);
    11 extern void Game (const char **);
    13 
    12 
    14 int SDL_main (int argc, const char **argv) {
    13 int SDL_main (int argc, const char **argv)
       
    14 {
       
    15     // Note: if you get a segfault or other unexpected crashes on startup
       
    16     // make sure that these arguments are up-to-date with the ones actual needed
    15 
    17 
    16     const char **gameArgs = (const char**) malloc(sizeof(char *) * 9);
    18     // Note: Data dir is expected to be in current working directory
    17 
    19 
    18     gameArgs[0] = "wrapper";    //UserNick
    20     const char **gameArgs = (const char**) malloc(sizeof(char *) * 11);
    19 	gameArgs[1] = "0";          //ipcPort
    21 
    20 	gameArgs[2] = "0";          //isSoundEnabled
    22     gameArgs[ 0] = "0";          //ipcPort
    21 	gameArgs[3] = "0";          //isMusicEnabled
    23     gameArgs[ 1] = "1024";       //cScreenWidth
    22 	gameArgs[4] = "en.txt";     //cLocaleFName
    24     gameArgs[ 2] = "768";        //cScreenHeight
    23 	gameArgs[5] = "0";          //cAltDamage
    25     gameArgs[ 3] = "0";          //cReducedQuality
    24 	gameArgs[6] = "768";        //cScreenHeight
    26     gameArgs[ 4] = "en.txt";     //cLocaleFName
    25     gameArgs[7] = "1024";       //cScreenHeight
    27     gameArgs[ 5] = "wrapper";    //UserNick
    26     gameArgs[8] = "Save.hws";   //recordFileName
    28     gameArgs[ 6] = "1";          //isSoundEnabled
       
    29     gameArgs[ 7] = "1";          //isMusicEnabled
       
    30     gameArgs[ 8] = "1";          //cAltDamage
       
    31     gameArgs[ 9] = "0.0";        //rotationQt
       
    32     gameArgs[10] = "Save.hws";   //recordFileName
    27 
    33 
    28     Game(gameArgs);
    34     Game(gameArgs);
    29     free(gameArgs);
    35     free(gameArgs);
    30 
    36 
    31     return 0;
    37     return 0;