Cohesion turns into normal mode if the window becomes too small

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent f717f7ef09
commit 28b9726178
  1. BIN
      C++ProjectTemplate
  2. BIN
      C++ProjectTemplate.data
  3. 2
      C++ProjectTemplate.js
  4. BIN
      C++ProjectTemplate.wasm
  5. 3
      pixelGameEngine.h

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

After

Width:  |  Height:  |  Size: 2.0 MiB

File diff suppressed because one or more lines are too long

Binary file not shown.

@ -3357,11 +3357,13 @@ namespace olc
int bh = vScreenSize.y*vPixelSize.y/baseFactor;
int32_t xmult = vWindowSize.x / bw;
if (xmult==0) goto nonPixelCohesion;
vViewSize.x = (vWindowSize.x / bw) * bw;
vViewSize.y = bh*xmult;
vScreenPixelSize = vPixelSize*xmult/baseFactor;
if (vWindowSize.x / bw > vWindowSize.y / bh) {
int32_t ymult = vWindowSize.y / bh;
if (ymult==0) goto nonPixelCohesion;
vViewSize.y = (vWindowSize.y / bh) * bh;
vViewSize.x = bw*ymult;
vScreenPixelSize = vPixelSize*ymult/baseFactor;
@ -3369,6 +3371,7 @@ namespace olc
}
else
{
nonPixelCohesion:
vViewSize.x = (int32_t)vWindowSize.x;
vViewSize.y = (int32_t)((float)vViewSize.x / wasp);

Loading…
Cancel
Save