views:

14

answers:

1

Hello,

I'm writing a game engine for mobile devices, and I'm trying to support multiple resolutions. The game world can be much larger than the screen, so I'm using a clipper to create a viewport on the world.

My device has a resolution of 240x320. When I set the viewport to 240x320 and my world to 240x320, all is fine. I can slide the world outside the screen without problems. However, when my viewport is 220x320 and my world is 240x320, blitting fails with DDERR_INVALIDPARAMS when the surface moves outside the screen on the left:

(09:02:06) - INFO - ERROR! DirectDraw: One or more of the passed parameters are incorrect. (DDERR_INVALIDPARAMS)
(09:02:06) - INFO - ERROR! Couldn't copy to screen. (RECT: -1, 0, 239, 320) (line 125 in file .\src\SurfaceDirectDraw.cpp)
(09:02:06) - INFO - Dimensions: (0, 0, 240, 320)
(09:02:06) - INFO - ERROR! DirectDraw: One or more of the passed parameters are incorrect. (DDERR_INVALIDPARAMS)
(09:02:06) - INFO - ERROR! Couldn't copy to screen. (RECT: -2, 0, 238, 320) (line 125 in file .\src\SurfaceDirectDraw.cpp)
(09:02:06) - INFO - Dimensions: (0, 0, 240, 320)
(09:02:06) - INFO - ERROR! DirectDraw: One or more of the passed parameters are incorrect. (DDERR_INVALIDPARAMS)
(09:02:06) - INFO - ERROR! Couldn't copy to screen. (RECT: -3, 0, 237, 320) (line 125 in file .\src\SurfaceDirectDraw.cpp)
(09:02:06) - INFO - Dimensions: (0, 0, 240, 320)

Moving the surface outside the screen on the right works fine, the surface is clipped correctly.

How can I clip surfaces on my backbuffer when the surface is larger than the backbuffer?

Thanks in advance

A: 

I don't really know if im correct (DirectDraw not used for years) but I guess its about the negative clipping rect. So maybe you should set your 0/0 to the most left/upper position so that you dont get negative numbers.

InsertNickHere
The numbers go in the negative because the surface is to the left of the backbuffer.
knight666