Laserbrain Studios

Games Forum Blog Contact

Author Topic: Scrolling with the mouse issue  (Read 146 times)

Gabu

  • Newbie
  • *
  • Posts: 22
    • View Profile
    • My Website
Scrolling with the mouse issue
« on: June 27, 2018, 03:07:51 AM »
I had an issue were i was scrolling the mouse wheel and the screen split. When i exited  the game the issue didn't reoccur. I know i was messing around in the hospital going up and down the floors. I was playing full screen (1920 by 1080).

Christian Knudsen

  • Administrator
  • Ace
  • *****
  • Posts: 3064
    • View Profile
Re: Scrolling with the mouse issue
« Reply #1 on: June 27, 2018, 08:16:05 AM »
Yeah, I've seen this occur in a YouTube video of the game, and GLI here on the forums just reported it as well. I think I know what the issue is. Thanks for reporting it! :D

Christian Knudsen

  • Administrator
  • Ace
  • *****
  • Posts: 3064
    • View Profile
Re: Scrolling with the mouse issue
« Reply #2 on: July 21, 2018, 08:54:24 PM »
I've been able to replicate this. Now to figure out a fix...

Christian Knudsen

  • Administrator
  • Ace
  • *****
  • Posts: 3064
    • View Profile
Re: Scrolling with the mouse issue
« Reply #3 on: July 22, 2018, 01:16:18 PM »
Fixed!

Zooming works by drawing the game world to an offscreen buffer (like a screen that isn't actually shown). I can then draw that offscreen buffer to the screen and scale it up or down depending on if the game world is zoomed in or out. When zoomed out, the offscreen buffer has to be bigger than the actual game resolution, since the offscreen buffer is scaled down when drawn to the screen to give the illusion of being zoomed out. I have to calculate how big the resolution of the offscreen buffer has to be to support the max zoomed out level. To calculate this, I just multiply the game resolution with the max zoomed out level. So, for example, if the game resolution is 1920x1080 and the max zoom out is 150% (i.e. showing 1,5 times as much of the game world), the offscreen buffer has to be at least 2880x1620.

BUT... when calculating the size of the offscreen buffer, I wasn't using the base game resolution -- I was using the resolution with the zoom level already applied. And when you fire up the game on a machine with a resolution width > 1280, the game automatically zooms in a bit so everything doesn't seem tiny and unreadable. But this meant that when calculating the size of the offscreen buffer, I wasn't basing it on the actual game resolution, but the zoomed-in, smaller resolution. This meant that the offscreen buffer was too small, which is why there would be these odd borders of repeating graphics, as the offscreen buffer wouldn't cover the full screen.