Feb 5, 2015 at 9:13am UTC
I have a problem with compiling the Allegro5 library:
"Cannot find allegro-5.0.10- monolith.mt"
source:
#include <allegro5/allegro.h>
#include <allegro5/allegro_primitives.h>
#include <cmath>
int main() {
al_init();
al_init_primitives_addon();
al_install_keyboard();
ALLEGRO_KEYBOARD_STATE klawiatura;
al_set_new_display_flags(ALLEGRO_WINDOWED);
ALLEGRO_DISPLAY *okno = al_create_display(400, 300);
al_set_window_title(okno, "Allegro5 - Prymitywy");
ALLEGRO_EVENT_QUEUE *kolejka = al_create_event_queue(); // event_queue
al_register_event_source(kolejka, al_get_display_event_source(okno));
ALLEGRO_EVENT zdarzenie; // event
float x = 200, y1 = 120, y2 = 180, r = 30;
float x0 = 200, y0 = 90, r0 = 15;
float t = 1;
int tmp = 0;
bool up = true;
while (true) {
al_get_next_event(kolejka, &zdarzenie);
if (zdarzenie.type == ALLEGRO_EVENT_DISPLAY_CLOSE) {
return 0;
}
al_get_keyboard_state(&klawiatura);
al_clear_to_color(al_map_rgb(150, 150, 150));
//circles
al_draw_circle(x, y1, r, al_map_rgb(0, 128, 0), 1);
al_draw_circle(x, y2, r, al_map_rgb(0, 128, 0), 1);
//filed circle
if (up) {
x0 = x + r * cos(-t);
y0 = y1 + r * sin(-t);
if (y0 >= 149 && tmp >20) {
up = false;
tmp=0;
}
}
if (!up) {
x0 = x + r * cos(t);
y0 = y2 + r * sin(t);
if (y0 <= 151 && tmp >20) {
up = true;
tmp=0;
}
}
al_draw_filled_circle(x0, y0, r0, al_map_rgba(200, 28, 0, 60));
tmp++;
t = t + 0.05;
al_flip_display();
al_rest(0.005);
if (!al_key_down(&klawiatura, ALLEGRO_KEY_ESCAPE) == false)
break;
}
al_destroy_display(okno);
return 0;
}
Feb 5, 2015 at 9:49am UTC
Well, what I would do is put code tags on, and look at another tutorial and hope that they describe how to set up allegro better.