codice:
#include <allegro.h>
#include <cstdlib>
#include <iostream>
#include <string>
#include <stdio.h>
#include <alfont.h>
#include <alfontdll.h>
#define WHITE makecol(255, 255, 255)
using namespace std;
PALETTE colori;
//char* parola="_";
BITMAP *buf, *sprite;
int x,y;
void init();
void deinit();
void doppiobuffering()
{
vsync();
blit(buf,screen,0,0,0,0,640,480);
clear(buf);
}
void struttura()
{
masked_blit( sprite, buf, 0,0, x, y, 320, 320);
}
void textual ()
{
FONT* font1=load_font("font1.pcx",NULL,NULL);
textout_ex(buf, font1, "L'impiccato",290, 5,
makecol(255, 125, 45), -1);
/*cout<<"Give the text";
textout_ex(buf, font1, parola,330, 290,
makecol(255, 125, 45), -1); <--- Prova fallita */
}
int main() {
//char stringa1[]={'I','n','s','e','r','i','s','c','i'};
int depth, res;
allegro_init();
depth = desktop_color_depth();
if (depth == 0) depth = 32;
set_color_depth(depth);
res = set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0);
if (res != 0) {
allegro_message(allegro_error);
exit(-1);
}
install_timer();
install_keyboard();
install_mouse();
set_palette(colori);
buf=create_bitmap(640,480);
clear(buf);
sprite= load_bmp("strut.bmp",NULL);
x=150;
y=100;
while (!key[KEY_ESC]) {
doppiobuffering();
struttura();
textual();
}
deinit();
return 0;
}
END_OF_MAIN()
void deinit() {
clear_keybuf();
destroy_bitmap(buf);
destroy_bitmap(sprite);
}