Adventure Game Studio

AGS Support => Modules, Plugins & Tools => Topic started by: SSH on Thu 08/12/2005 16:10:17

Title: MODULE: Sprite fonts v1.20 : multi-coloured text!
Post by: SSH on Thu 08/12/2005 16:10:17
Here we go, no longer are you restricted to printing text in one boring colour at a time. No longer are you restricted to less than 100 printable characters. No longer does text need to be printed horizontally! SSH presents.... the Sprite Font module. Includes 4 free example fonts..

Now updated for AGS 3.0 (and 2.72), but v1.02 still available for the 2.71 release.

Download v1.20 here (http://ssh.me.uk/modules/SpriteFont.zip) (Requires AGS v2.72beta4a or later (includes AGS 3.0))
Documentation (http://ssh.me.uk/moddoc/SpriteFont)


Download v1.02 here (http://ssh.me.uk/modules/SpriteFontForAGS271.zip) (Requires AGS v2.71 only)

Title: Re: MODULE: Sprite fonts v1.01
Post by: SSH on Fri 09/12/2005 11:46:38
There are lots of fonts to use with this module on this site (http://cgi.algonet.se/htbin/cgiwrap?user=guld1&script=fonts.pl)

I have put a few of them into .cha files for import in this download (http://www.lumpcity.co.uk/~ssh/FewMoreFonts.zip)
Title: Re: MODULE: Sprite fonts v1.01
Post by: Joseph DiPerla on Fri 09/12/2005 17:02:39
Wow, I actual like this Module!

Good Job.
Title: Re: MODULE: Sprite fonts v1.02
Post by: SSH on Tue 03/01/2006 13:49:30
I've found an issue if you have a 320x200 game that you set up to run at 640x400, the printing goes awry, so I'll try and fix this at some point..

Edit:

I fixed the bug and uploaded v1.02
Title: Re: MODULE: Sprite fonts v1.02
Post by: on Sat 07/01/2006 21:25:57
Hey this looks really cool! Now i'm gonna upgrade to 2.71.
Title: Re: MODULE: Sprite fonts v1.10
Post by: SSH on Mon 27/02/2006 10:13:17
Now updated for the latest beta. See first post for details.

btw, Aquilo (or anyone else) please let me know when you release any projects with my modules in, as I love to see my stuff being used!
Title: Re: MODULE: Sprite fonts v1.10
Post by: Aquilo on Mon 27/02/2006 23:59:52
Thanks a lot for this important update. When I release my project (which may take up to a year to complete, because I work solo with no team to speed up the process) I'll surely let you (and everyone else ;) )know. You'll be fully credited, of course. It's the stuff worth being used!
(Here follows a sample of the text written using this module, the font itself is custom):
(http://flamberg.front.ru/spritefont.png)
Title: Re: MODULE: Sprite fonts v1.10
Post by: SSH on Tue 28/02/2006 09:17:30
Awesome font, Aquilo. Once you've released your game, I'd really encourage you to share the font with others, but of course that is up to you!
Title: Re: MODULE: Sprite fonts v1.10 (new dl site)
Post by: EnterTheStory (aka tolworthy) on Sun 09/12/2007 10:38:09
Quote from: SSH on Thu 08/12/2005 16:10:17SSH presents.... the Sprite Font plugin.

This looks like exactly what I want! But can someone clarify if this is a module (from the tppic description) or a plugin (from the above quote)? i.e. would it work on Linux? Sorry of this is a newbie question :)
Title: Re: MODULE: Sprite fonts v1.10 (new dl site)
Post by: Scorpiorus on Sun 09/12/2007 11:07:33
This is a script module and as such should work on any platform supported :)
Title: Re: MODULE: Sprite fonts v1.10 (new dl site)
Post by: EnterTheStory (aka tolworthy) on Sun 09/12/2007 11:20:01
Thanks!
Title: Re: MODULE: Sprite fonts v1.10 (new dl site)
Post by: SSH on Sun 09/12/2007 16:34:52
This will need some adaptation to work with AGS 3.0, unless you turn off the force-object-orientation option
Title: Re: MODULE: Sprite fonts v1.10 (new dl site)
Post by: Dualnames on Mon 10/12/2007 18:59:42
How did I miss that?
Title: Re: MODULE: Sprite fonts v1.20 : multi-coloured text!
Post by: SSH on Fri 21/03/2008 14:29:49
However, now you can use the new version and it works with AGS 3.0+ with no modification! Woot!
Title: Re: MODULE: Sprite fonts v1.20 : multi-coloured text!
Post by: Simon the Sorcerer on Tue 25/11/2008 06:57:25
That solved my problem. It wuz an old template(extreeemly old  ;D)
Thanks.

Title: Re: MODULE: Sprite fonts v1.20 : multi-coloured text!
Post by: Jakerpot on Thu 08/01/2009 17:01:53
nice work! but i dont get wow it works, its the new function no? Ok, so i will use an example:
Display("This is so cool! I gained a Super Bannana!") i wanted to change the Supper Bannana to red. How can i apply the module to it? Thanks.
Title: Re: MODULE: Sprite fonts v1.20 : multi-coloured text!
Post by: monkey0506 on Fri 09/01/2009 13:19:54
[EDIT:] Actually I was just reading over your post, and I think what you're looking for is the Hypertext module (http://ssh.me.uk/moddoc/Hypertext.zip). That should allow you to change the font in the middle of the String...

***********************************

The first post links to the module's documentation (http://ssh.me.uk/moddoc/SpriteFont). Without actually perusing the code, I'd say that it's not directly possible to create a Display-style box, unless you're using "Always display text as speech" in which case you could do something like this:

// script header
import Overlay* SaySprite(this Character*, String message, bool transparent=true);
import SpriteFont SpriteSpeechFont;

// script body

SpriteFont SpriteSpeechFont;
// ...load sprites into speech font...

void SaySprite(this Character*, String message, bool transparent) {
  DynamicSprite *sprite = SpriteSpeechFont.TextOnSprite(message);
  int width = sprite.Width;
  int height = sprite.Height;
  int x = this.x - (width / 2);
  if ((x + width) > System.ViewportWidth) x = (System.ViewportWidth - width);
  if (x < 0) x = 0;
  ViewFrame *frame = Game.GetViewFrame(this.View, this.Loop, this.Frame);
  int y = (this.y - (((Game.SpriteHeight[frame.Graphic] * this.Scaling) / 100) + height + 2)) - 6;
  if ((y < 0) || ((y + height) > System.ViewportHeight)) y = (System.ViewportHeight - height);
  return Overlay.CreateGraphical(x, y, sprite.Graphic, transparent);
}

// and finally...in any script
player.SaySprite("This is some text in a sprite font displayed over my head.");


Note that this method does *NOT* provide speech animation...for that you'd have to keep track of which character was speaking, how long the text should be displayed, how long the text has already been displayed...if you ask nicely I'm sure you could convince SSH to include a proper speech function into the module code...
Title: Re: MODULE: Sprite fonts v1.20 : multi-coloured text!
Post by: SSH on Wed 14/01/2009 11:52:55
Thanks for replying, yes, I think the Hypertext module would do the trick.
Title: Re: MODULE: Sprite fonts v1.20 : multi-coloured text!
Post by: StillInThe90s on Sat 01/05/2010 19:17:19
Hi people! Is anyone still using this module?
Anyway, I gave it a go, but could not make it work.
Is there a step-by-step tutorial or an open source code around?
Title: Re: MODULE: Sprite fonts v1.20 : multi-coloured text!
Post by: SSH on Sun 02/05/2010 00:59:56
I'll try and have a loook at making this work under 3.2 when I have a chance.
Title: Re: MODULE: Sprite fonts v1.20 : multi-coloured text!
Post by: StillInThe90s on Sun 02/05/2010 17:51:34
Are you sure this version is not working already?
I could not really tell, see.
Title: Sprite Fonts module update?
Post by: StillInThe90s on Wed 27/04/2011 01:39:34
Anyone knows if ther ever was an update of the sprite fonts -module, compatible with ags 3.2.1?
Thanks.



Not sure where to post this but I guess the good community mods can move this if necessary.
I would have posted in the module topic, but last time I posted in an old thread I got fish in the mail.
Title: Re: MODULE: Sprite fonts v1.20 : multi-coloured text!
Post by: Gilbert on Wed 27/04/2011 02:28:41
Post merged.

It's actually more appropriate to post in the module's own thread than starting a new one in the Technical forum. If you feel it's not right to necro an old thread (which is the case here) you may drop a PM to the author of the module instead.
Title: Re: MODULE: Sprite fonts v1.20 : multi-coloured text!
Post by: abstauber on Wed 27/04/2011 06:45:42
I'm using it for ages and it still works in 3.2.1. Although I'm not sure if I had to adjust a few things.
Title: Re: MODULE: Sprite fonts v1.20 : multi-coloured text!
Post by: StillInThe90s on Wed 27/04/2011 15:18:52
I think I found one of the problems.
The script uses "GetGameParameter" which does not work anymore. Problem is, I don't know how to translate this to "Game.SpriteHeight" and so on, since the manual assumes that I am working with room objects.

Ex:    int height=GetGameParameter(GP_SPRITEHEIGHT, spr, 0, 0);
and:  this.SetFontSprite(firstchar+i, GetGameParameter(GP_FRAMEIMAGE, v, loop, frame));

Ideas?
Title: Re: MODULE: Sprite fonts v1.20 : multi-coloured text!
Post by: Khris on Wed 27/04/2011 16:04:27
1)
  int height = Game.SpriteHeight[spr];

2)
  ViewFrame*vf = Game.GetViewFrame(v, loop, frame);
  this.SetFontSprite(firstchar + i, vf.Graphic);


Didn't test it though.

I believe you can make old commands work again by changing a setting in General settings; replacing them with the current ones is better practice though.
Title: Re: MODULE: Sprite fonts v1.20 : multi-coloured text!
Post by: abstauber on Wed 27/04/2011 16:45:57
In case you don't want to make these edits, here's mine:
http://shatten.sonores.de/wp-content/uploads/2011/04/SpriteFont.zip

Of course Khris' edits are working too :)
Title: Re: MODULE: Sprite fonts v1.20 : multi-coloured text!
Post by: StillInThe90s on Wed 27/04/2011 19:01:49
Hat of to you lads.
However, my scripting skills are not what they ought to be. I still can't get it running, only now it is a question of incompetence. How do I call the mod functions from the global script? I. e. how do I swap from ordinary font to sprite font? Using SSH:s included *.cha seemed easy enough, but no. I have searched the wiki and gone through the doc.
Title: Re: MODULE: Sprite fonts v1.20 : multi-coloured text!
Post by: Khris on Wed 27/04/2011 20:19:48
To be clear, you can't use this font as native speech font or something to that effect, you can only draw it to the background, a DynamicSprite or an Overlay.

So if you want your characters to talk using the sprite font you have to script a replacement for the Character.Say function and use only that.
Title: Re: MODULE: Sprite fonts v1.20 : multi-coloured text!
Post by: Calin Leafshade on Wed 27/04/2011 20:50:31
There is an option in the plugin interface to replace the font renderer.. Someone should make a sprite font renderer for it, that would be nice.
Title: Re: MODULE: Sprite fonts v1.20 : multi-coloured text!
Post by: StillInThe90s on Wed 27/04/2011 23:12:13
Quote from: Khris on Wed 27/04/2011 20:19:48
To be clear, you can't use this font as native speech font or something to that effect, you can only draw it to the background, a DynamicSprite or an Overlay.

So if you want your characters to talk using the sprite font you have to script a replacement for the Character.Say function and use only that.

So this mod is actually no more than a fancy way of showing overlays. Which makes it useless to me if I don't want to rework all of my dialogues...?
Maybe for next project then.
Title: Re: MODULE: Sprite fonts v1.20 : multi-coloured text!
Post by: SSH on Thu 28/04/2011 02:28:16
Find and Replace is your friend. It doesn't take much to create a character.SprSay function. But certainly it won't work with dialog scripts. I like Calin's suggestion, though. Sprint font rendering is pretty simple.

It would probably be better to have another way to import a set of sprites as a script-identifiable group than just using .cha files, though.

I'm pretty sure I did upgrade the module myself at one point, I'll have a look to find it, but no promises!