3
\$\begingroup\$

I'm testing my game using Firefox, and it's slow whenever it's in fullscreen. If I resize the browser to take up half the screen, it'll scale the image down and run fine. Game also runs fine in Chrome in full screen. I'm using a laptop with an i7 4000HD series CPU..

The window size shouldn't make a difference, as I have set the canvas size to have a size of 672 by 312 pixels, and then I stretch the width to 100% and height to auto in CSS.

<canvas id="background" width="672" height="312">
</canvas>
<canvas id="ground" width="672" height="312">
</canvas>
<canvas id="dirt" width="672" height="312">
</canvas>
<canvas id="actors" width="672" height="312" tabindex="1">
</canvas>
<canvas id="outermaze" width="672" height="312">
</canvas>
<canvas id="scorelayer" width="672" height="312">
</canvas>
<canvas id="foreground" width="672" height="312">
</canvas>

canvas {
    position: absolute;
    top:0;
    bottom: 0;
    left: 0;
    right: 0;
    margin:auto;
    width: 100%;
    height: auto;
    background: transparent;
    z-index: -4;
}

The game can be played at www.thestevester.com/pacmental/index.html

Is the way I'm stretching the canvas to fullscreen causing performance issues?

What's even goofier is that when I set the resolution of Windows from 1440p to 1080p, it runs fine...

\$\endgroup\$

closed as off-topic by 200_success Sep 24 '16 at 3:43

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must include the code to be reviewed. Links to code hosted on third-party sites are permissible, but the most relevant excerpts must be embedded in the question itself." – 200_success
If this question can be reworded to fit the rules in the help center, please edit the question.

  • \$\begingroup\$ I showed the relevant code for the question I asked... \$\endgroup\$ – Steven Day Sep 24 '16 at 4:13
  • 1
    \$\begingroup\$ Game is great. :)) What's the programming language underneath? C++ ? \$\endgroup\$ – michael.zech Sep 25 '16 at 9:28
  • \$\begingroup\$ thanks! it's javascript... based on the Shaun Williams version... \$\endgroup\$ – Steven Day Sep 25 '16 at 16:03
  • 1
    \$\begingroup\$ Crazy stuff. It runs absolutely fast and smoothly. Never expected this done in a high level, interpreted language. Anyway: Congrats. \$\endgroup\$ – michael.zech Sep 26 '16 at 7:09
  • \$\begingroup\$ Awesome! Thank you! It's a testament to both MODERN PROCESSING and Shaun Williams's excellence in programming! I didn't know you could make a web game with C++.... \$\endgroup\$ – Steven Day Sep 26 '16 at 18:55

Browse other questions tagged or ask your own question.