I've spent some time adding two variables 'float scalex' and 'float scaley' throughout my game, and have successfully made it so I can transform all my bitmaps and animations sizes simply by adjusting just these two variables, and it's working great so far, although I still haven’t dealt with adjusting the size of the fonts yet. I've had to use: scaled, scaled_rotated, and tinted_scaled_rotated to get this done.
I've found various threads discussing this topic, but I'm still hoping to find out more. The Wiki link below states which is the preferred method for primitives and bitmaps, but I was just hoping someone could explain exactly why they are the preferred methods.
Moving on, as a test I decided to set my scalex and scaley to 1.0 so they make no difference, and use just the following few lines from the Wiki (https://wiki.allegro.cc/index.php?title=Achieving_Resolution_Independence) to see how it compares. The result is the same as when using my variables.
Question 1) Is there any reason for me to use stretching now I've discovered scale transforming seems to achieve the same visual result. Apart from the fact that my variables are already in place
Question 2) What's the best way to change the size of the fonts. I suppose I could draw the fonts onto a bitmap and scale the bitmap, allow them to be transformed by the scale_transform above, or select a different font size. Any advise would be great.
I personally never understood why that person wrote one way is better for bitmaps and another for primitives.
One thing this person seriously omitted is that when you use the stretched bitmap method instead of scaling, you create and draw a buffer, thus creating triple buffering (graphics are already double buffered). That in itself takes a decent chunk of extra vram. In addition, the graphics card has to draw all those extra pixels to draw the bitmap. This can in some cases bring you closer to your fill limit. When you hit that, the framerate drops a lot.
All this to say that I much prefer a scale transformation. The graphics card is happy to multiply by your scale because it already was doing that anyways. So in theory, the only cost of scaling should be transforming your scale request into a matrix the graphics card can use to multiply all the coordinates by.
Thus, I would think scaling using transformations would be faster and better.
The way I deal with fonts is by loading them all in at once:
I load font sizes 6 to 60, then I have a base font size, and I scale that by the current resolution to get what I want, but I consider other factors like aspect ratio.
The way Allegro5 works is it does not do on-the-fly vector font rendering. It caches the letters (glyphs) into big bitmaps. So Adding more fonts will just cost you more vram.
You can of-course use a big font and scale it, I'm sure that works too, but fonts tend to render differently at smaller sizes to make it more readable. Things like thickness and stuff change. That's why I prefer to use the fonts rather than scale a big one, but it depends on your needs.
BTW, I think it would be okay to say that if you scale EVERYTHING to fit the resizable display, it makes sense that the best way is to use a scale tranformation.
This is what the gfx card ALREADY does in any case so basically it costs nothing in terms of GPU computation.
The "scaled" "tinted" "rotated" version of the draw routines exist for the purpose of being handy ways to transform single objects, but not to apply GLOBAL tranformations.
For that, allegro transforms and blending modes are the way to go I guess.
I personally never understood why that person wrote one way is better for bitmaps and another for primitives.
I wrote that in 2012 due to misinformation in this very forum. It's a wiki. You know what to do.
Thank you both that's exactly the information I was looking for
It's so incredibly helpful receiving advice like this.
Honestly you've answered my questions so well I can't think of any else to say except thank you very much indeed
And that, using transformations is making everything so much easier than rewriting every draw() call
I am using a separate bitmap for a large part of the graphics, but I've still got various other draw() calls.