-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGame.h
128 lines (124 loc) · 3.7 KB
/
Game.h
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
//---------------------------------------------------------------------------
#ifndef GameH
#define GameH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include "iv2game.h"
#include <ExtCtrls.hpp>
#include <Menus.hpp>
#include <Buttons.hpp>
#include <MPlayer.hpp>
#include <gl\gl.h>
#include <gl\glu.h>
#include <Graphics.hpp>
#include <mmsystem.hpp>
//---------------------------------------------------------------------------
HDC ghDC;
GLuint base;
GLvoid BuildFont(int height)
{
HFONT font;
HFONT oldfont;
base = glGenLists(256);
font = CreateFont( height,0,0,0,FW_BOLD,FALSE,FALSE,FALSE,
ANSI_CHARSET,OUT_TT_PRECIS,CLIP_DEFAULT_PRECIS,
ANTIALIASED_QUALITY,FF_DONTCARE|DEFAULT_PITCH,
"Times New Roman Cyr");
oldfont = (HFONT)SelectObject(ghDC, font);
wglUseFontBitmaps(ghDC, 32, 256-32, base);
SelectObject(ghDC, oldfont);
DeleteObject(font);
}
GLvoid KillFont(GLvoid)
{
glDeleteLists(base, 256);
}
GLvoid glPrint(const char *fmt, ...)
{
char text[256];
va_list ap;
if (fmt == NULL)
return;
va_start(ap, fmt);
vsprintf(text, fmt, ap);
va_end(ap);
glPushAttrib(GL_LIST_BIT);
glListBase(base - 32);
glCallLists(strlen(text), GL_UNSIGNED_BYTE, text);
glPopAttrib();
}
typedef enum MousePosition {
mpNewGame,
mpSelectUser,
mpResults,
mpHelp,
mpAbout,
mpExit,
mpOptions,
mpNone
}MousePosition;
typedef enum MenuStatus {
msNewGame,
msSelectUser,
msResults,
msHelp,
msAbout,
msExit,
msOptions,
msNone
}MenuStatus;
class TForm1 : public TForm
{
__published: // IDE-managed Components
TPanel *Panel1;
TLabeledEdit *Password;
TBitBtn *BitBtn1;
TComboBox *Users;
TLabel *Label1;
TTimer *Timer1;
TMediaPlayer *MediaPlayer1;
TTimer *Timer2;
void __fastcall FormCreate(TObject *Sender);
void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
void __fastcall FormResize(TObject *Sender);
void __fastcall FormPaint(TObject *Sender);
void __fastcall FormMouseDown(TObject *Sender, TMouseButton Button,
TShiftState Shift, int X, int Y);
void __fastcall FormMouseMove(TObject *Sender, TShiftState Shift,
int X, int Y);
void __fastcall BitBtn1Click(TObject *Sender);
void __fastcall Timer1Timer(TObject *Sender);
void __fastcall FormShow(TObject *Sender);
void __fastcall Timer2Timer(TObject *Sender);
private: // User declarations
void __fastcall SetupTextures(); //Çàãïðóçêà òåêñòóð
void __fastcall SetPixelFormatDescriptor(); //Óñòàíîâêà ïàðìåòðîâ äëÿ ñèñòåìû
void __fastcall SetupLighting(); //Óñòàíîâêà îñâåùåíèÿ
public: // User declarations
__fastcall TForm1(TComponent* Owner);
void __fastcall IdleLoop(TObject*, bool&);
void __fastcall RenderGLScene();
void __fastcall DrawObjects();
Iv2Game Game;
Graphics::TBitmap* bitmap;
GLfloat w, h;
GLsizei size;
GLuint texture[7],background,bon[7][10],twocolor[7][7];
HDC hdc;
HGLRC hrc;
int PixelFormat;
int Herz,W, H;
MousePosition mPos;
MenuStatus mStatus;
bool Play, sound,music;
GLuint startoflist;
HGLRC ghRC;
int numbermusic;
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif