Last change
on this file was
167,
checked in by (none), 14 years ago
|
Simeo: added final project and also older proof of concept code.
We used Git for version control, so look at the Git repo
in SIMEO/Simeo/ for more info.
|
File size:
1.1 KB
|
Line | |
---|
1 | #include <stdio.h> |
---|
2 | #include "DemoApplication.h" |
---|
3 | #include "GuiUpdater.h" |
---|
4 | #include <BulletDynamics/Dynamics/btRigidBody.h> |
---|
5 | |
---|
6 | #include <pthread.h> |
---|
7 | |
---|
8 | typedef struct { |
---|
9 | DemoApplication *demo; |
---|
10 | int argc; |
---|
11 | char **argv; |
---|
12 | } threadParam; |
---|
13 | |
---|
14 | void *guiThreadCode(void *args) |
---|
15 | { |
---|
16 | threadParam *param = (threadParam*)args; |
---|
17 | |
---|
18 | DemoApplication *vworld = param->demo; |
---|
19 | char **argv = param->argv; |
---|
20 | int argc = param->argc; |
---|
21 | |
---|
22 | int ret = glutmain(argc, argv, 640, 480, "SIMEO GUI", vworld); |
---|
23 | |
---|
24 | if(ret < 0) |
---|
25 | printf("Error launching glutmain\n"); |
---|
26 | |
---|
27 | return NULL; |
---|
28 | } |
---|
29 | |
---|
30 | int main(int argc, char *argv[]) |
---|
31 | { |
---|
32 | printf("SimeoGui\n"); |
---|
33 | |
---|
34 | if (argc != 3) { |
---|
35 | fprintf(stderr, "Usage: %s <host> <port>\n", argv[0]); |
---|
36 | return 1; |
---|
37 | } |
---|
38 | |
---|
39 | pthread_t guiThread; |
---|
40 | threadParam param; |
---|
41 | |
---|
42 | DemoApplication *demo = new DemoApplication(); |
---|
43 | |
---|
44 | param.demo = demo; |
---|
45 | param.argc = argc; |
---|
46 | param.argv = argv; |
---|
47 | |
---|
48 | GuiUpdater *updater = new GuiUpdater(atoi(argv[2]), gethostbyname(argv[1])); |
---|
49 | |
---|
50 | pthread_create(&guiThread, NULL, guiThreadCode, ¶m); |
---|
51 | |
---|
52 | updater->init(); |
---|
53 | |
---|
54 | while (1) { |
---|
55 | updater->update(); |
---|
56 | demo->updateInfo(updater->m_cache); |
---|
57 | } |
---|
58 | |
---|
59 | return 0; |
---|
60 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.