|
-
Jan 10th, 2005, 04:40 AM
#1
Thread Starter
Banned
VB; DX; Object Placement
VB Code:
Let I = Map.Object(L, X, Y)
If Not I < 0 And Not I > TileObjectCount Then
Let rTile.Left = 0
Let rTile.Top = 0
Let rTile.Right = TileObjects(I).Width
Let rTile.Bottom = TileObjects(I).Height
Let xObject = xDest - rTile.Right \ 2 * TileWidth
If xObject < 0 Then
Let rTile.Left = -xObject
End If
Let yObject = yDest - rTile.Bottom + TileHeight
If yObject < 0 Then
Let rTile.Top = -yObject
End If
Call BufferSurface.ddSurface.BltFast(xObject, yObject, TileObjects(I).ddSurface, rTile, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
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.
-
Jan 11th, 2005, 02:00 PM
#2
Thread Starter
Banned
Re: VB; DX; Object Placement
-
Jan 13th, 2005, 10:34 AM
#3
Thread Starter
Banned
Re: VB; DX; Object Placement
-
Jan 13th, 2005, 12:32 PM
#4
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.
-
Jan 18th, 2005, 10:52 AM
#5
Thread Starter
Banned
Re: VB; DX; Object Placement
could you give me some code/info on the tlvertex please
-
Jan 18th, 2005, 12:31 PM
#6
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.
-
Jan 18th, 2005, 12:33 PM
#7
Re: VB; DX; Object Placement
-
Jan 18th, 2005, 12:51 PM
#8
Thread Starter
Banned
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?
-
Jan 18th, 2005, 01:17 PM
#9
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.
ØØ
-
Jan 18th, 2005, 01:25 PM
#10
Thread Starter
Banned
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?....
-
Jan 18th, 2005, 01:29 PM
#11
Thread Starter
Banned
Re: VB; DX; Object Placement
so basicly if the TLVertex goes offscreen it still draws?
-
Jan 18th, 2005, 01:41 PM
#12
Re: VB; DX; Object Placement
 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.
-
Jan 18th, 2005, 01:43 PM
#13
Thread Starter
Banned
Re: VB; DX; Object Placement
well im thiking about still going to DX8 because off the lighting and faster (i think)
-
Jan 18th, 2005, 01:50 PM
#14
Thread Starter
Banned
Re: VB; DX; Object Placement
 Originally Posted by nareth
so basicly if the TLVertex goes offscreen it still draws?
confirm this please
-
Jan 18th, 2005, 03:23 PM
#15
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.
-
Jan 18th, 2005, 03:27 PM
#16
Thread Starter
Banned
Re: VB; DX; Object Placement
cool features.. i will do it must poeple support it nowadays anyway so it gonna be good
-
Jan 19th, 2005, 09:45 AM
#17
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|