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 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
|
/*
File: SetupManager.h
Description: Setup management
Program: BlockOut
Author: Jean-Luc PONS
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#include "Types.h"
#ifndef SETUPMANAGERH
#define SETUPMANAGERH
#ifdef WINDOWS
#ifdef WIN64
#define APP_VERSION "BlockOut 2.5 (x64)"
#else
#define APP_VERSION "BlockOut 2.5 (x86)"
#endif
#else
#if __x86_64__ || __ppc64__
#define APP_VERSION "BlockOut 2.5 (x64)"
#else
#define APP_VERSION "BlockOut 2.5 (x86)"
#endif
#endif
#define SETUP_VERSION 6
class SetupManager {
public:
SetupManager();
// Pit dimension
void SetPitWidth(int width);
int GetPitWidth();
void SetPitHeight(int height);
int GetPitHeight();
void SetPitDepth(int depth);
int GetPitDepth();
// Block set
void SetBlockSet(int set);
int GetBlockSet();
// Starting level
void SetStartingLevel(int level);
int GetStartingLevel();
// Animation speed
void SetAnimationSpeed(int speed);
int GetAnimationSpeed();
float GetAnimationTime(); /* in seconds */
// Names
const char *GetName();
const char *GetBlockSetName();
// Sound
void SetSound(BOOL play);
BOOL GetSound();
// High score
int InsertHighScore(SCOREREC *score,SCOREREC **added);
void GetHighScore(SCOREREC *hScore);
int GetHighScore();
// Transparent face
void SetTransparentFace(int transparent);
int GetTransparentFace();
// Return configuration id
int GetId();
// Save high score
void SaveHighScore();
// Save setup
void WriteSetup();
// Screen options
void SetFullScreen(BOOL isFull);
BOOL GetFullScreen();
void SetWindowSize(int size);
int GetWindowSize();
int GetWindowWidth();
int GetWindowHeight();
const char *GetResName(int res);
// Game style
void SetStyle(int style);
int GetStyle();
const char *GetStyleName();
// Game sound
void SetSoundType(int stype);
int GetSoundType();
const char *GetSoundTypeName();
// Frame limiter
void SetFrLimiter(int fLimit);
int GetFrLimiter();
const char *GetFrLimitName();
float GetFrLimitTime(); /* seconds */
// Line width
void SetLineWidth(int width);
int GetLineWidth();
float GetLineRadius(); /* Actual line radius */
// Control keys
BYTE GetKRx1();
BYTE GetKRy1();
BYTE GetKRz1();
BYTE GetKRx2();
BYTE GetKRy2();
BYTE GetKRz2();
void SetKRx1(BYTE key);
void SetKRy1(BYTE key);
void SetKRz1(BYTE key);
void SetKRx2(BYTE key);
void SetKRy2(BYTE key);
void SetKRz2(BYTE key);
void ResetToQwerty();
void ResetToAzerty();
// Http Config
void SetHttpHome(char *home);
char *GetHttpHome();
void SetProxyName(char *name);
char *GetProxyName();
void SetProxyPort(int port);
int GetProxyPort();
void SetUseProxy(BOOL enable);
BOOL GetUseProxy();
void SetTimeout(int timeout);
int GetTimeout();
private:
int Saturate(int v,int min,int max);
BOOL Check(int w,int h,int d,int s);
void CleanHighScore(int id);
void LoadHighScore();
void LoadSetup();
void ReadScoreItem(FILE *f,SCOREREC *dest);
void WriteScoreItem(FILE *f,SCOREREC *dest);
int32 pitWidth;
int32 pitHeight;
int32 pitDepth;
int32 blockSet;
int32 animationSpeed;
int32 startLevel;
BOOL playSound;
BOOL fullScreen;
int32 windowSize;
int32 transparentFace;
int32 style;
int32 soundType;
int32 frLimit;
BYTE keyRx1; // Q
BYTE keyRy1; // W
BYTE keyRz1; // E
BYTE keyRx2; // A
BYTE keyRy2; // S
BYTE keyRz2; // D
char httpHome[256];
char httpProxy[256];
int32 httpProxyPort;
BOOL useHttpProxy;
int32 httpTimeout;
int32 lineWidth;
SCOREREC *scoreList;
};
#endif /*SETUPMANAGERH*/
|