Hey, here is my current code firstly:
#SelectExpand
1#include <allegro5/allegro.h>
2#include <allegro5/allegro_font.h>
3#include <allegro5/allegro_ttf.h>
4#include <stdio.h>
5
6int main
(int argc,
char **argv
) {
7 ALLEGRO_DISPLAY *display
= NULL
;
8 ALLEGRO_EVENT_QUEUE *event_queue
= NULL
;
9 ALLEGRO_FONT *myfont
= NULL
;
10 al_init();
11
12 al_init_font_addon();
13 al_init_ttf_addon();
14 al_install_keyboard();
15
16 display
= al_create_display(640,
480);
17 myfont
= al_load_ttf_font("pirulen.ttf",
72,
0);
18 event_queue
= al_create_event_queue();
19 al_register_event_source(event_queue,
al_get_display_event_source(display
));
20 al_register_event_source(event_queue,
al_get_keyboard_event_source());
21 al_clear_to_color(al_map_rgb(255,
255,
255));
22 al_flip_display();
23 while (1)
24 {
25 ALLEGRO_EVENT ev
;
26 ALLEGRO_TIMEOUT timeout
;
27 al_init_timeout(&timeout,
0.
06);
28
29 bool get_event
= al_wait_for_event_until(event_queue,
&ev,
&timeout
);
30
31 if (get_event
&& ev.type
== ALLEGRO_EVENT_DISPLAY_CLOSE
) {
32 break;
33 }
34 else if (get_event
&& ev.type
== ALLEGRO_EVENT_KEY_DOWN
) {
35 int code
= ev.keyboard.keycode
;
36 al_draw_text(myfont,
al_map_rgb(0,
0,
0),
320,
240, ALLEGRO_ALIGN_CENTRE,
"Button pressed!");
37 }
38
39 al_clear_to_color(al_map_rgb(255,
255,
255));
40 al_flip_display();
41 }
42 al_destroy_display(display
);
43 al_destroy_event_queue(event_queue
);
44 return 0;
45}
For some reason, I keep getting errors saying unresolved external symbol for
al_init_font_addon() and al_init_ttf_addon()
What am I doing wrong here? Even if I copy+paste the exact code for fonts and text from the wiki it gives me this error.
By the way, I'm using Visual Studio 2015.
Thanks in advance