misc/wrapper.c
author nemo
Fri, 29 Oct 2010 16:31:37 -0400
changeset 4015 2897cf5730e7
parent 3697 d5b30d6373fc
child 4926 f9a13dd16f01
permissions -rw-r--r--
This should only allow switching from portal gun and the like.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 <stdio.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
#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
    11
a6b4f351d400 now engine can be optionally built as library, there's an example wrapper of how to use it
koda
parents:
diff changeset
    12
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
    13
a6b4f351d400 now engine can be optionally built as library, there's an example wrapper of how to use it
koda
parents:
diff changeset
    14
int SDL_main (int argc, const char **argv) {
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3495
diff changeset
    15
3495
a6b4f351d400 now engine can be optionally built as library, there's an example wrapper of how to use it
koda
parents:
diff changeset
    16
    const char **gameArgs = (const char**) malloc(sizeof(char *) * 9);
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3495
diff changeset
    17
3495
a6b4f351d400 now engine can be optionally built as library, there's an example wrapper of how to use it
koda
parents:
diff changeset
    18
    gameArgs[0] = "wrapper";    //UserNick
a6b4f351d400 now engine can be optionally built as library, there's an example wrapper of how to use it
koda
parents:
diff changeset
    19
	gameArgs[1] = "0";          //ipcPort
a6b4f351d400 now engine can be optionally built as library, there's an example wrapper of how to use it
koda
parents:
diff changeset
    20
	gameArgs[2] = "0";          //isSoundEnabled
a6b4f351d400 now engine can be optionally built as library, there's an example wrapper of how to use it
koda
parents:
diff changeset
    21
	gameArgs[3] = "0";          //isMusicEnabled
a6b4f351d400 now engine can be optionally built as library, there's an example wrapper of how to use it
koda
parents:
diff changeset
    22
	gameArgs[4] = "en.txt";     //cLocaleFName
a6b4f351d400 now engine can be optionally built as library, there's an example wrapper of how to use it
koda
parents:
diff changeset
    23
	gameArgs[5] = "0";          //cAltDamage
a6b4f351d400 now engine can be optionally built as library, there's an example wrapper of how to use it
koda
parents:
diff changeset
    24
	gameArgs[6] = "768";        //cScreenHeight
a6b4f351d400 now engine can be optionally built as library, there's an example wrapper of how to use it
koda
parents:
diff changeset
    25
    gameArgs[7] = "1024";       //cScreenHeight
a6b4f351d400 now engine can be optionally built as library, there's an example wrapper of how to use it
koda
parents:
diff changeset
    26
    gameArgs[8] = "Save.hws";   //recordFileName
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3495
diff changeset
    27
3495
a6b4f351d400 now engine can be optionally built as library, there's an example wrapper of how to use it
koda
parents:
diff changeset
    28
    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
    29
    free(gameArgs);
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3495
diff changeset
    30
3495
a6b4f351d400 now engine can be optionally built as library, there's an example wrapper of how to use it
koda
parents:
diff changeset
    31
    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
    32
}