-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.h
executable file
·107 lines (81 loc) · 2.55 KB
/
settings.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
/*
* File: settings.h
* Author: guilh
*
* Created on 3 de outubro de 2019, 10:00
*/
#ifndef SETTINGS_H
#define SETTINGS_H
#include <fstream>
#include <string>
#include "tinyxml/tinyxml.h"
#include "simplesvg.h"
/**
* The settings for the game application. This settings consists of a path
* for the SVG and a velocity factor.
*/
struct app_settings {
/**
* The path of the SVG file, already concatenated.
*/
std::string filenameSVG;
/**
* The velocity factor. This is used to multiply the velocity at the end
* of the airstrip.
*/
double vel;
double bulletVel;
double eBulletVel;
double eBulletF;
double eVel;
simple_svg* svg = NULL;
simple_svg_line* airstrip = NULL;
simple_svg_circle* arena = NULL;
simple_svg_circle* player = NULL;
vector<simple_svg_circle*> flyingEnemies;
vector<simple_svg_circle*> groundEnemies;
app_settings(const char* filename);
~app_settings();
private:
void read(std::istream& file, const char* filename);
/**
* This is used to find the {@code <jogador>} and
* {@code <arquivoDaArena>} tags within the root.
*
* @param root The {@code <aplicacao>} element.
*/
void read(const TiXmlElement* root);
/**
* Reads the velocity factor from the element.
*
* The element should be {@code <jogador>}.
*
* @param root The {@code <jogador>} element
*/
void readPlayer(const TiXmlElement* root);
/**
* Reads the {@code <arquivoDaArena>}. This reads the SVG path elements
* and concatenate them.
*
* @param root The {@code <arquivoDaArena>} element.
*/
void readSVG(const TiXmlElement* root);
void readEnemy(const TiXmlElement* root);
void debugFields();
void parseSVG();
void findElements();
/**
* Translate the arena with its center to the origin and move all objects
* in the same way. That's done because it helps with the positioning of
* objects and the arena is the reference to the other objects. But instead
* of updating the position of other objects, use make everyone in the SVG
* to be in the world coordinates.
*/
void normalize();
/**
* Translates the circle's center by (dx, dy).
*/
static void translate(int dx, int dy, simple_svg_circle* circle);
static void translate(int dx, int dy, vector<simple_svg_circle*>& circles);
};
#endif /* SETTINGS_H */