Stay Down Dev Log - Part 10 - Fit Canvas To Window

3 years ago
19

Hey, everybody! If you are looking for a tutorial on how to make your game's display canvas scale to fit the window without breaking its aspect ratio you have come to the right place. In addition to lots of code refactoring I'll be adding this functionality to my 2D game project. I'm using HTML5 and JS, but you could use the same logic in any application to make one rectangle scale to fit inside another.

What you'll see in this video:

00:00:45 - Refactoring the global object
00:03:45 - Refactoring the Game States
00:19:00 - Resizing the display canvas
00:24:00 - Testing it out

Thanks for watching! Check out the site! https://pothonprogramming.github.io

Loading comments...