linutux escribió:Y que diferencia hay entre Allegro y Allegro++ a parte de que esta en C++.![]()
#include <stdio.h>
#include "allegro5/allegro5.h"
int main(int argc, const char *argv[])
{
ALLEGRO_EVENT_QUEUE *queue;
al_init();
al_install_keyboard();
queue = al_create_event_queue();
al_register_event_source(queue, al_get_keyboard_event_source());
while (1) {
ALLEGRO_EVENT event;
al_wait_for_event(queue, &event);
if (event.type == ALLEGRO_EVENT_KEY_DOWN)
if (event.keyboard.keycode == ALLEGRO_KEY_H)
printf("hola");
}
return 0;
}
#include <iostream>
#include "allegro++/allegro++.hpp
class MyKeyboardListener : public Allegro::KeyboardListener
{
protected:
void onKeyDown(Allegro::KeyboardEvent* e)
{
if(e->getKeyCode() == Allegro::KeyH)
std::cout << "hola";
}
};
int main(int argc, const char *argv[])
{
Allegro::Application* app = Allegro::Application::getInstance();
app->installKeyboard();
app->attachListener(new MyKeyboardListener());
return app->exec();
}
Bergil escribió:Si tú contento, nosotros contentos
Bergil escribió::laleche: , ¡qué ingenio!
Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 2 invitados