Dest Posted July 31, 2007 Share Posted July 31, 2007 So someone asked how to draw text in games. Larry posted something which I have modified here: $x = 100 $y = 100 $text = "Testing this Shiite" Global Const $TRANSPARENT = 1 Global Const $OPAQUE = 2 While 1 TextOut($x,$y,$text) WEnd Func TextOut($x,$y,$text) $hdc = DllCall("user32.dll","int","GetDC","hwnd",0) $hdc = $hdc[0] _SetBkMode( $hdc, $TRANSPARENT ) DllCall("gdi32.dll","int","TextOut","int",$hdc,"int",$x,"int",$y,"str",$text,"int",StringLen($text)) DllCall("user32.dll","int","ReleaseDC","hwnd",0,"int",$hdc) EndFunc Func _SetBkMode( $hdc, $mode, $dll_h = "Gdi32.dll") ;~ http://msdn.microsoft.com/library/en-us/gdi/pantdraw_47hh.asp Local $return = DllCall( $dll_h, "int", "SetBkMode", "ptr", $hdc, "int", $mode) Return $return[0] EndFunc This partially works as it does draw text on top of the game (fullscreen, uses direct3d) However, the text blinks rapidly making it very annoying. Is there any way to fix this? Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 31, 2007 Share Posted July 31, 2007 Only call TextOut() once each time $text changes. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Dest Posted July 31, 2007 Author Share Posted July 31, 2007 (edited) That works in a non-game environment such as the desktop. However I am trying to draw to a game and if I call it once, it goes away in about 1/2 a second due to the game's direct3d updating. So is there any way to prevent the text from flickering or being interfered with by the game's direct3d updating? Edited July 31, 2007 by Dest Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now