SDL -(硬件)像素缩放

发布于 2024-09-24 23:12:59 字数 253 浏览 1 评论 0原文

在我的 SDL 游戏中,出于游戏玩法和性能方面的原因,我希望保留游戏区域的固定分辨率。

我想要做的是拥有一个小分辨率(例如 320 * 240),并且在调整窗口大小/切换到全屏模式时让 SDL/显卡缩放每个像素。

然而,出现的问题是:

  • 渲染的图片变得“模糊”
  • 实际绘图区域小于屏幕,顶部、左下和右下有黑色区域

我该如何解决这个问题?

我之前已经在其他游戏中见过这个作品

In my SDL game, I'd like to retain a fixed resolution of the game area, both for gameplay and performance reasons.

What I wanted to do was to have a small resolution (e.g. 320 * 240), and when resizing the window / switching to fullscreen mode letting SDL / the graphics card scale each pixel.

However the problems that occur are:

  • The rendered picture gets 'blurry'
  • The actual drawing area is smaller than the screen, there are black regions on top, bottom left and right

What can I do to solve this?

I have already seen this work in other games before

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

红焚 2024-10-01 23:12:59

使用 SDL 拉伸函数 拉伸 blit 您的表面,或将您的表面每帧上传到 OpenGL 纹理并渲染一个适当大小的四边形。

Use Stretch Functions For SDL to stretch-blit your surface, or upload your surface to an OpenGL texture each frame and render an appropriately-sized quad.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文