2 Attachment(s)
Text blitter using the Surface Object
This widget uses Looki's Surface object (currently still in beta, use with caution!) to draw a custom bitmap font to the screen. Just like Text Blitter, except with variable width font and alpha channel support.
Surface Object: http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=189477#Post1894 77
Re: Text blitter using the Surface Object
Wow really cool! Thanks for this!
Can we get some instructions for creating the characters image? I'm probably just stupid, but I can't seem to get it to work :(
2 Attachment(s)
Re: Text blitter using the Surface Object
I made a new version. In this version you don't have to keep the alpha channel image in a seperate image. The widget will split the alpha channel automatically instead of you have to doing it manually.
Quote:
Can we get some instructions for creating the characters image? I'm probably just stupid, but I can't seem to get it to work
Well you just have to create letters and place them in a grid. If you want to generate a bitmap font from an existing font, I suggest you use the Text Blitter object.
If you want to use variable width font, you'll also have to take some time writing down the widths of every letter.
Re: Text blitter using the Surface Object
This is fantastic! I would no doubt use it were I starting a project!
Re: Text blitter using the Surface Object
Re: Text blitter using the Surface Object
Nice use of the Surface Object. :)
Re: Text blitter using the Surface Object
Re: Text blitter using the Surface Object
Complex but powerful, big thanks for that!
2 Attachment(s)
Re: Text blitter using the Surface Object
Sorry for bumping this. But since I'm uploading some files anyway, I'd like to update this widget while I'm at it. Why can't we just edit our first posts :(
Anyway, the reason for me updating is that the widget used the old version of Looki's Surface object, before you could blit alpha channels. So I was using a workaround by adding an extra image in the surface object. I just couldn't sleep knowing that the widget was wasting such useful resources ;P
Re: Text blitter using the Surface Object
I'm super impressed, this is incredibly well done! Nice for the sake of clarity that you stick to alterable values and avoid unnamed variables (flags that is).
I can't help but notice you consistently avoid space bars. The frame name is TextBlitter, the alterable values are named CharGridX, etc. I prefer just writing out what everything is without abbreviations including space bars when supported (simply Character Grid X). It's probably just a matter of taste though :)
Re: Text blitter using the Surface Object
Ah yes, it's because I'm starting to get more used to "typed" languages. So I've started avoiding spaces in variables and try abbreviating words so I don't have to type long words :P
Re: Text blitter using the Surface Object
Hi Hernan,
Very nice Widget!!!
A must have widget.
i am agree with Nifflas, very well code and organize.
Re: Text blitter using the Surface Object
Quote:
Originally Posted by Hernan
Ah yes, it's because I'm starting to get more used to "typed" languages. So I've started avoiding spaces in variables and try abbreviating words so I don't have to type long words :P
They were nicely named so I'm not complaining. The main reason for own "type what you would write" rules is that I tend to think people name things certain ways just beacuse it's a computer, so when I cooperate with people I can get a file named e.g. "water_abv_roof-v2.png" instead of just "Water above roof 2.png" or a variable named "horacc" instead of just "Horizontal Acceleration", so I decided to always select the name closest to regular writing as the context gives me. I avoid abbreviation because there's an extremely strong tendency that programmers use them in such away that their code becomes incomprehensible since you must look up what every variable actually is for.
Obviously you're not doing it wrong since it's all easily understandable, which is the whole point, and I bet you also have a consistent system you stick to :)
Re: Text blitter using the Surface Object
This is an amazing widget Hernan (probably the best I've seen so far)! Thank you very much for making it available to the community. I'm eager to use it in my next flash game. Hopefully Looki will update his Surface Object soon (what a great extension btw) because I get a compilation error for the moment. The same error than this one.
Re: Text blitter using the Surface Object
Oh thanks for letting me know Olivier, I will fix it soon.
Re: Text blitter using the Surface Object
That would be great Looki! :)
Re: Text blitter using the Surface Object
Pending that Looki fixes his Surface Object, I tried to use your widget in conjunction with one one the examples coming along with the extension. The example is Create.mfa where Looki builds an image bank at runtime. I'm doing the same, but by filling the bank with an image from an Active object which contains the character spritesheet (Blit Active object 'Active').
So far the image bank is fine and looks exaclty like yours Hernan. But then I can't get the characters to diplay. I must probably be missing something, since I didn't grasp some of the events in your widget. Any clue appreciated. :)
Re: Text blitter using the Surface Object
You can send me the mfa, because I don't really know what's going on otherwise.
2 Attachment(s)
Re: Text blitter using the Surface Object
So I modified your widget (comments on Frame1) and I only got it working when AlphaChannel is set to 0. When it is set to 1, no characters appear.
My understanding of the Surface object is obviously limited, that's why I can't get it working.
If you wonder why I wish to build the image bank at runtime from an Active object (set to Global); It's because the Surface object can't be global.
This trick will save me some hassle later in my project when I have dropped the Surface object on numerous frames, and I wish to update the character spritesheet(s). To do so I'll just have to update the global Active object. I hope it makes sense. :)
Re: Text blitter using the Surface Object
I think I understand the problem. The problem is twofold:
1. You cannot blit the active object's alpha channel to the surface's alpha channel, everything is blitted onto the surface's image channel while the alpha stays empty. Though I need confirmation from Looki on this, but it seems it's like this.
Suggestion: save the character image in an external png file and load it from there instead of blitting the active object.
2. In the widget's behaviour, the very first line:
"Start of frame
+Alpha Channel==1" etc.
I blindly assumed image 0 is the editing image at start >_<
So you have to add "Set editing image to 0" in this event, or an event before this one happens.
Re: Text blitter using the Surface Object
Sorry, that alpha-on-alpha blit issue is known and it will be fixed in the next update.
Re: Text blitter using the Surface Object
Thank you for letting me (well us) know Lukas. :)