I'm trying to lock an area of the surface in normal mode (not full screen) that's centered in a window. The problem seems to be, if the rect.left value is larger than rect.right, or the rect.top is greater than rect.bottom, DirectX 7 refuses to lock the surface. Is there a way to fix this, short of locking the -entire- window, and only using what I need?
sure it is, pass NULL (plain zero) instead of the RECT structure and you will lock the whole surface :) and will get a pointer to the beggining of the surface (x=0, y=0, top left corner) dont forget the Pitch besides i am sure you can design a procedure that will ensure the correct relations between rect.left/right or rect.top/bottom :D
Yeah, but in normal mode, passing NULL (when it works), locks the entire screen, not the client area of the window. In fact, locking the area of 0,0,width,height locks the upper left hand corner of the screen, and not the window either. It's a screwed up system, that I spent a lot of hours trying to figure out. Besides, if I'm going to lock the whole surface, I'm going to switch to full screen mode. :) All that aside, you can't lock a specific size (say 640x480) if the upper left hand corner is greater than the width and height. Now that's totally screwed up. Oh well...guess I have to make a new surface, and blit. Thanks for the help anyway. :)
Yeah, wll you see DirectX is not made for "window mode" its native way of doing things is "full screen". Support for window mode is poor. (both software and hardware) DirectX SDK points out the behaviour you noticed quite well, and advices to use a clipper that you set to your window rectangle (yes, relatice to the whole screen area) every time your window is resized or moved After all we have GDI for windowed mode :) This message was edited by BogdanOntanu, on 4/5/2001 4:27:10 AM
You know, everyone says that, but I really don't think people actually spend the time to experiment with it. I can get higher frame rates in windowed mode (640x480x32bpp surface) than I can in full screen mode (640x480x16bpp). Maybe it's just my hardware, or maybe just more efficient code on my part, but I've gotten around 50 FPS in windowed mode, and only about 40 FPS in full screen. I don't think that's enough to warrant saying DirectX should -not- be used in full screen mode, but certainly makes it worth the time to take a look, right? :)
Hi well i gaet even greater FPS in GDI (because of my Voodo3? :D) Nope the difference is because in full screen mode you get syncronized with the refresh rate of your monitor (to avoid flicker) in window mode or GDI this does not happen.... This can get you flicker (not allways) but then again is there any logical need to redraw the image faster then the monitor can display it ? :D Also in a REAL finished games you will be very happy to get 40-50fps in the end product ... so dont worry your frame rate will drop below that in the end :D if you so like there are options to disable that wait_for_vertical_retrace in the Flip() method, or you can upsize your monitors refresh rate... IMHO games should be in full screen... for example in my RTS when i move the mouse on the screen margins i start to scroll the view...this is natural interface to allmost all games now...and is hard or imposible to do ergonomicaly in a windowed application....(you can easy get past the window margins and loose focus )