Results 1 to 13 of 13

Thread: VB: DX: drawing text...

  1. #1

    Thread Starter
    Banned nareth's Avatar
    Join Date
    Jun 2004
    Posts
    1,206

    VB: DX: drawing text...

    whao i was just adding text. some B's to my tiles to tell its blocked. guess what... it slowed down like hell
    has anyone noticed this to?

    this is my code:

    VB Code:
    1. Do Until L > LayerMax
    2.         If Not Layers.cLayer(L).Value = vbUnchecked Then
    3.             Let xTemp = xZ
    4.             Let yTemp = yZ
    5.            
    6.             Let X = 0
    7.             Do Until X > Map.Width
    8.                 Let xDest = xTemp
    9.                 Let yDest = yTemp
    10.                
    11.                 Let Y = 0
    12.                 Do Until Y > Map.Height
    13.                     If Map.TileX(L, X, Y) > -1 And Map.TileY(L, X, Y) > -1 Then
    14.                         Let rTile.Left = Map.TileX(L, X, Y) * TileWidth
    15.                         Let rTile.Top = Map.TileY(L, X, Y) * TileHeight
    16.                         Let rTile.Right = rTile.Left + TileWidth
    17.                         Let rTile.Bottom = rTile.Top + TileHeight
    18.                        
    19.                         Call BufferSurface.BltFast(xDest, yDest, GroundTiles, rTile, DDBLTFAST_DONOTWAIT Or DDBLTFAST_SRCCOLORKEY)
    20.                     End If
    21.                    
    22.                     If Map.Blocked(L, X, Y) Then
    23.                         [COLOR=Blue][B]Call BufferSurface.DrawText(xDest + TileHalfWidth, yDest, "B", False)[/B][/COLOR]
    24.                     End If
    25.                    
    26.                     Let xDest = xDest - TileHalfWidth
    27.                     Let yDest = yDest + TileHalfHeight
    28.                    
    29.                     Let Y = Y + 1
    30.                 Loop
    31.                
    32.                 Let xTemp = xTemp + TileHalfWidth
    33.                 Let yTemp = yTemp + TileHalfHeight
    34.                
    35.                 Let X = X + 1
    36.             Loop
    37.         End If
    38.        
    39.         Let L = L + 1
    40.     Loop

  2. #2

    Thread Starter
    Banned nareth's Avatar
    Join Date
    Jun 2004
    Posts
    1,206

    Re: VB: DX: drawing text...

    is there a faster way to draw text?

  3. #3

    Thread Starter
    Banned nareth's Avatar
    Join Date
    Jun 2004
    Posts
    1,206

    Re: VB: DX: drawing text...

    nvm i will do it difrent.. when you hover a tile i will make it so it shows in the sbar if its blocked or not...

  4. #4
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349

    Re: VB: DX: drawing text...

    Incase it still helps a faster way would be to have an image with the alphabet on and then you change the SrcRect to choose dirrefent letters. This would be quicker I guess cos its missing out the font stuff and basically just rendering a graphic .
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  5. #5

    Thread Starter
    Banned nareth's Avatar
    Join Date
    Jun 2004
    Posts
    1,206

    Re: VB: DX: drawing text...

    i dint set the font... is that why its so slow?

  6. #6
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349

    Re: VB: DX: drawing text...

    If you don't set the font then it would just use the default one but I would think its the process of it needing to use the font to work out what the text looks like first and then it still has to draw the thing after that. So if you've already made a FontList Image then your just drawing simple graphics and it dkips out that stage and instead it just takes a little of your time at design time to generate the FontList Image .
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  7. #7

    Thread Starter
    Banned nareth's Avatar
    Join Date
    Jun 2004
    Posts
    1,206

    Re: VB: DX: drawing text...

    cant i just set the font..... or something...

  8. #8
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349

    Re: VB: DX: drawing text...

    Yea you can set the font but I can't see that speeding things up .
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  9. #9

    Thread Starter
    Banned nareth's Avatar
    Join Date
    Jun 2004
    Posts
    1,206

    Re: VB: DX: drawing text...

    arf.....!!!!! well i just made a block image that will do it....

  10. #10

    Thread Starter
    Banned nareth's Avatar
    Join Date
    Jun 2004
    Posts
    1,206

    Re: VB: DX: drawing text...

    Set ddSurface = DD.CreateSurfaceFromResource(File, Name, DDSD)
    automation error... File is "Map Editor.Res" name is "102"

    why ???

  11. #11
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349

    Re: VB: DX: drawing text...

    For the -2147467259 error the SDK says:
    HRESULT: 0x80004005 (2147500037)
    Name: E_FAIL
    Description: An undetermined error occurred
    Severity code: Failed
    Facility Code: FACILITY_NULL (0)
    Error Code: 0x4005 (16389)

    Personally I've never used CreateSurfaceFromResource() I only ever use CreateSurfaceFromFile().
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  12. #12

    Thread Starter
    Banned nareth's Avatar
    Join Date
    Jun 2004
    Posts
    1,206

    Re: VB: DX: drawing text...

    i tried it like here
    http://216.5.163.53/DirectX4VB/Tutor...D_ResFiles.asp

    on this line it says
    Let DDSD.lWidth = LoadResPicture(Name, vbPicTypeBitmap).Width
    it cant find the resource???????????!!!!!!!11
    its there!!!

  13. #13
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: VB: DX: drawing text...

    Try CreateSurfaceFromFile.

    Sorry I haven't posted in here for awhile. Girl problems.

Posting Permissions

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



Click Here to Expand Forum to Full Width