1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
|
// Copyright 2005 by Anthony Liekens anthony@liekens.net
#ifndef SETTINGS_H
#define SETTINGS_H
#include <vector>
#include <string>
#include "lisp/lisp.hpp"
#include "lisp/writer.hpp"
#include "timer.h"
#include "input.h"
class Settings {
private:
static const int REQUIRED_CONFIG_FILE_VERSION = 2;
static const int CURRENT_CONFIG_FILE_VERSION = 2;
static std::string fileName;
static int screenWidth, screenHeight, gameWidth, gameHeight, gameOffsetX;
static bool fullscreen;
static bool enemyVisibility;
static int numberOfPlanets;
static int numberOfComputerPlayers;
static Input inputMap[GA_COUNT][2];
static void writeInput(lisp::Writer *, const char *, GameAction);
static void readInput(const lisp::Lisp *, const char *, GameAction);
static void setupDefaultActionMap();
static void set(GameAction, InputType, int, int, int);
/** Iterates through the input mapping and unsets all
* where the given input occurs.
*
* This makes sure an input is not bound multiple times.
*/
static void unsetDuplicates(GameAction, InputType, int, int, int);
static std::string getConfigFilePath();
static bool fileExists(const std::string&);
static std::string getInputAsString(Input &);
public:
static void init();
static void setEnemyVisibility(bool b) { enemyVisibility = b; }
static bool getEnemyVisibility() { return enemyVisibility; }
static void setFullscreen( bool b ) { fullscreen = b; }
static bool getFullscreen() { return fullscreen; }
static void setScreenSize(int, int);
static int getScreenWidth() { return screenWidth; }
static int getScreenHeight() { return screenHeight; }
static int getGameWidth() { return gameWidth; }
static int getGameHeight() { return gameHeight; }
static int getGameOffsetX() { return gameOffsetX; }
static int getNumberOfPlanets() { return numberOfPlanets; }
static int setNumberOfPlanets(int p) { numberOfPlanets = p; }
static int getNumberOfComputerPlayers() { return numberOfComputerPlayers; }
static int setNumberOfComputerPlayers(int p) { numberOfComputerPlayers = p; }
static Input getInput(GameAction);
static Input getAltInput(GameAction);
static void store();
static std::string getAsString(GameAction);
static void printInput(char *);
static void set(GameAction, Input &);
static void unset(GameAction);
};
#endif
|