New games every week!
JSE - Scaling
11th April 2021  
Yesterday I spent most of the day battling with Scales.
I added my first "sprite" to the JSE engine, and things went downhill from there!


The scaling method I was using (The one in both Shoebox and Browsercade) is completely wrong!!

It's not noticeable for everything that those games do, but the second you try to combine sprites and shapes, things become noticeably broken.
The simple task of "Draw a sprite which is a cross shape, and then fit a rectangle directly in the middle of the cross" was NOT working.
At all!
And resizing the window, changing the resolution, etc, were all giving different incorrect results.
It was a complete and total mess.

So, rather than working on an editor for the sprite, I ended up having to faff about with the scaling functions.

The tests in the image above are..
1. Do the shapes and sprites scale correctly. They do, now! Hurray!
2. Does everything work like it oughta. No. The squares on the left are not rotating in the middle example.
3. Does the AntiAlias toggle work. Yes. The red and yellow sprites are indeed horrifically antialiased in the middle and bottom examples.

Todo List
1. Get those shapes rotating.
2. The font, as good as it appears to be working, isn't quite scaling correctly. This is most noticeable when lots of text is near each other, and it all ends up overlapping at different scaling sizes.
3. ... And then I need to make the sprite editor, which was the thing I intended to start on, yesterday, but .. obviously that never happened!!

Right then.. That's a task.
Hop to it, Jay!

.. incidentally, as much as I'd like to "simply" dump the new code back into Shoebox and Browsercade, doing that will likely break both a whole bunch of games, which I've coded to avoid such scaling issues.
This might cause an issue later down the line, if I decide to integrate the Scripting Engine into Browsercade for the sake of doing minigames.
.. .. bugger..

Views 52, Upvotes 1
Daily Blog , Jse
New games every week!
Site credits : Jayenkai put all his heart and soul into everything you can see on this site.
(c) Jayenkai 2017 and onwards, site design Rychan. RSS feed
Blog - JSE - Scaling - AGameAWeek