Category : allegro5

Description: The problem that I had with Allegro was that there was some kind of weird input delay where all of the events (keyboard, display, etc.) were only processed after a few seconds. I have pinpointed the source of the problem to the main loop since the if statement here actually fixes the problem: if ..

Read more

I created a C++ game that uses images from a folder in the same parent directory. /game_folder —-/Images ——–icon1.png ——–icon2.png —-game.cpp Program uses Allegro 5 library to include images: ALLEGRO_BITMAP* icon1 = al_load_bitmap("Images/icon1.png"); ALLEGRO_BITMAP* icon2 = al_load_bitmap("Images/icon2.png"); And this works great. However now I need to place this program into ROS/catkin package ‘beginner_tutorials’. If I ..

Read more

Allegro5 cannot seem to be able to decode png images for my game project. This function: ALLEGRO_BITMAP* BrushCollection::LoadBitmapFromFile(const char* fileName) { ALLEGRO_PATH* path = al_get_standard_path(ALLEGRO_EXENAME_PATH); al_append_path_component(path, "assets"); al_set_path_filename(path, fileName); ALLEGRO_BITMAP* bitmap = al_load_bitmap(al_path_cstr(path, ”)); allegro_init(bitmap, L"UI Bitmap"); return bitmap; } returns NULL. I know image paths are correct because the same code works on Windows. ..

Read more

I am trying to get started with the Allegro game development library for C++ on Mac OS Catalina 10.15.4, but I am having some issues with compilation and linking. The following code compiles: #include <stdio.h> #include <allegro5/allegro.h> #include <allegro5/allegro_ttf.h> #include <allegro5/allegro_font.h> #include <iostream> #define ScreenWidth 375 #define ScreenHeight 667 int main(int argc, char *argv[]){ al_init(); ..

Read more

Me and a classmate are making an Allegro 5 game, a Defender remake, but we have some problems with the bullets. When the bullet impacts a borderline the game crashes completely. void Player::render() { al_map_rgb(0, 0, 0); nave = al_load_bitmap("images/naveV2_xs.png"); for (auto& bullet : bullets) { bullet->render(); } al_draw_bitmap(nave, x, y, 0); } void Player::dispose() ..

Read more

Sorry for my english. I followed this tutorial https://www.youtube.com/watch?v=shTvg2lbjjA to draw a map with rectangle but my problem is it seems to just draw at position (0,0). Here is my code. Firstly, i load the map with a text file. void Carte::loadMap(const char*filename) { std::ifstream openfile(filename); if(openfile.fail()) { cout <<"Failed to open this file!" << ..

Read more