DirectX7... Dynamic Surface Updating... Help
masterboodaActually I don't know the technical term for this, but this is what I'm trying to do in DirectX 7.... Say I have two surfaces.... now I blit from the second surface to the first surface.... and I then change or update the second surface... now Here is my problem... how can I make directx7 reflect on the first surface the changes I have done to the second surface, without reblitting... I know when I was working in C++ I would just make memory pointers, and when I updated the memory in one location it would mirror it in the pointer location... I want to do the same thing in vb using directx7... saving the time of reblitting... Now I know what alot of people will automatically think and that is to just have one surface and update just it... but I am putting several pieces onto the first surface, using the second as the tiles... like a tile map... Now I want to make it animate... like nintendo used to do, by just changing the pattern table... and there by updating the map... Is this possible, or am I even making sense... DaBooda Out....[:p]
sdwHave you looked up pointers in VB? I don't think you can create a pointer in VB to do what you're talking about, but there's a good chance I'm wrong. If you're trying to make a tiled map/world (whatever you call it) then there's a different way you can do it. What exactly are you trying to do?
masterboodaok... say I have a tile map that is made up of tiles that are on my pattern table... I have some grass, trees, and water.... etc... Now I want the water to move or wave.... And I want to simply do this by swapping out my pattern tables like in a flipping chain... The only problem is I then Have to reblit everything back onto my tile map... I'm looking for a way to make the tile map, actually be made up of pointers to the pattern table.... that way everytime a blit the tile map onto my back buffer it then updates it according to pattern table.... I have been looking all over for some info on pointers in vb and cannot find any, I guess I will have to redraw the tile table, every game pass, but this is so time consuming... I'm hoping there is a way to get around this... DaBooda Out...
VBBRI think the more far you can go in VB is getting the address of a variable using VarPtr.
Sr. GuapoI think you can pass pointers as parameters using ByRef (as opposed to ByVal). Don't know if that will help. VB c++ ByRef variable as Type = int *variable I think the sytax is right, I haven't used c++ in a while...
sdwSo would a generic map scroller with animated tiles be what u want done?
Eric ColemanIf you're using surfaces, you're implicitly using pointers. If A and B are surfaces, then you can easily swap them by doing something like this. [code] Dim C as Surface 'not a "new" surface, just a surface variables. Set C = A Set A = B Set B = C [/code] No blitting involved, only the object pointers were swapped, wich is fast and easy.
sdwI don't think he wants to swap his surfaces. He's saying that surface A=map B=tileset and he made some blits from B to A. He wants to change some of the tiles which he blitted to A by simply changing the surface of B, I think. Is this what you're asking?
Eric Colemana blit is copying the contents in one area of memory to another location. It is NOT a pointer copy, it is actual data that is being copied. There is no way to "blit a pointer" onto a surface. Even in C++ it is not possible, it just doesn't make any sense.
masterboodaI actually had to work around this, by making 4 different tile maps and 4 pattern tables.... I just drew onto each tilemap, according to each pattern table, and then created a flipping chain... this seems like an overabundance of memory usage, but it is the only way... As for being done in c++, I have done it... your screen in c is actually just memory, as are you surfaces in dx7(the variables you declare as the surfaces, are actually just pointers), so I was thinking there was a way to treat them the same... because in c you can set memory at one location to point to another location... that is how I made up pattern tables in c... but dx7, does not allow you to get close enough to the memory, because of its high end memory managment system... I was hoping there was a way to get around that, but obviously there is no way because there is no way of finding out where it is stored in the memory... I learned a lesson, the easier it is to program the less control you have over it... DaBooda out...
cjb0087the more control you have the more dangerous it is, so you REALLY need to know what your oing (unlike me [:D]) yum memory leaks[xx(]
Eric Coleman
quote:
Originally posted by masterbooda
As for being done in c++, I have done it... your screen in c is actually just memory, as are you surfaces in dx7(the variables you declare as the surfaces, are actually just pointers),
How in the world did you get your screen to dereference pointers? And how exactly does directx know that the data at location X,Y is a not a color but a pointer to a block of memory dx-bytes by dy-bytes in size? I'd really like to see how you accomplished this, I'm sure a lot of people could learn from your 3733+ skillz.
sdw3733+ ? lol I thought it went like 31337 or 1337 or even l33t, but I've never seen 3733+. Sry this has nothing to do with masterbooda's problem, I don't he can do what he's trying to do, he should try another way around it.
masterboodasorry for the confusion, when I went back to some of my older C++ programs.. I was just basically blitting from one spot in memory to another... Its just been so long since I have programmed in it... I had forgotten.... What I did was actually blitted every tile to the screen according to where the maps x, and y were located, My resolution was only 320 x 240 and the game screen was centered with a resolution of 256x224 and my tiles were 8x8, so all in all I'm drawing 33x29 (957) tiles.... seems like alot but actually never went below 60fps... which is my target rate, I am thinking of building 16x16 tiles out of the 8x8 and then blitting them to the screen... Sorry to confuse you guys, but thanks for the help... DaBooda Out...