Hi together, I have some problems with drawing text onto the screen. For now I have created a complete DC including a backbuffer system and a running GameLoop with FPS limitation and the update routine to keep updating the content of the screen. However I am stuck with the Text. At the moment I am using TextOut with Backgroundcolor as transparent and textcolor set to the right color using the RGB Macro. The problem is, that I want the text to disappear/change after some seconds and the way I am using it now results in a mess because the new text is written over the old text so you see both. I tried to use a Rectangle and paint the text into it and I got the Rectangle and the text but I don't get the Rectangle transparent. Another problem I have is that I can't seem to change the font style to write with. I want it to be bold and larger. I tried with CreateFontIndirect and the FONTLOG Declaration but for some reason it doesn't change the style. I can't paste the source now since I am not at home but at a friends computer. I don't think that the source is needed for this. I hope one of you can help me with this. Stefan
Posted on 2001-05-27 10:14:00 by Stefan Krause
Hi Stefan, to change the font of the text using TextOut you first have to select the font to the dc like this: -----------snip---------------

INVOKE  CreateFont,25,15,0,0,200,0,0,0,OEM_CHARSET,\
                            DEFAULT_QUALITY,DEFAULT_PITCH or FF_SCRIPT,\
                            ADDR fontname
		push eax    
                INVOKE GetWindowDC,hdlg
                mov dlgdc,eax
                pop eax
                INVOKE SelectObject,dlgdc,eax
                mov    hfont,eax
                RGB    255,255,255
		invoke SetTextColor,dlgdc,eax
		RGB    0,0,0
		invoke SetBkColor,dlgdc,eax
		invoke lstrlen,addr buttontext1
		invoke TextOut,dlgdc,155,8,ADDR buttontext1,eax
		invoke SelectObject,dlgdc, hfont
--------------snip------------------- to 'delete' the text you can repaint your whole backbuffer dc with FillRect. If this isn't possible for you, why don't you overwrite the text with Rectangle API? just place the rectangle over the text........... hope this helps. bye
Posted on 2001-05-27 12:07:00 by [SaFc0n]
Hi SaFc0n, strange to see this code snippet. I did nearly the same thing (as far as I remember!) and it didn't work. I will try this when I come home again. To all the others: Any ideas how to get the rectangle transparent? hehe, I hope I don't get the source code I wrote cause then I will be more than bewildered See you all. Stefan
Posted on 2001-05-27 16:32:00 by Stefan Krause