Results 1 to 4 of 4

Thread: Canvas does not allow drawing error

  1. #1

    Canvas does not allow drawing error

    We are developing a strategy games with Delphi + Delphix. We use both DDraw and standard forms. The game is full screen DDraw with snormal 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.

    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;

  2. #2

  3. #3

    Canvas does not allow drawing error

    Have you tried testing DXDraw.CanDraw first?
    [size=10px][ Join us in #pgd on irc.freenode.net ] [ Sign the Petition for a Software Patent Free Europe ][/size]

  4. #4

    Canvas does not allow drawing error

    THANKS! Thats the one I was looking for but at the wrong place (canvas propeties/methods).

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •