From: <cad...@li...> - 2005-12-22 01:35:28
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns=3D"http://www.w3.org/1999/xhtml"> <head><style type=3D"text/css"><!-- #msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: = #fff; } #msg dt { float: left; width: 6em; font-weight: bold; } #msg dt:after { content:':';} #msg dl, #msg dt, #msg ul, #msg li { font-family: verdana,arial,helvetica= ,sans-serif; font-size: 10pt; } #msg dl a { font-weight: bold} #msg dl a:link { color:#fc3; } #msg dl a:active { color:#ff0; } #msg dl a:visited { color:#cc6; } h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; fo= nt-weight: bold; } #msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padd= ing: 6px; } #msg ul, pre { overflow: auto; } #patch { width: 100%; } #patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt= ;padding:8px;background:#369;color:#fff;margin:0;} #patch .propset h4, #patch .binary h4 {margin:0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:aut= o;} #patch .propset .diff, #patch .binary .diff {padding:10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patc= h .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch ins {background:#dfd;text-decoration:none;display:block;padding:0 = 10px;} #patch del {background:#fdd;text-decoration:none;display:block;padding:0 = 10px;} #patch .lines, .info {color:#888;background:#fff;} --></style> <title>[292] tiki/win32/src/platgl.cpp: Adding support for parsing comman= d line arguments and passing down to tiki_main</title> </head> <body> <div id=3D"msg"> <dl> <dt>Revision</dt> <dd>292</dd> <dt>Author</dt> <dd>atani</dd> <dt>Date</dt> <dd>2005-12-21 17:25:42 -0800 (Wed, 21 Dec 2005)</dd> </dl> <h3>Log Message</h3> <pre>Adding support for parsing command line arguments and passing down t= o tiki_main</pre> <h3>Modified Paths</h3> <ul> <li><a href=3D"#tikiwin32srcplatglcpp">tiki/win32/src/platgl.cpp</a></li> </ul> </div> <div id=3D"patch"> <h3>Diff</h3> <a id=3D"tikiwin32srcplatglcpp"></a> <div class=3D"modfile"><h4>Modified: tiki/win32/src/platgl.cpp (291 =3D> = 292)</h4> <pre class=3D"diff"> <span class=3D"info">--- tiki/win32/src/platgl.cpp 2005-12-22 01:23:42 UT= C (rev 291) +++ tiki/win32/src/platgl.cpp 2005-12-22 01:25:42 UTC (rev 292) </span><span class=3D"lines">@@ -97,7 +97,7 @@ </span><span class=3D"cx">=20 </span><span class=3D"cx"> ShowWindow(m_hWndMain, nCmdShow); </span><span class=3D"cx">=20 </span><del>- m_hThread =3D CreateThread(NULL, 0, GameThread, NULL, 0, &a= mp;m_dwThreadID); </del><ins>+ m_hThread =3D CreateThread(NULL, 0, GameThread, lpCmdLine, 0= , &m_dwThreadID); </ins><span class=3D"cx">=20 </span><span class=3D"cx"> while(GetMessage(&msg, NULL, 0, 0)) </span><span class=3D"cx"> { </span><span class=3D"lines">@@ -197,7 +197,7 @@ </span><span class=3D"cx"> } else { </span><span class=3D"cx"> Debug::printf("WARNING! wglSwapInterval= EXT is NULL\n"); </span><span class=3D"cx"> } </span><del>-=09 </del><ins>+ </ins><span class=3D"cx"> // Turn off the context and release the DC. </span><span class=3D"cx"> wglMakeCurrent(NULL, NULL); </span><span class=3D"cx"> ReleaseDC(m_hWndMain, hdc); </span><span class=3D"lines">@@ -226,14 +226,38 @@ </span><span class=3D"cx">=20 </span><span class=3D"cx"> DWORD WINAPI Tiki::GameThread(void *obj) </span><span class=3D"cx"> { </span><del>- Debug::printf( "GameThread beginning\n" ); </del><ins>+ Debug::printf( "GameThread beginning\n" ); </ins><span class=3D"cx">=20 </span><span class=3D"cx"> // Set up our GL context so that texture load= ing and such works as well. </span><span class=3D"cx"> m_hThreadDc =3D GetDC(m_hWndMain); </span><span class=3D"cx"> wglMakeCurrent(m_hThreadDc, m_hrc); </span><ins>+ + int argc =3D 0; + LPWSTR *args =3D CommandLineToArgvW(GetCommandLineW(), &argc); + // if we have 1 or more command line args, pass it down nicely to tiki_= main + if(argc > 0) + { + char ** argv =3D new char*[argc]; + for(int i =3D 0; i < argc; i++) + { + argv[i] =3D new char [wcslen(args[i])]; + sprintf(argv[i], "%ws", args[i]); + } + LocalFree(args); </ins><span class=3D"cx">=20 </span><del>- // This will dump us down into user code. - tiki_main(0, NULL); </del><ins>+ tiki_main(argc, argv); + + // cleanup allocated memory for cmd line args + for(int i =3D 0; i < argc; i++) + { + delete [] argv[i]; + } + delete [] argv; + } + else + { + tiki_main(0, NULL); + } </ins><span class=3D"cx">=20 </span><span class=3D"cx"> ReleaseDC(m_hWndMain, m_hThreadDc); </span><span class=3D"cx"> m_hThreadDc =3D NULL; </span></pre> </div> </div> </body> </html> |