Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » messages

This thread is locked; no one can reply to it. rss feed Print
messages
a b
Member #8,092
December 2006

1#include<iostream>
2#include <allegro.h>
3using namespace std;
4 
5int main()
6{
7BITMAP *plan = NULL;
8BITMAP *pawn = NULL;
9 
10allegro_init();
11install_keyboard();
12set_color_depth(16);
13set_gfx_mode(GFX_AUTODETECT,1280,1024,0,0);
14set_palette(default_palette);
15clear_to_color(screen,15);
16 
17plan = load_bitmap("plan.bmp",default_palette);
18pawn = load_bitmap("pawn.bmp",default_palette);
19 
20 
21 
22blit(plan,screen,0,0,0,0,plan->w,plan->h);
23blit(pawn,screen,0,0,0,0,pawn->w,pawn->h);
24text_mode(-1);
25textout(screen,font,"ESC - The end of program",10,1000,2);
26 
27destroy_bitmap(plan);
28destroy_bitmap(pawn);
29 
30readkey();
31allegro_exit();
32return 0;
33}
34END_OF_MAIN()

In dev C++ I can see after compile this code:
C:\Documents and Settings\windows\Pulpit\main.cpp In function `int _mangled_main()':
24 C:\Documents and Settings\windows\Pulpit\main.cpp [Warning] `text_mode' is deprecated (declared at C:/Dev-Cpp/include/allegro/alcompat.h:155)
24 C:\Documents and Settings\windows\Pulpit\main.cpp [Warning] `text_mode' is deprecated (declared at C:/Dev-Cpp/include/allegro/alcompat.h:155)
25 C:\Documents and Settings\windows\Pulpit\main.cpp [Warning] `textout' is deprecated (declared at C:/Dev-Cpp/include/allegro/alcompat.h:157)
25 C:\Documents and Settings\windows\Pulpit\main.cpp [Warning] `textout' is deprecated (declared at C:/Dev-Cpp/include/allegro/alcompat.h:157)

????????????

And How can I enlarge text: "ESC - The end of program" ??

Kris Asick
Member #1,424
July 2001

Old commands.

textout() and textprintf() have been replaced with textout_ex() and textprintf_ex(), which, instead of having to set the text mode ahead of time, take both a foreground and background colour, and if you set the background to -1, it will be transparent.

To make the text at the end bigger, you can either make yourself a bigger font and load it into your program, or you can print your text onto a bitmap and use stretch_blit() to paste it to the screen as big as you want.

--- Kris Asick (Gemini)
--- http://www.pixelships.com

--- Kris Asick (Gemini)
--- http://www.pixelships.com

a b
Member #8,092
December 2006

I don't understand english very well - so haw can I write this in a new style:
"text_mode(-1);
textout(screen,font,"ESC - The end of program",10,1000,2);"
????????

Kris Asick
Member #1,424
July 2001

textout_ex(screen,font,"ESC - The end of program",10,1000,2,-1);

You do not need text_mode().

--- Kris Asick (Gemini)
--- http://www.pixelships.com

--- Kris Asick (Gemini)
--- http://www.pixelships.com

a b
Member #8,092
December 2006

Thank you very much !!!! :)

Go to: