FAQ Database Discussion Community


Allegro 4.4.2 On Visual Studio 2013 Unhandled Exception

c++,allegro
I´m starting to use allegro 4.4.2 on Visual Studio 2013. I installed both allegro 4.4.2 and 5.0.10 on VS and started testing some examples of allegro 4.4.2 This is my code: #include <allegro.h> #define ANCHO 640 #define ALTO 480 int soltado = 1; int accion = 4; BITMAP *buffer; BITMAP...

CMake cannot find a static library using relative file paths

c++,linker,cmake,allegro
I'd like to play around with the Allegro library, but I can't seem to get my test project to link properly. To be exact, I'm getting cannot find -l<...> errors, where <...> is a file I specified using target_link_libraries. (See below for details.) For the record, I'm not all that...

How to press multiple keys at the same time using events in real-time? (Allegro 5)

c++,events,allegro,allegro5
This is a problem that haunts me for years. Here's my game.h and game.cpp files: game.h #ifndef GAME_H_INCLUDED #define GAME_H_INCLUDED #include "init.h" ALLEGRO_BITMAP *load_bmp(path *s); struct Actor { const char *path; ALLEGRO_BITMAP *bmp; int x; int y; int speed; }; void init_game_bitmaps(); void draw_game_bitmaps(); extern map<string, bool> key_states; void init_key_states();...

How to assign a unique_ptr with a custom deleter

c++,c++11,struct,unique-ptr,allegro
I am trying to pass a pointer to a function that then sets a unique_ptr inside a struct to the pointer passed in. However, I get the following compile error on the last line of the function. error C2280: 'std::unique_ptr< ALLEGRO_BITMAP,std::default_delete< ALLEGRO_BITMAP>>::unique_ptr(const std::unique_ptr< ALLEGRO_BITMAP,std::default_delete< ALLEGRO_BITMAP>> &)' : attempting to reference...

How do I get “Allegro Error”?

c++,allegro,allegro5
I come from SDL and there I had a function called SDL_GetError(), which returned magically a const char * with the internal error. Here's my piece of code on Allegro 5: #include "game.h" ALLEGRO_BITMAP *load_bmp(const char *s) { ALLEGRO_BITMAP *bmp = nullptr; bmp = al_load_bitmap(s); if (!bmp) { al_show_native_message_box(display, "Fatal...

Drunk Mandelbrot implementation [closed]

c++,fractals,allegro,allegro5,mandelbrot
I wrote a program that is supposed to draw the Mandelbrot fractal. Unfortunately, it seems to be drunk. Here is the output: The relevant function: void drawMandelbrot(float x, float y, float width, float height, float delta) { for (float currentX = -2; currentX < 2; currentX += delta) { for...

How can I simulate a nested function without lambda expressions in C++11?

c++,function,c++11,lambda,allegro
I have the following code: int main(int argc, char **argv) { App app(800, 600); app.add_event_scene(Scene("Event Plot", event_plot)); Image x("sample.png"); struct foo { static void visual_plot() { x.draw(); } }; // Error. app.add_visual_scene(Scene("Visual Plot", foo::visual_plot)); app.run(); return 0; } And I get the following error: ||=== Build: Debug in Joy-Plus-Plus (compiler:...

Allegro framerate issue

c++,allegro,allegro5
So i've been having some issues with Allegro recently. I have no idea what's causing it, but i will try to detail the problem below as best i can. In my main function, i have something like this: int main() { Game *game = new Game(); game->init(800, 600, 60); //width,...

Playing sound file in C with Allegro5

c,audio,allegro,allegro5
I am trying to play wav file in C with allegro5 and I wrote below code: #include <stdio.h> #include <allegro5/allegro.h> #include <allegro5/allegro_audio.h> #include <allegro5/allegro_acodec.h> int main(int argc, char **argv){ ALLEGRO_DISPLAY *display = NULL; if (!al_init()){ fprintf(stderr, "failed to initialize allegro!\n"); return -1; } if (!al_install_audio()){ fprintf(stderr, "failed to initialize audio!\n");...