New games every week!
Daily Blog Blog
22nd November 2017
I spent FAR too long working on a Triangle, yesterday.

-=-=-

I usually do an equilateral triangle like so.

Point A = Sin/Cos(Rotation)*size
Point B = Sin/Cos(Rotation+120)*size
Point C = Sin/Cos(Rotation+240)*size

But once I added rotation, it was obvious that that doesn't actually centre the triangle correctly.
If you draw a circle and triangle from the same spot, you end up with the triangle's tip touching the circle's edge, but the base of the triangle not reaching the other side.

Sure, all three points touch the edge of the circle like you'd expect, because all three points are part of the same rotational circle, but it certainly doesn't look right if you're expecting the circle/triangle combo to resemble a Play button.



Or maybe I'm being too fussy!?
Technically it's right, it just doesn't look right to me.
Grrr!

I spent a lot of time, yesterday, working through this oddity. Should the triangle be offset? Should that be a permanent tweak for all triangles? Should I allow you to decide exactly how the triangle should be rendered?

All in all, adding a Triangle function turned out to be one of the fussiest things I've added to the framework so far, and it's far and away one of the most oddly complicated things that I've tackled.

Along with that, bits of the Font rendering needed tweaking to fix the colon display, so they didn't blend into other characters. I needed to juggle a bunch of numbers, and even tweak the bitmap font by hand, to get it working in a way that looked right. It's going to be hard switching to other fonts, in future!

So, all in all, an alarmingly full day of tweaks that I wasn't expecting to do.

The Triangle/Circle issue cropped up, by the way, because I was trying to make a simple Start button for the menu!
That's about as far into Menu work as I managed to get, before getting sidetracked by something that really shouldn't have been an issue!
Views 66, Upvotes 5  
Daily Blog
New games every week!
Site credits : Jayenkai put all his heart and soul into everything you can see on this site.
(c) Jayenkai 2023 and onwards, RSS feed

Blog - Daily Blog - AGameAWeek