ok, this is going to be a long post
I'm trying to make a leveleditor for a breakout clone
I use simple win32 code to display the X & Y position of my mouse. The text appears correctly on my display but now the strange thing is after 10 a 15 sec the text just dissapears again?!?
this is my function to draw text :
void DrawText(char *text, int size, int x, int y, COLORREF color)
{
HDC hdc ;
HFONT hfont = CreateFont(size,0,0,0,0,0,0,0,0,0,0,0,0, "Arial") ;
lpDDSBack->GetDC(&hdc) ;
SetTextColor(hdc,color);
SetBkMode(hdc, TRANSPARENT);
SelectObject(hdc, hfont);
TextOut(hdc,x,y,text,strlen(text));
lpDDSBack->ReleaseDC(hdc);
} // end DrawText
this is how I use the function :
void BlitMousePos()
{
strstream stringA, stringB, stringC, stringD ;
GetCursorPos(&lpArrowPos) ;
stringA << "X-pos : " << lpArrowPos.x << ends ;
stringB << "Y-pos : " << lpArrowPos.y << ends ;
// put these variables into a string
DrawText(stringA.str(), 24, 674, 15, RGB(255, 255, 255)) ;
DrawText(stringB.str(), 24, 674, 45, RGB(255, 255, 255)) ;
stringC << "X = " << ((((lpArrowPos.x)+16)/32)-1) << ends ;
stringD << "Y = " << ((((lpArrowPos.y))/16)-1) << ends ;
DrawText(stringC.str(), 24, 674, 75, RGB(255, 255, 255)) ;
DrawText(stringD.str(), 24, 674, 105, RGB(255, 255, 255)) ;
} // end of BlitMousePos()
and this is how my game loop looks like (although I think this isn't important to solve my prob :
oid Mapeditor()
{
if (bFirstRunEditor) FirstRunEditor() ;
BlitBackgroundEditor() ;
ProcessMouseInEditor() ;
ProcessKeyboardInEditor() ;
BlitMousePos() ;
BlitBlocks() ;
lpDDSPrimary->Flip(NULL, DDFLIP_WAIT) ; // flip the back-surface with the front
} // end of mapeditor()
can any1 pls help me here?
I already tried it on a different PC and got the same bug
thanx in advance for any help
Edited by - da_cobra on March 29, 2002 12:34:18 PM