New games every week!
JSE - Maths! Blog
31st July 2021
My scaling's off again!

-=-=-

If you remember back in the early days of JSE, I struggled to get Symbols, Rects and Texts all the same scale, so that a FontSize 32 matches a 32 Rect and Scale 1 (32x32) Symbol.
Took AGES to get it working right, but eventually everything fell into place, albeit with a TON of scaling maths involved.

Well, all that came flooding back, yesterday, as work progressed on the "Draw Buffer".
(Please note : None of the following is uploaded yet, so when I say "you can..." .. you actually can't, because it's not there yet!!)



"SetBuffer BG" is the chosen command for doing this, with "SetBuffer FG" setting things back to the normal screen drawing.
You can then use the regular drawing commands on the BG buffer, just like you would the FG, and then once you're back to the FG buffer, either DrawBG or TileBG, just like you do with the Tilemap.

Issue 1 : Should the BG draw from the centre like symbols and text does, or should it draw from the top left like the Tilemap does?
Hmmm..

Issue 2 : Co-ordinates are wonky as hell!

The BG buffer is ALWAYS 1024x1024 pixels, whilst the screen is whatever you set it in the Graphics command, so in the following example (which won't work yet on your version, but does at least work!) the rect, text and symbol are at least the correct size (and BOY, did that take some effort to get working)
The issue now is that, exactly like the Tilemap is, the drawing of the BG is completely off from where you're drawing the actual sprites on top.
The two will be quite difficult to get to interact with each other.

I need to think this through properly before making it live, mostly because if I don't, then future tweaks will break other people's code.
.. I might also tweak the way the Tilemap function works, to make the two line up correctly.
I'm not sure, yet, what way will be best to do things.
Hmmm...

Oh, and although SetScale, Rotation, Alpha, etc does indeed work with the DrawBG command, they break quite a bit with the TileBG one!
.. Oh, and that stupid gap is showing up again!! Grrr..

Symbol 0,"0__I_J!IIJK.JIIJKHHKJIIJKHHKJIIJK.JIIJ!I_"; AA False Graphics 512,512,1 SetBuffer BG:ResetDraw DrawImg 512-32,480,0 Rect 512+32,480,32,32,1 Text 512,512,"Hello : Printed to BG",1 SetBuffer FG:ResetDraw DrawBG 256,200 Text 256,256,"Hello : Printed to FG",1 DrawImg 256-32,290,0 Rect 256+32,290,32,32,1

Views 68, Upvotes 10  
Daily Blog , Jse
New games every week!
Site credits : PHP script, Blog posts, Games, Music, Pixelart, Poems and More : Jayenkai
(c) Jayenkai 2023 and onwards, RSS feed

Blog - JSE - Maths! - AGameAWeek