miceamaze-4.2.1/0000755000175000017500000000000012470627310013211 5ustar almachaalmachamiceamaze-4.2.1/LICENSE.txt0000644000175000017500000000366612470627310015047 0ustar almachaalmachaCopyright (c) 2012-2014, Raphael CHAMPEIMONT All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. The eagle images were created from images in OpenClipart (public domain): http://openclipart.org/detail/16226/bald-eagle-by-gerald_g-16226 http://openclipart.org/detail/168358/eagle-silhouettes-by-mathec The music files DST-Azum.ogg and DST-DistantMessage.ogg are from http://www.nosoapradio.us/ They are licensed under the Creative Commons Attribution License: http://creativecommons.org/licenses/by/3.0/ The music file Dj_Rkod_Pulse_(George_Ellinas_Remix).ogg is from http://ccmixter.org/files/George_Ellinas/14073- License: http://creativecommons.org/licenses/by/3.0/ All mazes ("mazes" directory in "data") are in the public domain. miceamaze-4.2.1/miceamaze.desktop0000644000175000017500000000027712470627310016545 0ustar almachaalmacha[Desktop Entry] Name=MiceAmaze Type=Application Comment=video game with mice in a maze Exec=miceamaze Terminal=false Categories=Game;ArcadeGame; Icon=miceamaze Keywords=Game;Maze;Mice;Snake; miceamaze-4.2.1/man/0000755000175000017500000000000012470627310013764 5ustar almachaalmachamiceamaze-4.2.1/man/miceamaze.60000644000175000017500000000104112470627310016002 0ustar almachaalmacha.TH "miceamaze" "6" "" "miceamaze" "" .SH "NAME" MiceAmaze \- video game with mice in a maze .SH "SYNOPSIS" . .B miceamaze [\fIOPTIONS\fR] . .SH "DESCRIPTION" MiceAmaze is a free video game that features a maze with mice and snakes. The goal is to bring the most mice to your house by placing arrows on the maze floor. But beware the snakes that want to eat them! .SH "OPTIONS" . .TP .B \--window start in window mode (not fullscreen) .TP .B \--fullscreen start in fullscreen mode . .SH "COPYRIGHT" . Copyright (c) 2012, Raphael CHAMPEIMONT . miceamaze-4.2.1/INSTALL.txt0000644000175000017500000000145212470627310015062 0ustar almachaalmacha============================================= HOW TO COMPILE AND INSTALL MICEAMAZE ON LINUX ============================================= You need: - GCC C++ compiler and GNU Make - OpenGL (with headers) - SDL (with headers) - SDL_mixer (with headers) - SOIL (with headers) - QuesoGLC (with headers) - "DejaVu" font installed - rsvg (only the "rsvg-convert" command is used) - ImageMagick (only the "convert" command is used) When "with headers" is specified, you need the package with the "-dev" suffix (called like this in most distributions). To compile and run without installing: make ./miceamaze To compile and install (requires administrator privileges): make sudo make install Then simply enter "miceamaze" in a terminal or search for MiceAmaze in your applications menu to play the game. miceamaze-4.2.1/Makefile0000644000175000017500000000406012470627310014651 0ustar almachaalmachaUNAME := $(shell uname) INSTALL_ICONS=1 PREFIX=/usr/local BINDIR=${PREFIX}/bin DATAPATH=${PREFIX}/share/miceamaze MANPATH=${PREFIX}/share/man/man6 PIXPATH=${PREFIX}/share/pixmaps MENUPATH=${PREFIX}/share/applications ICONPATH=${PREFIX}/share/icons/hicolor/64x64/apps CXXFLAGS+=-Wall -DDATAPATH=\"${DATAPATH}\" $(shell sdl-config --cflags) LDLIBS=-Wall -lGLC -lSOIL $(shell sdl-config --libs) -lSDL_mixer ifeq ($(UNAME), Darwin) LDLIBS+=-framework OpenGL -lm else LDLIBS+=-lGL -lm endif SVGCOMMAND=rsvg-convert SVGOPTIONS=-w 500 OBJS := $(patsubst src/%.cpp,src/%.o,$(wildcard src/*.cpp)) BUILTDATA := data/images/eagle.png data/images/eagle2.png all: miceamaze miceamaze.xpm miceamaze.png miceamaze.6.gz $(BUILTDATA) miceamaze: $(OBJS) $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $(OBJS) $(LDLIBS) -o $@ miceamaze.xpm: data/images/mouse.png convert -scale 32x32 $^ $@ miceamaze.png: data/images/mouse.png convert -scale 64x64 $^ +set date:create +set date:modify -define png:exclude-chunk=time $@ miceamaze.6.gz: man/miceamaze.6 gzip -nc $^ > $@ data/images/eagle2.png: src/data-sources/eagle2.svg $(SVGCOMMAND) $(SVGOPTIONS) $^ >$@ data/images/eagle.png: src/data-sources/eagle.svg $(SVGCOMMAND) $(SVGOPTIONS) $^ >$@ clean: rm -f miceamaze miceamaze.xpm miceamaze.png miceamaze.6.gz src/*.o $(BUILTDATA) install: all install -d -m 755 ${DESTDIR}${DATAPATH} cp -R -L data/* ${DESTDIR}${DATAPATH}/ install -D -m 755 miceamaze ${DESTDIR}${BINDIR}/miceamaze install -D -m 644 miceamaze.6.gz ${DESTDIR}${MANPATH}/miceamaze.6.gz ifeq ($(INSTALL_ICONS), 1) install -D -m 644 miceamaze.desktop ${DESTDIR}${MENUPATH}/miceamaze.desktop install -D -m 644 miceamaze.png ${DESTDIR}${ICONPATH}/miceamaze.png install -D -m 644 miceamaze.xpm ${DESTDIR}${PIXPATH}/miceamaze.xpm endif uninstall: rm -rf ${DESTDIR}${DATAPATH} rm -f ${DESTDIR}${BINDIR}/miceamaze rm -f ${DESTDIR}${MANPATH}/miceamaze.6.gz ifeq ($(INSTALL_ICONS), 1) rm -f ${DESTDIR}${MENUPATH}/miceamaze.desktop rm -f ${DESTDIR}${ICONPATH}/miceamaze.png rm -f ${DESTDIR}${PIXPATH}/miceamaze.xpm endif re: clean all miceamaze-4.2.1/ChangeLog.txt0000644000175000017500000000347212470627310015607 0ustar almachaalmachaNew in version 4.2: * Fix title screen for 16:9 screens New in version 4.1: * More FPS in menus New in version 4.0: * New special mouse: the "drill mouse" destroys walls * Only houses from selected players are present in the maze * Better FPS setting: your computer heats less while playing the game New in version 3.0: * Sick mice * New music * A.I. now sends snakes to other's houses New in version 2.1: * Better AI: now uses snakes New in version 2.0: * Make new icons, Windows installer, cleanup New in version 1.11: * Add music New in version 1.10: * Fix OpenGL error 1280 in menu "about" and "how to play" on some computers (caused by trying to render an empty string) * New mouse image * Fix image ratio for mice New in version 1.9: * Change FPS options to 100, 200 and MAX (default is 200) New in version 1.8: * New "How to play" screen * Windows version: Now an installer is provided instead of a ZIP file New in version 1.7.2: * Linux version: Makefile fixes New in version 1.7: * New eagle SVG images New in version 1.6.2: * Linux version: Add ChangeLog * Linux version: Remove SOIL directory New in version 1.6.1 * Linux version: Render fonts at runtime using libglc * Linux version: Depend on ttf-dejavu-core instead of providing the font * Linux version: Install Debian menu and Freedesktop menu entries * Linux version: Depend on libsoil package instead of compiling it * Linux version: Fix Makefile * Linux version: Remove useless data files * Clarify data file licenses and add license to all source files * Linux version: Support getpwuid() for getting home directory * Linux version: Add watch file New in version 1.5 * Windows version: Render fonts at runtime using Windows font outlines miceamaze-4.2.1/src/0000755000175000017500000000000012470627310014000 5ustar almachaalmachamiceamaze-4.2.1/src/MenuSelectMaze.cpp0000644000175000017500000001760112470627310017372 0ustar almachaalmacha// Copyright (c) 2012, Raphael CHAMPEIMONT // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE // COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED // OF THE POSSIBILITY OF SUCH DAMAGE. #include "MenuSelectMaze.h" #include "Program.h" #include "RenderFlatText.h" using namespace std; int MenuSelectMaze::page = 0; MenuSelectMaze::MenuSelectMaze() : cursor(-1) { } MenuSelectMaze::~MenuSelectMaze() { for (unsigned k=0; kload(path); } void MenuSelectMaze::translateForMazeRender(int i, int j) { glLoadIdentity(); glTranslatef(-0.52 + 0.6*j, 0.4-0.8*i, 0); glScalef(0.35, 0.35, 1); } void MenuSelectMaze::prepareMazesRender() { glLoadIdentity(); int m = 0; for (int i=0; i<2; i++) { for (int j=0; j<3; j++) { if (m < (int) mazes.size()) { translateForMazeRender(i, j); glTranslatef(0, -0.03, 1); mazes[m]->prepareRender(NULL); } m++; } } } void MenuSelectMaze::prepareRender() { glLoadIdentity(); cursor.prepareRender(); glClearColor(0.2, 0.1, 0, 0); prepareMazesRender(); initVideoCounter = Program::getInstance()->initVideoCounter; } void MenuSelectMaze::searchMazes() { vector files = Functions::listFiles(Program::getInstance()->dataPath + "/mazes"); sort(files.begin(), files.end()); for (unsigned k=0; kdataPath + "/mazes/" + file); } } if (page*6 >= (int) availableMazes.size()) { page = 0; } } // Load mazed but don't prepare render void MenuSelectMaze::loadMazes() { // Clear currently loaded mazed for (unsigned k=0; k= (int) availableMazes.size()) { lastMaze = availableMazes.size() - 1; } for (int m=firstMaze; m<=lastMaze; m++) { addMaze(availableMazes[m]); } } // Differs from loadMazes by the fact that we need to prepare render again void MenuSelectMaze::loadNewMazes() { loadMazes(); prepareMazesRender(); } void MenuSelectMaze::updatePagesButtons() { for (int b=0; b<2; b++) { buttons[b].shown = ((b == 0 && page > 0) || (b == 1 && (page+1)*6 < (int) availableMazes.size())); } } void MenuSelectMaze::run() { buttons.push_back(Button(-0.98, -0.07, 0.10, 0.15, "<")); buttons.push_back(Button(0.87, -0.07, 0.10, 0.15, ">")); buttons.push_back(Button(-0.6, -0.97, 1.2, 0.12, "Back", 0.7)); int pressedButton = -1; // place cursor at correct position cursor.setFromMouse(); // search for available mazes searchMazes(); // load 6 first mazes loadMazes(); // Prepare rendering prepareRender(); while (true) { if (initVideoCounter != Program::getInstance()->initVideoCounter) { // Video was reinitialized, so we need to resend display lists prepareRender(); } // Rendering glClear(GL_COLOR_BUFFER_BIT); // show FPS counter Program::getInstance()->fps->renderInMenu(); // render mazes int sel = -1; { const float x0 = -0.888672 + 0.03; const float y0 = 0.729167; const float w = -0.390625 - (-0.888672); const float h = 0.0703125 - y0; const float dx = -0.285156 - (-0.888672); const float dy = -0.0729166 - y0; int m = 0; for (int i=0; i<2; i++) { for (int j=0; j<3; j++) { if (cursor.x > x0 + j*dx && cursor.x < x0 + j*dx + w && cursor.y < y0 + i*dy && cursor.y > y0 + i*dy + h) { if (m < (int) mazes.size()) { sel = m; } } m++; } } } { int m = 0; for (int i=0; i<2; i++) { for (int j=0; j<3; j++) { if (sel == m) { translateForMazeRender(i, j); glTranslatef(-0.2475, 0, 0); glScalef(0.8, 1, 1); glColor3f(.3, 0, .7); Functions::drawSquare(); } if (m < (int) mazes.size()) { // show maze mazes[m]->render(NULL); // show maze name translateForMazeRender(i, j); glTranslatef(-0.2475, -1.2, 0); glScalef(0.2, 0.2, 1); glColor3f(1, 1, 1); RenderFlatText::render(mazes[m]->name, 0); } m++; } } } // render title glLoadIdentity(); glTranslatef(0, .8, 0); glColor3f(1, 1, 1); glScalef(0.15, 0.15, 1); RenderFlatText::render("Select maze", 0); // make next page and previous page button exist only if needed updatePagesButtons(); // render buttons for (int b=0; b<(int) buttons.size(); b++) { glLoadIdentity(); if (pressedButton == b) { buttons[b].render(2); } else { buttons[b].render(buttons[b].over(cursor.x, cursor.y)); } } // render cursor cursor.render(); SDL_GL_SwapBuffers(); // Event handling SDL_Event event; while (SDL_PollEvent(&event)) { Program::getInstance()->generalEventHandler(&event); switch (event.type) { case SDL_MOUSEMOTION: cursor.setFromWindowXY(event.motion.x, event.motion.y); break; case SDL_MOUSEBUTTONDOWN: if (event.button.button == SDL_BUTTON_LEFT || event.button.button == SDL_BUTTON_RIGHT) { for (int b=0; b<(int) buttons.size(); b++) { if (buttons[b].over(cursor.x, cursor.y)) { pressedButton = b; } } } break; case SDL_MOUSEBUTTONUP: if (event.button.button == SDL_BUTTON_LEFT || event.button.button == SDL_BUTTON_RIGHT) { if (sel >= 0) { Program::getInstance()->scene = 2; Program::getInstance()->mazeToLoad = mazePaths[sel]; return; } if (pressedButton >= 0) { if (buttons[pressedButton].over(cursor.x, cursor.y)) { if (pressedButton == 0) { page--; loadNewMazes(); // we need to go directly to verify if <> buttons should exist updatePagesButtons(); } else if (pressedButton == 1) { page++; loadNewMazes(); updatePagesButtons(); } else if (pressedButton == 2) { Program::getInstance()->scene = 0; return; } } pressedButton = -1; } } break; case SDL_KEYUP: if (event.key.keysym.sym == SDLK_ESCAPE) { Program::getInstance()->scene = 0; return; } break; } } // Count FPS and wait some time before rendering next frame Program::getInstance()->fps->waitInMenu(); } } miceamaze-4.2.1/src/MenuPlayers.h0000644000175000017500000000355012470627310016420 0ustar almachaalmacha// Copyright (c) 2012, Raphael CHAMPEIMONT // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE // COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED // OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef MENUPLAYERS_H_ #define MENUPLAYERS_H_ #include "Program.h" using namespace std; class MenuPlayers { int initVideoCounter; GLuint fixedObjectsDisplayList; bool hasDisplayList; vector