Results 1 to 9 of 9

Thread: Textout without text background

  1. #1

    Textout without text background

    I'm trying to make a text input (for username and password) in my game, and used TextOut to draw the text in a variable to the screen, over the area where the "input" is. The problem is that the text has a background, and isnt transparent. is there any way of removing the background from TextOut? like when you set transparent to true on labels?

  2. #2

    Textout without text background

    I think you need to set the brush to clNone or something like that. In gdi i think there is a brush called HBR_TRANSPARENT
    Peregrinus, expectavi pedes meos in cymbalis
    Nullus norvegicorum sole urinat

  3. #3

    Textout without text background

    thx! it was the brush style. had to set it to bsClear.

  4. #4
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    Textout without text background

    My answer would have also been just to set Brush.Color to bsClear. :thumbup:

    Funny thing is that this is the same for the VCL's TCanvas it's self and rather a reuse of the functionality existing there rather than being specific to DelphiX's usage.

    Now if only I could remember if it was the original TCanvas they use or a completely remade one... :think:
    Jason McMillen
    Pascal Game Development
    Co-Founder





  5. #5

    Textout without text background

    only problem is that i have to do the TDirectDraw.FLip BEFORE the TextOut... if i dont draw the text to a image, and the load that image into a TDirectDrawSurface and the draw that surface onto the TdirectDraw.Surface...

    any suggestions on how to do this better? a font-engine or something?

  6. #6
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    Textout without text background

    Actually as I recall, DelphiX requires you to Release your surface after using the canvas to continue drawing to it. If you don't release it it will not draw anything else beyond what you whee just previously doing with the canvas. his includes TextOut();.

    There should only every be 1 Flip();
    Jason McMillen
    Pascal Game Development
    Co-Founder





  7. #7

    Textout without text background

    yeah, i know, but somehow, the text doesent show up even though i use "TheDraw.Surface.Canvas.Release" after the textout...

    [pascal]
    procedure DoLogin;
    begin
    fMain.TheDraw.Surface.Draw(0,0,LoginBG.ClientRect, LoginBG,False);
    fMain.TheDraw.Surface.Draw(434,338,LoginFields.Cli entRect,LoginFields,True);
    fMain.TheDraw.Surface.Canvas.Brush.Style:= bsClear;
    fMain.TheDraw.Surface.Canvas.Font.Size:= 12;
    fMain.TheDraw.Surface.Canvas.Font.Color:= clBlack;
    fMain.TheDraw.Surface.Canvas.TextOut(440,361,Login Name);
    fMain.TheDraw.Surface.Canvas.TextOut(440,406,Login Pass);
    fMain.TheDraw.Surface.Canvas.Release;
    end;
    [/pascal]
    (i know i should use "with fmain.Thedraw do", but i just want it to work first )
    the flip comes after this on the end of the Processgamestate procedure...

  8. #8

    Textout without text background

    Try a release just before - maybe you are using a lineto or some other command that locks the surface.
    The views expressed on this programme are bloody good ones. - Fred Dagg

  9. #9

    Textout without text background

    i have tried both releasing the canvas and unlocking the surface...

    EDIT: Found a solution: setting Do3D to False!

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
  •