SHOW:
|
|
- or go back to the newest paste.
1 | - | // Programmer: Nicholas Markopoulos |
1 | + | // Programmer: |
2 | // Project: Untitled | |
3 | // Date Created: 2/17/2012 | |
4 | - | // Last edited: 2/17/2012 |
4 | + | // Last edited: 2/18/2012 |
5 | ||
6 | // Function prototypes | |
7 | ||
8 | ||
9 | // Libraries | |
10 | ||
11 | #include <stdlib.h> | |
12 | #include <stdio.h> | |
13 | #include <math.h> | |
14 | #include <string.h> | |
15 | ||
16 | // Allegro libraries | |
17 | ||
18 | #include <allegro5\allegro.h> | |
19 | #include <allegro5\allegro_font.h> | |
20 | #include <allegro5\allegro_ttf.h> | |
21 | ||
22 | // Constants | |
23 | ||
24 | // Main Function | |
25 | ||
26 | int main (void) | |
27 | { | |
28 | // Initialize display | |
29 | ||
30 | ALLEGRO_DISPLAY *display = NULL; | |
31 | ||
32 | // Check if Allegro intitialized | |
33 | ||
34 | if (!al_init()) | |
35 | { | |
36 | fprintf (stderr, "Failed to initialize Allegro!\n"); | |
37 | ||
38 | return -1; | |
39 | } | |
40 | ||
41 | // Create display | |
42 | ||
43 | display = al_create_display(640, 480); | |
44 | ||
45 | // Check if display initialized | |
46 | ||
47 | if (!display) | |
48 | { | |
49 | fprintf (stderr, "Failed to create display!\n"); | |
50 | ||
51 | return -1; | |
52 | } | |
53 | ||
54 | // Initialize font/ttf addons | |
55 | ||
56 | al_init_font_addon (); | |
57 | al_init_ttf_addon (); | |
58 | ||
59 | // Load in font | |
60 | ||
61 | ALLEGRO_FONT *font24 = al_load_font ("BAUHS93.ttf", 24, 0); | |
62 | ||
63 | // Clear screen color | |
64 | ||
65 | al_clear_to_color (al_map_rgb (0, 0, 0)); | |
66 | ||
67 | // Draw to screen | |
68 | ||
69 | al_draw_text (font24, al_map_rgb (255, 120, 20), 50, 50, 0, "Why hello there, hopefully this all works out."); | |
70 | ||
71 | // Switch buffers | |
72 | ||
73 | al_flip_display (); | |
74 | ||
75 | // Rest screen | |
76 | ||
77 | al_rest (5.0); | |
78 | ||
79 | // Destroy display | |
80 | ||
81 | al_destroy_display (display); | |
82 | ||
83 | return 0; | |
84 | } |