使用 Allegro 更改位图传输的亮度
我正在使用 Allegro 游戏库制作瓷砖游戏。我希望瓷砖变得更加明亮。不幸的是 Allegro 没有“增亮”功能。然后我决定做的是将一个图块传输到缓冲区,然后对于它刚刚为该图块传输的每个像素,我增加了它们的 RGB 值并放置像素。最大的问题是它严重降低了我的帧速率,因为它做了两倍的工作。有什么方法可以实现这一点,而无需为每个图块提供稍微更亮的图块位图(这将是荒谬的)。谢谢
I'm using the Allegro game library to make a tile game. I want the tiles to get exponentially brighter. Unfortunately Allegro does not have a "Brighten" feature. What I then decided to do, was blit a tile to the buffer, then for each pixel that it just blited for that tile, I increased their rgb values and putpixel. The big problem with this is it severely decreased my framerate since it does twice as much work. Is there any way I can achieve this without having a tile bitmap for each tile that is slightly brighter (which would be ridiculous). Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用:
draw_lit_sprite
它的作用是获取 BITMAP并使用之前必须使用此函数设置的“光”进行绘制:
set_trans_blender
所以基本上,你要做的是:
希望它有帮助:)
You can use:
draw_lit_sprite
what it does is take a BITMAP and draw it using a "light" that you have to set before by using this function:
set_trans_blender
so basically, what you have to do is:
hope it helps :)
调色板可能是这样的: http://alleg.sourceforge.net/stabledocs/en /alleg011.html
我对 Allegro 不太了解,但我知道在旧的 8 位游戏中,淡入淡出通常是通过更改渲染时显卡读取的颜色表来完成的,因此给出一种同时更新屏幕上许多像素的恒定时间方式。
希望有帮助:)
It might be possible with palettes: http://alleg.sourceforge.net/stabledocs/en/alleg011.html
I don't know much about Allegro, but I know that in the 8-bit games of old, fading is usually accomplished by altering the color table that the video card reads from when rendering, hence giving a constant-time way to update many pixels on the screen simultaneously.
Hope that helps :)