Ancurio / mkxp

Free Software implementation of the Ruby Game Scripting System (RGSS)
GNU General Public License v2.0
509 stars 128 forks source link

Window content won't draw outside of a 640x480 region #248

Closed Speak2Erase closed 2 years ago

Speak2Erase commented 2 years ago

image

This is using potentially unintended behavior. Graphics.cpp line 929 and 930 have been changed so the window can be resized to any resolution. Here's a small test case I came up with:

Graphics.resize_screen(960, 540)
window = Window.new
window.x, window.y, window.width, window.height = 0, 0, 960, 540
skin = Bitmap.new(192, 128)
skin.fill_rect(Rect.new(0, 0, 192, 128), Color.new(255, 0, 0))
window.windowskin = skin
window.contents = Bitmap.new(window.width, window.height)
window.contents.fill_rect(Rect.new(0, 0, 960, 540), Color.new(0, 255, 0))

loop do
  Graphics.update
  Input.update
  window.update
end

This should look like this: image

If by some miracle it does not, well, I'm an idiot and I screwed something up in one of my mkxp forks.

GamingLiamStudios commented 2 years ago

I believe this might be the cause. It is used in GraphicsPrivate to allocate the usable graphics area.

Speak2Erase commented 2 years ago

Changing line 945 of graphics.cpp to glState.scissorBox.init(IntRect(0, 0, width, height)); fixes the issue. It's probably not the right solution, but it works.