Click to See Complete Forum and Search --> : Surface width problem (DirectDraw7)
Oafo
Jan 8th, 2002, 07:51 PM
Why is it that I can't make a surface any wider than my screen resolution but I can make it as tall as I want? I'm still working on this $#@^ing map editor and it flickers like all hell but I'm sure I'll figure it out. Anyways, if you know what's goin on with the width problem, let me know, thanks.
Sastraxi
Jan 8th, 2002, 07:58 PM
Try storing the surface explicitly in Virtual memory. If it works, then make it smaller, because your Graphics Card can't handle those surfaces. Virtual Memory is using your HDD as memory.
Oafo
Jan 8th, 2002, 08:07 PM
Ok, then how can I stop the stretching when I blt the BackBuffer to the Primary surface?
Sastraxi
Jan 8th, 2002, 08:35 PM
Stretching?? :eek:
Look at the rects. Make sure they are the same when Left is taken away from Right and Top from Bottom. That'll let you know if YOU are doing the stretching.
PsychoMark
Jan 9th, 2002, 02:21 AM
I guess you're drawing the whole map to a huge surface, then draw a part of it on the screen? Damn, that'll take up quite some memory when the maps get larger.... try using something more intelligent.
The easiest way is to simply re-draw each tile each iteration, not very intelligent though, but it works. The faster (but more difficult) way could be to pre-draw only a portion of the map (slightly larger than the screen maybe, or exactly the size preferably), move the whole thing if the screen moves and draw any new tiles needed at the edges only; drawing one large rectangle is faster than drawing a lot of small ones...
About the width: yes, there's a maximum. Most of the time, surfaces wider than the screen can not be used...
Oafo
Jan 9th, 2002, 09:28 AM
It can't be wider even if it's a BackBuffer?
PsychoMark
Jan 10th, 2002, 02:58 AM
Nope. Why would you need a backbuffer larger than the screen area anyways, with some clever programming you can optimize speed and memory usage, without having those problems...
Oafo
Jan 10th, 2002, 12:09 PM
Yeah I got something figured out now. The problem is getting it to work right, it's gonna take some time. Also, anyone know how I can "Lock" a surface so I don't have to keep redrawing it? I know there's a .Lock action but that's not what I want to do. A good example of the kind of map editor I'm trying to make is the one for WarCraft II BNE. The problem is, when the I move a 32x32 shape around so the user knows where their next tile will be placed, it goes under the primary surface and flickers while you move it around. Hopefully, not having to redraw the surface constantly will help. Thanks.
PsychoMark
Jan 10th, 2002, 12:18 PM
First of all, never draw directly to the front surface unless it's for drawing the backbuffer to it (which you won't need, that's what Flip is for :)).
If you want to save what's on the screen, create another surface, store the screen there, and draw the rectangle over that. Locking it won't work as far as I know, you'll need to redraw it at least every time Windows asks for it or the user moves...
Oafo
Jan 10th, 2002, 12:47 PM
I'm not drawing directly to the primary surface. When I get home, I'll post up my project so you can see what my problem is. You should be able to tell right away. Thanks for helpin.
Oafo
Jan 10th, 2002, 05:06 PM
Ok here it is, please let me know if you can "lock" the surface so that when you move the mini map around, it doesn't erase the part of the surface it goes over. There's a few more things, just help with what you can, please. Thanks.
Nirces
Jan 11th, 2002, 04:33 AM
Haven't looked at your project.
heres a quick example i made for a lecturer, of a window'ed tile engine, its rather simple, and theres a slight problem with the bottom right clipping.
it also runs through each tile rather than just the tiles that are on the screen.
Oafo
Jan 11th, 2002, 11:31 PM
Thanks man, that's exactly what I was looking for. If I had a hundred bucks, I would give it to you. Thanks again.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.