Thanks MK; I could not figure out what he was trying to say with that...
Printable View
Thanks MK; I could not figure out what he was trying to say with that...
I tried to put a blank place in the screen, and pressing key to pass images, but it goes way too slow, and I can't get out, I had to turn off the computer to get out. Well, at least I got one line displayed - that's a beginning. In the following code, I have only the first line, because it is just to test... When it work's, I put the real text.
Current:
Help?Code://Este programa foi feito por X.
//Notas:
//O comando printf introduz texto para o ecrã. O "\n" significa introduzir numa nova linha.
//Já pus o título. Seguir o seu exemplo. Meter o resto por baixo. Não mexer nas outras coisas.
//Have fun!
//P.S.
//O texto que começa com "//" são comentários. Não são interpretados pelo compilador, e não aparecem no programa em si.
#include <stdio.h>
#include <allegro.h>
int main(void)
{
BITMAP *bmp;
PALETTE palette;
allegro_init();
set_color_depth(24);
set_gfx_mode(GFX_AUTODETECT, 800, 600, 0, 0);
install_keyboard();
int sleepTime = 1;
readkey();
clear_to_color(screen, makecol(255, 255, 255));
bmp = load_bitmap("PC.bmp", palette);
draw_sprite(screen, bmp, 0, 0);
release_screen();
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 255, 255, 255);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 2, 10);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 3, 10);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 4, 10);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 5, 10);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 6, 10);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 7, 10);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 8, 10);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 9, 10);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 10, 10);
sleep(sleepTime);
release_screen();
bmp = load_bitmap("Super.bmp", palette);
draw_sprite(screen, bmp, 1, 1);
release_screen();
sleep(sleepTime);
release_screen();
bmp = load_bitmap("PDA.bmp", palette);
draw_sprite(screen, bmp, 2, 2);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 15, 10);
sleep(sleepTime);
bmp = load_bitmap("consti.bmp",palette);
draw_sprite(screen, bmp, 3, 3);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 25, 10);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 1, 10);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 1, 10);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 1, 10);
sleep(sleepTime);
bmp = load_bitmap("SO.bmp", palette);
draw_sprite(screen, bmp, 4, 4);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 30, 10);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 31, 10);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 32, 10);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 33, 10);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 34, 10);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 35, 10);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 36, 10);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 37, 10);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 38, 10);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 39, 10);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 40, 10);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 41, 10);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 42, 10);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 43, 10);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 44, 10);
sleep(sleepTime);
bmp = load_bitmap("Ubuntu.bmp",palette);
draw_sprite(screen, bmp, 5, 5);
sleep(sleepTime);
bmp = load_bitmap("XP.bmp", palette);
draw_sprite(screen, bmp, 6, 6);
sleep(sleepTime);
bmp = load_bitmap("7.bmp", palette);
draw_sprite(screen, bmp, 7, 7);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 55, 10);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 56, 10);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 57, 10);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 58, 10);
sleep(sleepTime);
bmp = load_bitmap("command.bmp", palette);
draw_sprite(screen, bmp, 8, 8);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 65, 10);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 66, 10);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 67, 10);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 68, 10);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 69, 10);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 70, 10);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 71, 10);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 72, 10);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 73, 10);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 74, 10);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 75, 10);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 76, 10);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 77, 10);
sleep(sleepTime);
textout(screen, font, "Linguagem Binária\n", 1, 78, 10);
getchar();
return 0;
}
END_OF_MAIN()
I cannot help with your graphics mode problem (I avoid graphics mode for just these (seemingly) stupid reasons. However if your app seems to get stuck in memory on Linux you can to a killall <yourappname>, obviously filling in the name of your app to blow it out of memory (do this from another terminal). If you are still calling it what you did, killall main.exe will work. Rebooting a UNIX box is the last refuge of the desperate. :)
I am not sure what the screen var is you are writing to but I Googled this and saw a very different method of writing text to the screen here:
GameDev.net - Text Input in an Allegro Game
They are writing to a blank bitmap and then blitting it to the screen (it looks like; this is not my preserve)...
Just based on reading the manual for Allegro, once you've done install_keyboard you can't use the usual input functions, so getchar() will never happen unless you release the keyboard. You should probably set up a keyboard handler so you can type Q to stop things or whatever.
Does the text move down every second like it's supposed to? Given you're moving it by one pixel(?) every time without clearing the old stuff, it might be hard to tell.
Tab: yeah Allegro (I googled a bit while helping him yesterday) has a work-alike for getchar() though ATM (lack of sleep) what it is escapes me)...
How much pixels are a line?
Depends on your screen resolution. 800x600 means...... :)
I'm in class. I really need some help...
How do I put different sleeptime's seconds? And don't want the same time. I'm almost there...
I typed:
Etc etc... It gives me the error:Code:
(...)
int sleepTime;
(...)
sleep(sleepTime)=1;
(...)
sleep(sleepTime)=2;
What can I do? I know the next time I build, it will do what I want... I drawed a blank bitmap do the middle of the screen (as sugested) and in the textouts I inserted different pixels to each. 38 pixels ~ 1cm. I followed that. Wish me luck! :DCode:error: lvalue required as left operand of assignment
You need to assign to sleeptime.
Code:sleeptime=1;
sleep(sleeptime);
it hurts ... my eyes ... !!
Way too many brackets. The way jeff formatted the code makes much more sence.
I have a question about the textout pixels.
It has, for example:
What's the number I have to change to put 38 pixels down? And I have to increase or decrease the number?Code:255,255,255
E changed the first one up, but it isn't... The letters are over each other. But I'm almost there... When I find the pixels I have to change, I finish.
textout isn't a standard C function. Go ask whomever has given you the function how to use it.
Quzah.
I asked Google, but he didn't retreave what I want... Ignore the textouts. Tell me about the pixels.