[Plugin] Spritefont (28th August 2012)

Post your completed addons to share with the community

Post » Mon May 14, 2012 6:16 pm

I seem to have a problem with the spritefont objects disappearing when revisiting layouts. Mostly it just seems to happen when the spritefont object in question is scaling.

I have some menus set up where if the mouse is highlighting an option, the text will scale up a little bit to show it's selected, and when the mouse no longer hovers above it it shrinks back down to normal. This works fine on a layout the first time, but if I leave the layout and then come back to it, upon scaling the spritefont disappears. Not sure what is causing that. It only seems to do it when revisiting a layout, not on new layouts. Very... weird.
B
58
S
20
G
7
Posts: 305
Reputation: 8,804

Post » Mon May 14, 2012 8:10 pm

Hm, couldn't reproduce the issue. I made it so the spritefont was scaled on mouseover and so I could change layouts on Enter... kept going back and forth, with or without scaling. Didn't disappear at all.
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Tue May 15, 2012 5:58 am

Hmm... I also had anchor behavior applied, and once I removed the anchor behavior from the spritefont it seemed to fix the issue. Kinda weird. I don't know if you can reproduce that, or if it's even worth looking into whether there's an incompatibility with Anchor or not.
B
58
S
20
G
7
Posts: 305
Reputation: 8,804

Post » Tue May 15, 2012 11:22 am

Hm, SpriteFont object behavior is kind of erratic with Anchor behavior enabled. Could be because SpriteFont works out its own positioning and scaling for each glyph. I'm not sure how Anchor works, but it tries to force reposition or rescale the object, which can cause unforeseen consequences.

However I didn't encounter any disappearances, just jarring and wonkiness. Eh, all the same.

Guess I'll need to rewrite SpriteFont in the future, to better work with new exporters. I'll change the way it works positioning and scaling out then.
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Sat Jul 21, 2012 6:49 am

Is there a way to load the image used for spritefont at runtime?

I'm working on a game and I would love to switch the fonts from level to level (not really the font, but the color and style). Since there is no frames in Spritefont, is there a way to load in a new png in the event sheet?

Thanks for this amazing plugin. Really great.
B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Post » Sat Jul 21, 2012 11:06 am

@ArcadEd:
I'm not really sure how to go about loading images at will in Construct 2. I've been considering a rewrite of the plugin, so that is on the table.

But until I figure out things like image swapping at runtime, it'll have to wait. Can't give any timetable, sorry.
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Sat Jul 21, 2012 3:33 pm

That's ok. It would also work if you could load in frames of animations like you currently can with sprites, then just call the different frames. I don't know if that is possible either :).

Thanks.
B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Post » Mon Jul 23, 2012 1:17 am

This currently doesn't work with CocoonJS. Just wanted to mention it. I think this is a very powerful plugin as it allows us to create our own fonts to make the games look good, without the need to include fonts/css file and hope the browser they are playing on supports it.


By doesn't work, I mean the text doesn't show up when testing with the CocoonJS launcher on my phone. Just see blank white boxes.ArcadEd2012-07-23 01:18:33
B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Post » Mon Jul 23, 2012 2:55 am

Sprite based fonts is the best option for fonts imo. Don't like Web Fonts at all due to several reasons. Don't think mixing web rendering in a game is a good idea since things can and probably will appear and even behave differently from implementation to implementation. Sprite fonts is the way to go. Proof of this is that pretty much every engine uses them even other HTML5 ones. The problem is the generating of the font sheet. It could be generated by C2 itself or by an external tool like Glyph Designer on Mac, BMFont on Windows etc.
So best wishes for this plugin :DKiyoshi2012-07-23 03:00:26
B
58
S
13
G
10
Posts: 632
Reputation: 12,505

Post » Mon Jul 23, 2012 10:55 am

@ArcadEd: I am aware of the issue, but I'm not sure what is causing it. Another reason for the plugin rewrite, as it's been a while since I've touched the code. I already have a few ideas how to refactor it for usage, performance and compatibility.

@Kiyoshi: That was a reason I got down to make Spritefont. It may not be the most elegant to handle, but at least it works, so I don't have to pull my hair with web fonts anymore!

If only I could figure out why it won't play nice with CocoonJS... Some archaic black magic they didn't add support for, perhaps?
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 4 guests