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