No więc jak zawsze, wie ktoś dlaczego? Dzięki z góry ;)
#include <stdio.h>
#include <allegro5/allegro.h>
#include <allegro5/allegro_native_dialog.h>
#include <allegro5/allegro_primitives.h>
using namespace std;
int main(int argc, char **argv)
{
ALLEGRO_DISPLAY *display = NULL;
al_set_new_display_flags(ALLEGRO_NOFRAME);
if(!al_init()) {
al_show_native_message_box(NULL, "Error!", "Failed to initialize allegro.", 0, 0, ALLEGRO_MESSAGEBOX_ERROR);
return -1;
}
if(!al_init_primitives_addon()) {
al_show_native_message_box(NULL, "Error!", "Failed to initialize primitives addon.", 0, 0, ALLEGRO_MESSAGEBOX_ERROR);
return -1;
}
if(!al_install_keyboard()) {
al_show_native_message_box(NULL, "Error!", "Failed to install keyboard.", 0, 0, ALLEGRO_MESSAGEBOX_ERROR);
return -1;
}
ALLEGRO_KEYBOARD_STATE key_state;
display = al_create_display(768, 540);
if(!display) {
al_show_native_message_box(NULL, "Error!", "Failed to create display.", 0, 0, ALLEGRO_MESSAGEBOX_ERROR);
return -1;
}
while(al_key_down(&key_state, ALLEGRO_KEY_ESCAPE))
{
al_clear_to_color(al_map_rgb(0,171,169));
al_draw_line(0, 60, 768, 60, al_map_rgb(255,255,255), 1);
al_draw_filled_circle(200, 200, 5, al_map_rgb(255,255,255));
al_flip_display();
al_get_keyboard_state(&key_state);
}
al_destroy_display(display);
return 0;
}
P.S. Nawet przy prostszym kodzie mi wywala:
#include <stdio.h>
#include <allegro5/allegro.h>
int main(int argc, char **argv)
{
ALLEGRO_DISPLAY *display = NULL;
if(!al_init()) {
fprintf(stderr, "failed to initialize allegro!\n");
return -1;
}
display = al_create_display(640, 480);
if(!display) {
fprintf(stderr, "failed to create display!\n");
return -1;
}
al_clear_to_color(al_map_rgb(0,0,0));
al_flip_display();
al_rest(3.0);
al_destroy_display(display);
return 0;
}