Jump to content
  • Advertisement
Sign in to follow this  
Jacob Roman

DirectX8 - Controlling the size of the blitting surface

This topic is 5473 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm working on a game right now called Mortal Kombat vs Street Fighter. And I am having a difficult time controling the size of the backbuffer surface. And no, it has nothing to do with changing the screen resolution. Here is an example of what I'm talking about. Let's say I have a resolution of 400x300. I want to be able to blit only 384x224 of it (standard Street Fighter 2 screen resolution), and after I offset it a little, it should leave a black boarder around it. Don't worry about the border cause I already know how to work with that ;). I want to be able to do this in both Windowed and Fullscreen mode. And I'm pretty sure it has a lot to do with this: D3DDevice.Present ByVal 0, ByVal 0, 0, ByVal 0 where D3DDevice.Present (pSourceRect As Any),(pDestRect As Any),(hWndDestWindowOverride As Long),(pDirtyRegion as Any) Since the data types are Any, obviously it has to do with pointers. I have quite a bit of experience working with pointers, and so far, this is as close as I've gotten: Dim Destination As RECT Destination.Left = 0 Destination.Top = 0 Destination.Right = 384 Destination.bottom = 224 D3DDevice.Present ByVal 0, ByVal VarPtr(Destination), Main.hWnd, ByVal 0 Only problem is that it only works with Windowed mode. I receive an Automation Error in Fullscreen mode when I use that. Plus it doesn't stretch in Windowed mode. It stays put even after stretching the window. If I wanted it to stretch in Windowed mode, I would have to do this: Dim Destination As RECT Destination.Left = 0 Destination.Top = 0 Destination.Right = Main.ScaleWidth Destination.bottom = Main.ScaleHeight D3DDevice.Present ByVal 0, ByVal VarPtr(Destination), Main.hWnd, ByVal 0 And since stretching the window is irrelivant in Fullscreen mode since you can't unless you change the screen resolution, I'm not woried about that code that has the Main.ScaleWidth & Main.ScaleHeight. I am, however, wanting to blit 384x224 on a screen resolution of 400x300, which WILL be stretched. I looked everywhere for the solution, but all I kept getting was D3DDevice.Present ByVal 0, ByVal 0, 0, ByVal 0 in every website. If you can help me, I would appreciate it. Thanks. [Edited by - Jacob Roman on September 24, 2004 7:39:22 AM]

Share this post


Link to post
Share on other sites
Advertisement
Ok, after doing some experimenting, I found you can't control the size of your blitting surface if your SwapEffect is D3DSWAPEFFECT_FLIP. So I changed it to D3DSWAPEFFECT_COPY_VSYNC and it worked in Fullscreen mode.

D3DWindow.SwapEffect = D3DSWAPEFFECT_COPY_VSYNC 'D3DSWAPEFFECT_FLIP

Just one problem. The background that's not blitted, which is VB's default form color (light grey), is flickering. Besides that, it works. I'll try to fix the flickering...(one minute later)...Fixed it. Just had to change the backcolor of the form to black. I hope this is the correct way to do what I wanted. If anyone else has a better idea, let me know.

[Edited by - Jacob Roman on September 24, 2004 1:27:31 PM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!