|
Bibliographic references |
The C++ programming language, Bjarne Stroustrup |
The C++ primer, Stanley Lipmann |
Programming project |
2024: Treasure hunt in a labyrinth haunted by hostile robots
Specifications of the project.
Example of a labyrinth |
This is an example of labyrinth.
Prototype for Linux (Fedora and Ubuntu), MacOSX and Windows |
You will find in the labh-proto-fltk.tgz archive the game prototype. This prototype uses the FLTK graphical toolkit (https://www.fltk.org) which runs on all three major systems. A pre-compiled version is provided in the fltk-1.4-linux, fltk-1.4-ubuntu, fltk-1.4-macosx and fltk-1.4-windows directories.
This version, once unpacked, contains the following files:
Chasseur.cc Labyrinthe.cc OpenGL-macosx.o fltk-1.4-macosx/ modeles/ Chasseur.h Labyrinthe.h OpenGL-ubuntu.o fltk-1.4-ubuntu/ sons/ Environnement.h Makefile-proto OpenGL-windows.o fltk-1.4-windows/ textures/ FireBall.h Mover.h Sound.h fmod/ Gardien.h OpenGL-linux.o fltk-1.4-linux/ labyrinthe.txt
These directories are already pre-populated with sounds, images and
characters. The code provided as an example as well as the one you don't
have the sources for (OpenGL<system>.o) look for these files in
these directories.
The FMOD library is used for sound on Linux Fedora (it is useless on Ubuntu Linux, Windows and MacOSX, which have sound features built-in).
The Makefile-proto file contains everything you need to compile the prototype with g++ on Linux and MacOSX and with MinGW-w64 on Windows, which you can get at the URL:
https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/installer/mingw-w64-install.exe/downloador get the installer here: mingw-w64-install.exe.
You will also need the make command which you can download at the URL:
http://gnuwin32.sourceforge.net/packages/make.htmClick on the Setup link to the right of "Complete package, except sources" (first link in Download) which will allow you to get an installer.
You can easily get the installer here: make-3.81.exe.
Once mingw and make are installed, remember to update the PATH environment
variable so that they can be easily found by the shell: (last two lines)
To compile, whatever the system, you will just have to say in a terminal the command
makeThis makefile automatically determines your system type. You will get the labh executable for Linux and MacOSX or labh.exe for Windows.
To compile, under Ubuntu 18.04 or newer, you can user the following command:
make OS=Ubuntu
Some useful functions |
Call this function with 'true' if the player has won and
'false' if he has lost. In both cases it will disable the
possibility of shooting for the hunter and it will display the message
'You Win!' or 'You Lose!
displays a message at the top left of the window. This function is of type
'printf', with a variable number of arguments of any type.
void Sound::play (float volume, float pan)
'volume' is a number between 0 and 1 (the bigger it is, the louder it is)
message ("Nombre de gardiens restants: %d", nb_gardiens);
The first argument has the same syntax as for the
'printf' function ('man printf' for more details).
// affiche le nombre de gardiens.
...
message (""); // efface le message précédent.
'pan' is a number between 0 (left) and 1 (right).
Some character models for your guards |
May the Force be with you - Patrick Amar