1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
|
#include <allegro5/allegro.h>
#include <allegro5/allegro_font.h>
#include <allegro5/allegro_ttf.h>
#include <iostream>
using namespace std;
int width = 640;
int height = 480;
int ATT = 0;
int DEF = 0;
int HP = 0;
int DAM = 0;
int ATT1 = 0;
int DEF1 = 0;
int HP1 = 0;
int DAM1 = 0;
char NAME[20];
bool done = false;
ALLEGRO_DISPLAY *display = NULL;
ALLEGRO_EVENT_QUEUE *event_queue = NULL;
void test();
void stats();
int main(void)
{
if(!al_init())
{
return -1;
}
display = al_create_display(width, height);
if(!display)
{
return -1;
}
test();
al_rest(5.0);
al_destroy_display(display);
return 0;
}
void test()
{
al_init_font_addon();
al_init_ttf_addon();
ALLEGRO_FONT *font32 = al_load_font("couri.ttf", 32, 0);
stats();
ATT = ATT + ATT1;
DEF = DEF + DEF1;
HP = HP + HP1;
DAM = HP - DAM1;
display = al_create_display(width, height);
al_draw_textf(font32, al_map_rgb(11, 0, 255), 50, height - 450, 0,
"Name: %s", NAME);
al_draw_textf(font32, al_map_rgb(11, 0, 255), 50, height - 400, 0,
"Attack: %i", ATT);
al_draw_textf(font32, al_map_rgb(11, 0, 255), 50, height - 350, 0,
"Defence: %i", DEF);
al_draw_textf(font32, al_map_rgb(11, 0, 255), 50, height - 300, 0,
"Health: %i / %i", DAM, HP);
al_flip_display();
al_clear_to_color(al_map_rgb(0, 0, 0));
test();
}
void stats()
{
cout << "Please enter your name: ";
cin >> NAME;
cout << endl << "Please enter your attack level: ";
cin >> ATT1;
cout << endl << "Please enter your defence level: ";
cin >> DEF1;
cout << endl << "Please enter your health level: ";
cin >> HP1;
cout << endl << "Please damage your character: ";
cin >> DAM1;
al_destroy_display(display);
}
|