97
97
char bprogname[FILE_MAXDIR+FILE_MAXFILE];
102
SCREEN_SAVER_MODE_NONE = 0,
103
SCREEN_SAVER_MODE_PREVIEW,
104
SCREEN_SAVER_MODE_SAVER,
105
SCREEN_SAVER_MODE_CONFIGURATION,
106
SCREEN_SAVER_MODE_PASSWORD,
109
static ScreenSaverMode scr_saver_mode = SCREEN_SAVER_MODE_NONE;
110
static HWND scr_saver_hwnd = NULL;
112
static BOOL scr_saver_init(int argc, char **argv)
114
scr_saver_mode = SCREEN_SAVER_MODE_NONE;
115
scr_saver_hwnd = NULL;
118
int len = ::strlen(argv[0]);
119
if (len > 4 && !::stricmp(".scr", argv[0] + len - 4))
121
scr_saver_mode = SCREEN_SAVER_MODE_CONFIGURATION;
127
scr_saver_hwnd = (HWND) ::atoi(argv[2]);
129
if (!::stricmp("/c", argv[1]))
131
scr_saver_mode = SCREEN_SAVER_MODE_CONFIGURATION;
132
if (scr_saver_hwnd == NULL)
133
scr_saver_hwnd = ::GetForegroundWindow();
135
else if (!::stricmp("/s", argv[1]))
137
scr_saver_mode = SCREEN_SAVER_MODE_SAVER;
139
else if (!::stricmp("/a", argv[1]))
141
scr_saver_mode = SCREEN_SAVER_MODE_PASSWORD;
143
else if (!::stricmp("/p", argv[1])
144
|| !::stricmp("/l", argv[1]))
146
scr_saver_mode = SCREEN_SAVER_MODE_PREVIEW;
99
155
void usage(char* program)
101
157
char * consoleoption;
108
164
printf("usage: %s [-w [-p l t w h]] %s[-g gamengineoptions] "
109
165
"[-s stereomode] filename.blend\n", program, consoleoption);
166
printf(" -h: Prints this command summary\n");
110
167
printf(" -w: display in a window\n");
111
168
printf(" -p: specify window position\n");
112
169
printf(" l = window left coordinate\n");
113
170
printf(" t = window top coordinate\n");
114
171
printf(" w = window width\n");
115
172
printf(" h = window height\n");
116
/* printf(" -f: start game in full screen mode\n");
173
printf(" -f: start game in full screen mode\n");
117
174
printf(" fw = full screen mode pixel width\n");
118
175
printf(" fh = full screen mode pixel height\n");
119
176
printf(" fb = full screen mode bits per pixel\n");
120
printf(" ff = full screen mode frequency\n"); */
177
printf(" ff = full screen mode frequency\n");
121
178
printf(" -s: start player in stereo\n");
122
printf(" stereomode = hwpageflip or syncdoubling depending on the type of stereo you want\n");
179
printf(" stereomode: hwpageflip (Quad buffered shutter glasses)\n");
180
printf(" syncdoubling (Above Below)\n");
181
printf(" sidebyside (Left Right)\n");
182
printf(" anaglyph (Red-Blue glasses)\n");
183
printf(" vinterlace (Vertical interlace for autostereo display)\n");
184
printf(" depending on the type of stereo you want\n");
124
186
printf(" -c: keep console window open\n");
188
printf(" -g: game engine options:\n");
189
printf(" Name Default Description\n");
190
printf(" ----------------------------------------\n");
191
printf(" fixedtime 0 Do the same timestep each frame \"Enable all frames\"\n");
192
printf(" nomipmap 0 Disable mipmaps\n");
193
printf(" show_framerate 0 Show the frame rate\n");
194
printf(" show_properties 0 Show debug properties\n");
195
printf(" show_profile 0 Show profiling information\n");
196
printf(" vertexarrays 1 Enable vertex arrays\n");
127
198
printf("example: %s -p 10 10 320 200 -g noaudio c:\\loadtest.blend\n", program);
199
printf("example: %s -g vertexarrays = 0 c:\\loadtest.blend\n", program);
130
202
char *get_filename(int argc, char **argv) {
213
285
bool error = false;
214
286
SYS_SystemHandle syshandle = SYS_GetSystem();
215
bool fullScreen = true;
216
bool fullScreenParFound = true;
287
bool fullScreen = false;
288
bool fullScreenParFound = false;
217
289
bool windowParFound = false;
218
290
bool closeConsole = true;
219
int stereomode = RAS_IRasterizer::RAS_STEREO_NOSTEREO;
291
RAS_IRasterizer::StereoMode stereomode = RAS_IRasterizer::RAS_STEREO_NOSTEREO;
220
292
bool stereoWindow = false;
221
293
bool stereoParFound = false;
222
294
int windowLeft = 100;
258
330
#endif // __APPLE__
260
332
GEN_init_messaging_system();
262
334
// Parse command line options
264
336
printf("argv[0] = '%s'\n", argv[0]);
266
for (i = 1; (i < argc) && !error; i++)
341
if (scr_saver_init(argc, argv))
343
switch (scr_saver_mode)
345
case SCREEN_SAVER_MODE_CONFIGURATION:
346
MessageBox(scr_saver_hwnd, "This screen saver has no options that you can set", "Screen Saver", MB_OK);
348
case SCREEN_SAVER_MODE_PASSWORD:
349
/* This is W95 only, which we currently do not support.
350
Fall-back to normal screen saver behaviour in that case... */
351
case SCREEN_SAVER_MODE_SAVER:
353
fullScreenParFound = true;
356
case SCREEN_SAVER_MODE_PREVIEW:
357
/* This will actually be handled somewhere below... */
362
for (i = 1; (i < argc) && !error
364
&& scr_saver_mode == SCREEN_SAVER_MODE_NONE
269
printf("argv[%d] = '%s'\n", i, argv[i]);
370
printf("argv[%d] = '%s' , %i\n", i, argv[i],argc);
272
372
if (argv[i][0] == '-')
274
374
switch (argv[i][1])
391
SYS_WriteCommandLineInt(syshandle, paramname, atoi(argv[i]));
392
SYS_WriteCommandLineFloat(syshandle, paramname, atof(argv[i]));
291
393
SYS_WriteCommandLineString(syshandle, paramname, argv[i]);
395
printf("%s = '%s'\n", paramname, argv[i]);
322
428
printf("error: too few options for window argument.\n");
430
} else { /* mac specific */
432
if (strncmp(argv[i], "-psn_", 5)==0)
433
i++; /* skip process serial number */
439
fullScreenParFound = true;
440
if ((i + 2) < argc && argv[i][0] != '-' && argv[i+1][0] != '-')
442
fullScreenWidth = atoi(argv[i++]);
443
fullScreenHeight = atoi(argv[i++]);
444
if ((i + 1) < argc && argv[i][0] != '-')
446
fullScreenBpp = atoi(argv[i++]);
447
if ((i + 1) < argc && argv[i][0] != '-')
448
fullScreenFrequency = atoi(argv[i++]);
328
453
// Parse window position and size options
330
455
fullScreen = false;
331
fullScreenParFound = true;
456
fullScreenParFound = true;
337
466
closeConsole = false;
341
470
if ((i + 1) < argc)
472
stereomode = (RAS_IRasterizer::StereoMode) atoi(argv[i]);
473
if (stereomode < RAS_IRasterizer::RAS_STEREO_NOSTEREO || stereomode >= RAS_IRasterizer::RAS_STEREO_MAXSTEREO)
474
stereomode = RAS_IRasterizer::RAS_STEREO_NOSTEREO;
343
476
if(!strcmp(argv[i], "nostereo")) // ok, redundant but clear
344
477
stereomode = RAS_IRasterizer::RAS_STEREO_NOSTEREO;
351
484
if(!strcmp(argv[i], "syncdoubling"))
352
485
stereomode = RAS_IRasterizer::RAS_STEREO_ABOVEBELOW;
487
if(!strcmp(argv[i], "anaglyph"))
488
stereomode = RAS_IRasterizer::RAS_STEREO_ANAGLYPH;
490
if(!strcmp(argv[i], "sidebyside"))
491
stereomode = RAS_IRasterizer::RAS_STEREO_SIDEBYSIDE;
493
if(!strcmp(argv[i], "vinterlace"))
494
stereomode = RAS_IRasterizer::RAS_STEREO_VINTERLACE;
355
498
if(strcmp(argv[i], "stencil")
400
550
GHOST_ISystem* system = GHOST_ISystem::getSystem();
403
system->getMainDisplayDimensions(fullScreenWidth, fullScreenHeight);
553
if (!fullScreenWidth || !fullScreenHeight)
554
system->getMainDisplayDimensions(fullScreenWidth, fullScreenHeight);
404
555
// process first batch of events. If the user
405
556
// drops a file on top off the blenderplayer icon, we
406
557
// recieve an event with the filename
488
639
// Check whether the game should be displayed in stereo
489
640
if (!stereoParFound)
491
if(scene->r.stereomode == RAS_IRasterizer::RAS_STEREO_NOSTEREO) // ok, redundant but clear
492
stereomode = RAS_IRasterizer::RAS_STEREO_NOSTEREO;
494
// only the hardware pageflip method needs a stereo window
495
if(scene->r.stereomode == RAS_IRasterizer::RAS_STEREO_QUADBUFFERED) {
496
stereomode = RAS_IRasterizer::RAS_STEREO_QUADBUFFERED;
642
stereomode = (RAS_IRasterizer::StereoMode) scene->r.stereomode;
643
if (stereomode == RAS_IRasterizer::RAS_STEREO_QUADBUFFERED)
497
644
stereoWindow = true;
499
if(scene->r.stereomode == RAS_IRasterizer::RAS_STEREO_ABOVEBELOW)
500
stereomode = RAS_IRasterizer::RAS_STEREO_ABOVEBELOW;
503
if(scene->r.stereomode == RAS_IRasterizer::RAS_STEREO_STENCIL)
504
stereomode = RAS_STEREO_STENCIL;
508
647
// GPG_Application app (system, maggie, startscenename);
517
app.startFullScreen(fullScreenWidth, fullScreenHeight, fullScreenBpp, fullScreenFrequency,
518
stereoWindow, stereomode);
657
if (scr_saver_mode == SCREEN_SAVER_MODE_SAVER)
659
app.startScreenSaverFullScreen(fullScreenWidth, fullScreenHeight, fullScreenBpp, fullScreenFrequency,
660
stereoWindow, stereomode);
665
app.startFullScreen(fullScreenWidth, fullScreenHeight, fullScreenBpp, fullScreenFrequency,
666
stereoWindow, stereomode);
552
701
title = "blenderplayer";
554
app.startWindow(title, windowLeft, windowTop, windowWidth, windowHeight,
555
stereoWindow, stereomode);
704
if (scr_saver_mode == SCREEN_SAVER_MODE_PREVIEW)
706
app.startScreenSaverPreview(scr_saver_hwnd, stereoWindow, stereomode);
711
app.startWindow(title, windowLeft, windowTop, windowWidth, windowHeight,
712
stereoWindow, stereomode);