It's a wrapper for Allegro5 written in C++, in a OOP way (see : http://liballeg.org/ for Allegro's website).
  • C++ 96%
  • CMake 4%
Find a file
2019-11-05 01:12:36 +01:00
examples Changed how threading work completely -> use Allegro threads, since it is much better... 2019-11-05 01:12:36 +01:00
fonts Changed arial to arimo, a free font (because of a license issue) 2018-02-09 17:03:50 +01:00
include/allegro++ Changed how threading work completely -> use Allegro threads, since it is much better... 2019-11-05 01:12:36 +01:00
src/allegro++ Changed how threading work completely -> use Allegro threads, since it is much better... 2019-11-05 01:12:36 +01:00
.gitignore Added codelite files to .gitignore 2019-10-29 01:44:32 +01:00
AllegroPP.project Add Codelite project file 2019-11-04 19:01:00 +01:00
CMakeLists.txt Bump to version 1.0.0 2019-10-28 23:20:46 +01:00
doxygen.conf Bump to version 1.0.0 2019-10-28 23:20:46 +01:00
LICENSE Initial commit 2017-12-20 20:58:11 +01:00
README.md Updated README.md to reflect the CMake build system, and give more detailed instructions. 2019-10-28 22:23:35 +01:00

Allegro++

How to build

$ git clone https://github.com/aviallon/AllegroPP.git
$ cd AllegroPP
$ mkdir build
$ cd build
$ cmake ..
$ make -j$(nproc)
$ sudo make install

How to use

You first need C++14 at least, because the filesystem TS is needed. Of course, C++17 is even better.

Simply include <allegro++/allegro.h>, and everything will automatically get included

You also need to link against these libraries :

allegro++
allegro
allegro_image
allegro_primitives
allegro_memfile
allegro_ttf
allegro_dialog
allegro_color
allegro_font
armadillo
stdc++fs

The last one is needed if you are using GCC 8 and below. For Clang, it's c++fs.

It works a little bit like Tkinter, for Python users.

#include <allegro++/allegro.h>

using namespace AllegroPP;

void draw(Allegro* allegro, float fps){
   allegro->clearScreen(); // screen is not cleared by default
   allegro->draw_text(640/2, 480/2, "Hello, world!", allegro->rgb(0, 0, 0)); // Draw "Hello, world!" in the middle of the screen (in black).
}

int main(){
   Allegro::init(); // Required before doing anything else
   Allegro window = Allegro();

   window.createWindow(30, 640, 480, ALLEGRO_WINDOWED); // Create a window with a width of 640 and a height of 480, refreshing at 30 fps.

   window.setRedrawFunction(&draw);

   Allegro::startLoop();

   return 0;
}

I'll give more detailed examples in a dedicated folder (see example0 for a complex multi-window example, with heavy animation)