Hello Guest

Author Topic: Mixing sprites with text meshes  (Read 3252 times)

thlypsis

  • Newbie
  • *
  • Posts: 2
    • View Profile
Mixing sprites with text meshes
« on: March 18, 2013, 06:57:02 pm »
Hello.  I'm semi-new with 2D Toolkit and was hoping for some help.  I am planning to have a battle results screen with a list of rewards, and I'd like to have images mixed in with text meshes.  For example:

Experience get: <experience icon> 200
Gold get: <gold icon> 23
Item get: <steel sword image> Steel sword

Is there an easy way to do this?  Thanks in advance!

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Mixing sprites with text meshes
« Reply #1 on: March 18, 2013, 10:42:59 pm »
The absolute easiest way to do this is to do it in the font.
Once you export your bmfont, add these icons to the font texture in Photoshop / image editor of your choice.
Edit the bmfont text/xml file and add characters for these sprites, and manually enter the x, y, width & height corrdinates.

That way you will just be able to type the characters.

To make things simpler, you can make your exported texture from bmfont big with a lot of empty space at the bottom and insert your icons in the second half always. If you import the font into a sprite collection, any wasted space introduced from your padding will be removed.

It is a bit painful initially, but ultimately will be really simple to use.