-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgame.cpp
More file actions
67 lines (57 loc) · 1.16 KB
/
game.cpp
File metadata and controls
67 lines (57 loc) · 1.16 KB
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
#include "game.h"
#include "systemInterface.h"
#include "wave.h"
Game *Game::gameStc;
void Game::Init()
{
#ifndef NOGL
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL);
glEnable(GL_COLOR_MATERIAL);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glClearColor(1,1,1,1);
#endif
font.Load("font");
rects2D.Init();
arrows.Init();
circles.Init();
locKit.Init(currLang);
currMenu=new MainMenu();
currMenu->Init();
InitOggVorbis();
};
bool Game::Update()
{
//flash on start
if(Font::Get2DScreenWidth()<100)
return true;
bool r=true;
if(currMenu)
r=currMenu->Update();
match.Update();
mouse.last=mouse.btn;
return r;
};
//#define GETTIME
void Game::Draw()
{
#ifndef NOGL
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
#endif
match.Draw();
if(currMenu) currMenu->Draw3D();
Font::SetupMatricesFor2D();
glDisable(GL_DEPTH_TEST);
match.Draw2D();
if(currMenu) currMenu->Draw();
glEnable(GL_DEPTH_TEST);
};
void Game::DeInit()
{
gameStc->games.Save();
if(gameStc->currMenu)
delete gameStc->currMenu;
delete gameStc;
}