Sign in to follow this  

Canvas does not allow drawing error

This topic is 4837 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

We are developing a strategy game with Delphi + Delphix. We use both DDraw and standard forms. The game is full screen DDraw with normal forms on top. The game is quite stable until I alt-tab or debug, in these cases many times I get the error message: Canvas does not allow drawing. (Debugging is a pain with this problem) In the code this happens where we write text on the screen with textout (I know its lame, but it works fine otherwise) We have tried putting the part in a try section with an exception that does nothing, but that did not help. We have also tried trylock, but in that case we lost all the text outputs. How can I check whether the canvas is available or not before doing the textout? Below is our procedure that is causing the problem (or maybe the first to run when the problem occurs). procedure TGamesForm.SzovegKi(x,y:integer; s:string; fc:Tcolor); begin // hova mit betuszin with DXDraw.Surface.Canvas do begin Font.Color := fc; TextOut(x,y,s); Release; end; end;

Share this post


Link to post
Share on other sites
Sign in to follow this