0

我正在为移动设备编写游戏引擎,并且正在尝试支持多种分辨率。游戏世界可能比屏幕大得多,所以我使用剪辑器在世界上创建视口。

我的设备的分辨率为 240x320。当我将视口设置为 240x320 并将我的世界设置为 240x320 时,一切都很好。我可以毫无问题地将世界滑出屏幕。但是,当我的视口为 220x320 且我的世界为 240x320时,DDERR_INVALIDPARAMS当表面移动到左侧屏幕之外时,blitting 会失败:

(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)

将表面移到右侧屏幕外可以正常工作,表面被正确裁剪。

当表面大于后备缓冲区时,如何在我的后备缓冲区上剪辑表面?

提前致谢

4

1 回答 1

0

我真的不知道我是否正确(多年未使用 DirectDraw),但我猜它与负剪切矩形有关。所以也许你应该将你的 0/0 设置为最左边/最上面的位置,这样你就不会得到负数。

于 2010-07-02T07:25:25.833 回答