-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.c
62 lines (54 loc) · 1.33 KB
/
main.c
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
58
59
60
61
62
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "RTEngine.h"
#include "OptionsManager.h"
#include "SceneSerializer.h"
#include "Cluster.h"
#include "ClusterServer.h"
#include "ClusterClient.h"
#ifdef HAS_SDL
#include <SDL/SDL.h>
#endif
static void launchNormal(char *xmlFile)
{
SceneSerializerClass *serializer;
serializer = new(SceneSerializer, xmlFile);
serializer->unserialize(serializer);
RTEngineGetSingletonPtr()->renderScene();
}
static void launchCluster(char *xmlFile, char *opt)
{
ClusterClass *cluster;
SceneSerializerClass *serializer;
if (strcasecmp(opt, "Server") == 0)
{
serializer = new(SceneSerializer, xmlFile);
serializer->unserialize(serializer);
cluster = new(ClusterServer,
0, xmlFile);
}
else
cluster = new(ClusterClient, opt);
cluster->run();
}
int main(int ac, char **av)
{
RTEngineClass *engine;
OptionsManagerClass *optionsManager;
char *clusterOpt;
if (ac < 2)
{
fprintf(stderr, "Usage: %s [scene.xml|Cluster:[Server|hostip]]\n", av[0]);
return (1);
}
optionsManager = new(OptionsManager, ac, av);
engine = new(RTEngine);
clusterOpt = OptionsManagerGetSingletonPtr()\
->getOptionValue("Cluster");
if (clusterOpt == 0)
launchNormal(av[1]);
else
launchCluster(av[1], clusterOpt);
return (0);
}