Spritefont plugin (new)

Discussion and feedback on Construct 2

Post » Tue Aug 06, 2013 9:58 am

This is a spritefont plugin I roughly wrote up for a project my company is working on and now it is working as needed so I would like to share it and if anyone has any comment on the coding that I can improve on could feel free to let me know and I can improve it (Especially the rendering part).

Here is the sample https://www.dropbox.com/s/ki4gz37nl5s7mx3/spritefont.capx.
Here is the plugin https://www.dropbox.com/s/2i7tjhxf5g59a7a/EPICreationZ_Spritefont.zip

Preparation of image:
To start, you have to export the fonts with mono spacing as shown in the capx, sprite object "FontSheet".
Afterwhich, create the spritefont plugin "EPICreationZ_Spritefont".
In the "EPICreationZ_Spritefont" image editor, import as spritesheet. Find the fontsheet you have exported earlier and load into the editor.
Delete all the empty frames.
Go to the 1st frame (Which normally will be alphabet "A") and set the origin imagepoint to the base of the letter (Not the base of the image box).
Apply the origin imagepoint to all animation frames.
Crop all animation frame.

*For spacing, create a new frame and set the width to the spacing width you want.
**Origin imagepoint X is not taken into account for calculation of placement.
***Only the 1st animation will be used. So even if you create another animation, it will not be loaded.

Plugin properties:
Text: The text to show.
Character set: The characters as in the animation frames. (If any of the frames is missing, it will cause error.)
Scale: The size of the characters.
Word wrap: Wrapping of words by word or character.
Line height: The height in pixels of each line. (Normally if the origin imagepoint is set to the base, I would set line height to the height of alphabet "A")
Vertical Spacing: The amount of space in pixel in between the lines.
Horizontal Spacing: The amount of space in pixel between the characters.
Horizontal Alignment: Horizontal align to Left,Center or Right.
Vertical Alignment: Vertical align to Top or Center.
*Color: Ignore this properties, leave it as White. (Used as a quick fix for my company project)
Linear Sampling: Linear or point sampling.
Hotspot: The origin of the font box.
Debug: To show a red box if set to true.c4sp3r892013-08-06 10:45:58
B
17
S
8
G
4
Posts: 93
Reputation: 3,190

Post » Tue Aug 06, 2013 5:58 pm

Did you notice we now ship a built-in sprite font plugin in the latest Construct 2 release?
Scirra Founder
B
400
S
236
G
89
Posts: 24,546
Reputation: 195,471

Post » Wed Aug 07, 2013 3:00 am

I noticed. But because my previous project was using this plugin before the official spritefont came out. So if I was to change to the official spritefont, it would be quite alot to change. So was wondering if the WebGL rendering for my spritefont is done correctly.c4sp3r892013-08-07 03:01:50
B
17
S
8
G
4
Posts: 93
Reputation: 3,190

Post » Thu Aug 08, 2013 4:36 pm

Better use the official one, since you'll get more support in the long run.
B
18
S
5
G
4
Posts: 568
Reputation: 5,079


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 12 guests