Archived

This topic is now archived and is closed to further replies.

TheSnerd

Dazed and Confused with DirectX??

Recommended Posts

Good Day! Let me quickly explain my situation: Today I have finally added a 2D-Screen class to my engine, which I use for drawing a HUD etc. Everything works fine when I CTRL+F5(start) the application from MSVC, BUT if I make a double click onto the .exe - which I first copied up one dir-level so that the directory structure is okay - the 2D part just won''t show up!! Still 3D(terrain and models) are rendered correctly, but not a single sign of the HUD. -> Textures are loaded, that''s not the problem -> The render-function is also called and runs like it should! -> This problem only occurs when I double-click the .exe file in explorer... -> I''ve already tried shortcuts to the file, but no luck. -> My first guess was that it''s connected with calling DrawPrimitiveUP - it''s the first time I use it in my engine( for the rest I have index+vertex buffers) -> ?-| no more ideas, please help me!

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Your proggy can''t find the image files. Either alter the path to the files from within your program (or however you do it) or move the images and the exe into the same directory.

Share this post


Link to post
Share on other sites
Call this function before you start loading any files:


VOID SetWorkingDir()
{
TCHAR strPath[MAX_PATH];

if (!GetModuleFileName(GetModuleHandle(NULL),strPath,MAX_PATH-1)) {
return;
}

// strip off exe name to leave path
for (INT i = strlen(strPath)-1; i>0; i--)
{
if (strPath=='\\')
{
strPath[i]=0;
break;
}
}

if (i==0) {
return;
}

// move the current working directory to the executables directory.
// this is a little rude
if (_chdir(strPath)==-1)
{
return;
}

return;
}


[ my engine ][ my game ][ my email ]
SPAM


[edited by - aftermath on April 29, 2002 10:09:09 PM]


[edited by - aftermath on April 29, 2002 10:09:54 PM]

Share this post


Link to post
Share on other sites