How to load images from buffer in allegro5?
Or something like this, because i don't know even how to display this :/
I've got this code:
You could tell me, that is allegro_font extension...
this extension is... never mind
when i display text, where there are spaces between letters, this ... ( 400 letters ) get almost half processor usage
but normal text is drawing almost clearly -.-
my app has lags by this...
( EXAMPLE )
[WITH SPACES] A B C D E F G [NO SPACES] ABCDEFG
Please, help
What are you trying to say is that you want to use FreeType directly because the Allegro Font addon is slow when you draw text with spaces?
Yes
With spacing, example, between letters is 10px space,
so, I draw every letter alone and add 10 px space, and this cheating...
Well, then it's true, it's better if you find a way to use FreeType directly. I don't know how to do it, though.
I have never heard this particular problem with spaces, but indeed Allegro has some problems when drawing fonts.
There is a way to cache the text you want to draw before drawing it, that should make everything faster but it's a hacky (not elegant) way of doing it.
It's a real hack: you just have to draw the text before using it... Yep take the drawing function and draw all the characters and numbers of your alphabet, after that, it should be faster...
Instead of drawing, you can also use the al_get_text_width() function. Do something like this:
al_get_text_width(font, "abcdefghijklmnñopqrstuvw123456789ABCDEFGHIJKLMNÑOPQRSTUW,.:;");
That should improve a bit.
But If you're having problems with spaces... I really don't know...
Now, I know this may sound a little bit crazy, but at the same time if you're experiencing too much lag when drawing fonts using Allegro, it's because you're using text a lot, so for that reason it might be better to use SFML since it handles better the font drawing operations.
Because I don't know, using FreeType directly doesn't sound like a good idea to me.
Edit:
Have you created the font before or after creating the display?
Thank you for your answer
you just have to draw the text before using it
Yes, i now it...
Look at this ( cut from my code ):
IF no spacing
ELSE spacing
From my provisional input
hmm... I could use sfml, as you say, but I like allegro 
If you want to test this, have it:
CPP BInput.cpp
HEADER BInput.hpp
CPP BlackGUI:
HEADER BlackGUI
and of course main.cpp
In this case i couldn't draw text before using it 
I minimize the CPU usage to minimum (at least I think so)
If you want to help me with GUI creating, write on PM
Wow. Too much code, I can't read it right now (working).
Maybe this in your code but as I said I can't read it right now. How are you measuring the speed of your program?
cheating only if i write something ( only if i write a lot of letters - small lag from 200, i think ), because then the function starts drawing, a picture to a bitmap, and finally a bitmap is displaying ( bitmap is changing when a letter is captured ) 
hmm... this code is only on copy - paste - debug 
I gave this code for test if you want
My CPU is AMD Athlon 64 ( 2,4 Ghz ), so this new he is not ( I don't know, if I translate this correct
)
I check usage of processor with process manager ( windows )
/// EDIT:
I've got one idea, how to improve performance
I don't know man... I think you're not measuring the speed of your program correctly... Do you have a FPS (Frames Per Second) algorithm there? I can't see it in your code.
You have your timer variable set to 60FPS, how many FPS are you getting?
I have 28 when i put 400 letters
This is my algorithm:
Now I see... Your problem is in here:
But more precisely here:
for( unsigned short A = 0; A < B; ++A ) { al_draw_text( font, al_map_rgb( 90, 90, 90 ), text_width + al_get_text_width( font, stext.substr( 0, this->bcolumn ).c_str( ) ) + ( A * this->hspacing ), text_height, 0, stext.substr( this->bcolumn, sbytes[A] ).c_str( ) ); this->bcolumn += sbytes[A]; }
That is what is causing the lag when appending new characters and not when drawing them.
If FreeType allows you to set the character spacing then it could help you.
I don't know, have you tried creating the ALLEGRO_BITMAP from a file using al_load_bitmap_f()? You could try to load the FreeType bitmap into an ALLEGRO_FILE struct, and then use the function I just mentioned to create an ALLEGRO_BITMAP. But I'm not sure if that bitmap will be a video bitmap or a memory bitmap.
Thank you for your answer.
I try to write what you said, but it's not working :/
Error in CMD:
Assertion failed: bitmap, file allegro-5.0.x\src\bitmap.c, line 315
sizeof( slot->bitmap.buffer )
You can't get the size of dynamically allocated arrays like that. You'll need to find where FreeType stores the actual size of that array.
I am looking, looking and I don't see anything...
Maybe I try something else, because because i don't see any sense at this time to loading this liblary to script...