File: SetupManager.h

package info (click to toggle)
blockout2 2.4%2Bdfsg1-4
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 5,260 kB
  • ctags: 939
  • sloc: cpp: 8,725; ansic: 143; makefile: 105
file content (167 lines) | stat: -rw-r--r-- 3,815 bytes parent folder | download | duplicates (4)
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
/*
 	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

#define SETUP_VERSION 5

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
    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 */

    // 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();

    int  pitWidth;
    int  pitHeight;
    int  pitDepth;
    int  blockSet;
    int  animationSpeed;
    int  startLevel;
    BOOL playSound;
    BOOL fullScreen;
    int  windowSize;
    int  transparentFace;
    int  style;
    int  soundType;
    int  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];
    int  httpProxyPort;
    BOOL useHttpProxy;
    int  httpTimeout;

    SCOREREC *scoreList;

};

#endif /*SETUPMANAGERH*/