-
Notifications
You must be signed in to change notification settings - Fork 0
/
openglwindow.hpp
54 lines (43 loc) · 1.21 KB
/
openglwindow.hpp
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
#ifndef OPENGLWINDOW_HPP_
#define OPENGLWINDOW_HPP_
#include <imgui.h>
#include <random>
#include "abcg.hpp"
#include "./bullets/bullets.hpp"
#include "./ship/ship.hpp"
#include "./enemy/enemy_ship.hpp"
const float ENEMY_SHIP_START_POSITION = 0.90f;
const float ENEMY_SHIP_VERTICAL_DELTA = 0.20f;
const int ENEMY_SHIP_QUANTITY = 3;
class OpenGLWindow : public abcg::OpenGLWindow {
protected:
void resizeGL(int width, int height) override;
void handleEvent(SDL_Event& event) override;
void initializeGL() override;
void terminateGL() override;
void paintGL() override;
void paintUI() override;
private:
GLuint m_objectsProgram{};
int m_lastmousepos{300};
int m_viewportHeight{};
int m_viewportWidth{};
abcg::ElapsedTimer m_restartWaitTimer;
std::list<EnemyShip> m_enemies;
GameData m_gameData;
Bullets m_bullets;
ImFont* m_font{};
Ship m_ship;
void handleMouseButtonDown(SDL_Keycode keyCode);
void handleMouseButtonUp(SDL_Keycode keyCode);
void handleKeyDown(SDL_Keycode keyCode);
void handleKeyUp(SDL_Keycode keyCode);
void handleMouseMotion();
void verifyEnemyLife();
void verifyGameOver();
void verifyShot();
void verifyWin();
void restart();
void update();
};
#endif