Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <allegro5/allegro.h>
- #include <allegro5/allegro_opengl.h>
- #include <allegro5/allegro_direct3d.h>
- #include <stdio.h>
- int main() {
- al_init();
- al_set_new_display_flags(ALLEGRO_DIRECT3D);
- //al_set_new_display_flags(ALLEGRO_DIRECT3D | ALLEGRO_FRAMELESS);
- //al_set_new_display_flags(ALLEGRO_OPENGL);
- //al_set_new_display_flags(ALLEGRO_OPENGL | ALLEGRO_FRAMELESS);
- ALLEGRO_DISPLAY *display = al_create_display(640, 480);
- ALLEGRO_EVENT_QUEUE *queue = al_create_event_queue();
- al_install_keyboard();
- al_install_mouse();
- al_register_event_source(queue, al_get_keyboard_event_source());
- al_register_event_source(queue, al_get_mouse_event_source());
- al_register_event_source(queue, al_get_display_event_source(display));
- al_set_window_position(display, 200, 200);
- int exit = 0;
- while (!exit) {
- ALLEGRO_EVENT ev;
- while (al_get_next_event(queue, &ev)) {
- if (ev.type == ALLEGRO_EVENT_DISPLAY_CLOSE) {
- exit = 1;
- }
- if (ev.type == ALLEGRO_EVENT_KEY_DOWN) {
- if(ev.keyboard.keycode == ALLEGRO_KEY_ESCAPE) {
- exit = 1;
- }
- int x = 0;
- int y = 0;
- al_get_window_position(display, &x, &y);
- al_set_window_position(display, x, y);
- printf("Coords: %d, %d\n", x, y);
- }
- }
- al_flip_display();
- }
- al_destroy_event_queue(queue);
- al_destroy_display(display);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement