Results 1 to 17 of 17

Thread: VB; DX; Object Placement

  1. #1

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

    VB; DX; Object Placement

    VB Code:
    1. Let I = Map.Object(L, X, Y)
    2.                     If Not I < 0 And Not I > TileObjectCount Then
    3.                         Let rTile.Left = 0
    4.                         Let rTile.Top = 0
    5.                         Let rTile.Right = TileObjects(I).Width
    6.                         Let rTile.Bottom = TileObjects(I).Height
    7.                        
    8.                         Let xObject = xDest - rTile.Right \ 2 * TileWidth
    9.                         If xObject < 0 Then
    10.                             Let rTile.Left = -xObject
    11.                         End If
    12.                        
    13.                         Let yObject = yDest - rTile.Bottom + TileHeight
    14.                         If yObject < 0 Then
    15.                             Let rTile.Top = -yObject
    16.                         End If
    17.                        
    18.                         Call BufferSurface.ddSurface.BltFast(xObject, yObject, TileObjects(I).ddSurface, rTile, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
    19.                     End If

    when i place an object i use this code to draw it. but when you scoll my map and the object rect goes offscreen it still disapears the xObject, Yobject code is what i use to try to keep it on the surface but it doesnt work HELP.

  2. #2

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

    Re: VB; DX; Object Placement

    bump

  3. #3

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

    Re: VB; DX; Object Placement

    bump

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

    Re: VB; DX; Object Placement

    Yeah for some reason DirectDraw does that. When you scroll or have the object move passed the border of your window (or even drawing directly over or passed it), your sprite that you are drawing for some reason will disappear. I have not seen a solution to this anywhere, but it may have something to do with disabling the clipping. If not, creating your own kind of sprite clipping might be the solution to that as well, but I'm pretty sure there is a way to have DirectX do it for ya.

    My solution to this problem was to do 2D using Direct3D by using a TLVertex. I had more control than using DirectDraw cause it would automatically clip my sprites correctly (which is the solution to your problem), gave me the ability to rotate and alphablend, lighting, 3D shadows on 2D sprites, etc.

  5. #5

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

    Re: VB; DX; Object Placement

    could you give me some code/info on the tlvertex please

  6. #6
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: VB; DX; Object Placement

    I don't have any code for that in VB. But if you check out directx4vb you can see a sample on how to get scrooling image algorithm should look like. I know there is a sample there. And I have a few on my computer too.

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

    Re: VB; DX; Object Placement

    http://216.5.163.53/DirectX4VB/TUT_DX8_DG.asp

    It'll be under 2D Graphics part 1 and 2

  8. #8

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

    Re: VB; DX; Object Placement

    it seems alot of work im using DX7 why should i go to DX8? is dx8 faster than 7 and can i tdraw text faster than 7?

  9. #9
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: VB; DX; Object Placement

    DX8 does not have DDraw, so you have to use D3D. A bit more advanced, but on newer PCs with new GPUs it will probably be faster, since 2D is kind of outdated when it comes to graphics programming. But it is still a lot of fun to use DDraw though.


    ØØ

  10. #10

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

    Re: VB; DX; Object Placement

    ha ok, but i really try to make the program work for as much users ass possible.

    is it still wise to get into DX8?....

  11. #11

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

    Re: VB; DX; Object Placement

    so basicly if the TLVertex goes offscreen it still draws?

  12. #12
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: VB; DX; Object Placement

    Quote Originally Posted by nareth
    ha ok, but i really try to make the program work for as much users ass possible.

    is it still wise to get into DX8?....
    More users will be supported if you use DX7.

  13. #13

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

    Re: VB; DX; Object Placement

    well im thiking about still going to DX8 because off the lighting and faster (i think)

  14. #14

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

    Re: VB; DX; Object Placement

    Quote Originally Posted by nareth
    so basicly if the TLVertex goes offscreen it still draws?
    confirm this please

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

    Re: VB; DX; Object Placement

    Yep. That's why I recommend it over DirectDraw. Plus you can rotate, alphablend, do lighting and 3D shadows on 2D polygons, etc.

  16. #16

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

    Re: VB; DX; Object Placement

    cool features.. i will do it must poeple support it nowadays anyway so it gonna be good

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

    Re: VB; DX; Object Placement

    I believe when it is completely off screen though (where you can't see it at all) it doesn't get drawn. This is good because if you have 1000's of polygons being drawn, you don't want the ones you can't see drawn anyways. I just didn't like the fact that DirectDraw eliminates drawing a surface when only part of it is off screen.

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