~ubuntu-branches/ubuntu/lucid/blender/lucid

« back to all changes in this revision

Viewing changes to source/gameengine/GamePlayer/ghost/GPG_ghost.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Chris Coulson
  • Date: 2009-08-06 22:32:19 UTC
  • mfrom: (1.2.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20090806223219-8z4eej1u8levu4pz
Tags: 2.49a+dfsg-0ubuntu1
* Merge from debian unstable, remaining changes:
  - debian/control: Build-depend on python-2.6 rather than python-2.5.
  - debian/misc/*.desktop: Add Spanish translation to .desktop 
    files.
  - debian/pyversions: 2.6.
  - debian/rules: Clean *.o of source/blender/python/api2_2x/
* New upstream release (LP: #382153).
* Refreshed patches:
  - 01_sanitize_sys.patch
  - 02_tmp_in_HOME
  - 10_use_systemwide_ftgl
  - 70_portability_platform_detection
* Removed patches merged upstream:
  - 30_fix_python_syntax_warning
  - 90_ubuntu_ffmpeg_52_changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**
2
 
* $Id: GPG_ghost.cpp 17012 2008-10-11 00:56:49Z blendix $
 
2
* $Id: GPG_ghost.cpp 19999 2009-04-30 08:01:31Z campbellbarton $
3
3
*
4
4
 * ***** BEGIN GPL LICENSE BLOCK *****
5
5
 *
162
162
        consoleoption = "";
163
163
#endif
164
164
        
165
 
        printf("usage:   %s [-w [-p l t w h]] %s[-g gamengineoptions] "
 
165
        printf("usage:   %s [-w [w h l t]] [-f [fw fh fb ff]] %s[-g gamengineoptions] "
166
166
                "[-s stereomode] filename.blend\n", program, consoleoption);
167
 
        printf("  -h: Prints this command summary\n");
 
167
        printf("  -h: Prints this command summary\n\n");
168
168
        printf("  -w: display in a window\n");
169
 
        printf("  -p: specify window position\n");
 
169
        printf("       --Optional parameters--\n"); 
 
170
        printf("       w = window width\n");
 
171
        printf("       h = window height\n\n");
170
172
        printf("       l = window left coordinate\n");
171
173
        printf("       t = window top coordinate\n");
172
 
        printf("       w = window width\n");
173
 
        printf("       h = window height\n");
 
174
        printf("       Note: If w or h is defined, both must be defined.\n");
 
175
        printf("          Also, if l or t is defined, all options must be used.\n\n");
174
176
        printf("  -f: start game in full screen mode\n");
 
177
        printf("       --Optional parameters--\n");
175
178
        printf("       fw = full screen mode pixel width\n");
176
 
        printf("       fh = full screen mode pixel height\n");
 
179
        printf("       fh = full screen mode pixel height\n\n");
177
180
        printf("       fb = full screen mode bits per pixel\n");
178
181
        printf("       ff = full screen mode frequency\n");
 
182
        printf("       Note: If fw or fh is defined, both must be defined.\n");
 
183
        printf("          Also, if fb is used, fw and fh must be used. ff requires all options.\n\n");
179
184
        printf("  -s: start player in stereo\n");
180
185
        printf("       stereomode: hwpageflip       (Quad buffered shutter glasses)\n");
181
186
        printf("                   syncdoubling     (Above Below)\n");
182
187
        printf("                   sidebyside       (Left Right)\n");
183
188
        printf("                   anaglyph         (Red-Blue glasses)\n");
184
189
        printf("                   vinterlace       (Vertical interlace for autostereo display)\n");
185
 
        printf("                             depending on the type of stereo you want\n");
 
190
        printf("                             depending on the type of stereo you want\n\n");
186
191
#ifndef _WIN32
187
 
        printf("  -i: parent windows ID \n");
 
192
        printf("  -i: parent windows ID \n\n");
188
193
#endif
189
194
#ifdef _WIN32
190
 
        printf("  -c: keep console window open\n");
 
195
        printf("  -c: keep console window open\n\n");
191
196
#endif
192
 
        printf("  -d: turn debugging on\n");
193
 
        printf("  -g: game engine options:\n");
194
 
        printf("       Name            Default      Description\n");
195
 
        printf("       ----------------------------------------\n");
196
 
        printf("       fixedtime          0         Do the same timestep each frame \"Enable all frames\"\n");
197
 
        printf("       nomipmap           0         Disable mipmaps\n");
198
 
        printf("       show_framerate     0         Show the frame rate\n");
199
 
        printf("       show_properties    0         Show debug properties\n");
200
 
        printf("       show_profile       0         Show profiling information\n");
201
 
        printf("       blender_material   0         Enable material settings\n");
202
 
        printf("\n");
203
 
        printf("example: %s -p 10 10 320 200 -g noaudio c:\\loadtest.blend\n", program);
 
197
        printf("  -d: turn debugging on\n\n");
 
198
        printf("  -g: game engine options:\n\n");
 
199
        printf("       Name                       Default      Description\n");
 
200
        printf("       ------------------------------------------------------------------------\n");
 
201
        printf("       fixedtime                      0         \"Enable all frames\"\n");
 
202
        printf("       nomipmap                       0         Disable mipmaps\n");
 
203
        printf("       show_framerate                 0         Show the frame rate\n");
 
204
        printf("       show_properties                0         Show debug properties\n");
 
205
        printf("       show_profile                   0         Show profiling information\n");
 
206
        printf("       blender_material               0         Enable material settings\n");
 
207
        printf("       ignore_deprecation_warnings    1         Ignore deprecation warnings\n");
 
208
        printf("\n");
 
209
        printf("  - : all arguments after this are ignored, allowing python to access them from sys.argv\n");
 
210
        printf("\n");
 
211
        printf("example: %s -w 320 200 10 10 -g noaudio c:\\loadtest.blend\n", program);
204
212
        printf("example: %s -g show_framerate = 0 c:\\loadtest.blend\n", program);
205
213
}
206
214
 
240
248
                if (BLI_exists(gamefile))
241
249
                        BLI_strncpy(filename, gamefile, FILE_MAXDIR + FILE_MAXFILE);
242
250
 
243
 
                delete gamefile;
 
251
                delete [] gamefile;
244
252
        }
245
253
        
246
254
#else
287
295
int main(int argc, char** argv)
288
296
{
289
297
        int i;
 
298
        int argc_py_clamped= argc; /* use this so python args can be added after ' - ' */
290
299
        bool error = false;
291
300
        SYS_SystemHandle syshandle = SYS_GetSystem();
292
301
        bool fullScreen = false;
387
396
#endif
388
397
                if (argv[i][0] == '-')
389
398
                {
 
399
                        /* ignore all args after " - ", allow python to have own args */
 
400
                        if (argv[i][1]=='\0') {
 
401
                                argc_py_clamped= i;
 
402
                                break;
 
403
                        }
 
404
                        
390
405
                        switch (argv[i][1])
391
406
                        {
392
407
                        case 'g':
431
446
                                G.f |= G_DEBUG;     /* std output printf's */
432
447
                                MEM_set_memory_debug();
433
448
                                break;
434
 
                                
435
 
                        case 'p':
436
 
                                // Parse window position and size options
437
 
                                if (argv[i][2] == 0) {
438
 
                                        i++;
439
 
                                        if ((i + 4) < argc)
440
 
                                        {
441
 
                                                windowLeft = atoi(argv[i++]);
442
 
                                                windowTop = atoi(argv[i++]);
443
 
                                                windowWidth = atoi(argv[i++]);
444
 
                                                windowHeight = atoi(argv[i++]);
445
 
                                                windowParFound = true;
446
 
                                        }
447
 
                                        else
448
 
                                        {
449
 
                                                error = true;
450
 
                                                printf("error: too few options for window argument.\n");
451
 
                                        }
452
 
                                } else { /* mac specific */
453
 
                                
454
 
                    if (strncmp(argv[i], "-psn_", 5)==0) 
455
 
                        i++; /* skip process serial number */
456
 
                                }
457
 
                                break;
 
449
 
458
450
                        case 'f':
459
451
                                i++;
460
452
                                fullScreen = true;
461
453
                                fullScreenParFound = true;
462
 
                                if ((i + 2) < argc && argv[i][0] != '-' && argv[i+1][0] != '-')
 
454
                                if ((i + 2) <= argc && argv[i][0] != '-' && argv[i+1][0] != '-')
463
455
                                {
464
456
                                        fullScreenWidth = atoi(argv[i++]);
465
457
                                        fullScreenHeight = atoi(argv[i++]);
466
 
                                        if ((i + 1) < argc && argv[i][0] != '-')
 
458
                                        if ((i + 1) <= argc && argv[i][0] != '-')
467
459
                                        {
468
460
                                                fullScreenBpp = atoi(argv[i++]);
469
 
                                                if ((i + 1) < argc && argv[i][0] != '-')
 
461
                                                if ((i + 1) <= argc && argv[i][0] != '-')
470
462
                                                        fullScreenFrequency = atoi(argv[i++]);
471
463
                                        }
472
464
                                }
473
465
                                break;
474
466
                        case 'w':
475
467
                                // Parse window position and size options
 
468
                                i++;
 
469
                                fullScreen = false;
 
470
                                windowParFound = true;
 
471
 
 
472
                                if ((i + 2) <= argc && argv[i][0] != '-' && argv[i+1][0] != '-')
476
473
                                {
477
 
                                        fullScreen = false;
478
 
                                        fullScreenParFound = true;
479
 
                                        i++;
 
474
                                        windowWidth = atoi(argv[i++]);
 
475
                                        windowHeight = atoi(argv[i++]);
 
476
                                        if ((i +2) <= argc && argv[i][0] != '-' && argv[i+1][0] != '-')
 
477
                                        {
 
478
                                                windowLeft = atoi(argv[i++]);
 
479
                                                windowTop = atoi(argv[i++]);
 
480
                                        }
480
481
                                }
481
482
                                break;
 
483
                                        
482
484
                        case 'h':
483
485
                                usage(argv[0]);
484
486
                                return 0;
603
605
                                char pathname[FILE_MAXDIR + FILE_MAXFILE];
604
606
                                char *titlename;
605
607
 
606
 
                                get_filename(argc, argv, filename);
 
608
                                get_filename(argc_py_clamped, argv, filename);
607
609
                                if(filename[0])
608
610
                                        BLI_convertstringcwd(filename);
609
611
                                
698
700
                                                }
699
701
                                                
700
702
                                                //                                      GPG_Application app (system, maggie, startscenename);
701
 
                                                app.SetGameEngineData(maggie, scene);
 
703
                                                app.SetGameEngineData(maggie, scene, argc, argv); /* this argc cant be argc_py_clamped, since python uses it */
702
704
                                                
703
705
                                                BLI_strncpy(pathname, maggie->name, sizeof(pathname));
704
706
                                                BLI_strncpy(G.sce, maggie->name, sizeof(G.sce));
 
707
                                                setGamePythonPath(G.sce);
705
708
 
706
709
                                                if (firstTimeRunning)
707
710
                                                {
708
 
                                                        setGamePythonPath(G.sce);
709
711
                                                        firstTimeRunning = false;
710
712
 
711
713
                                                        if (fullScreen)