Bubba-3D  0.9.0
Awesome game engine!
Dimension.h
1 /*
2  * This file is part of Bubba-3D.
3  *
4  * Bubba-3D is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * Bubba-3D is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with Bubba-3D. If not, see http://www.gnu.org/licenses/.
16  */
17 //
18 // Created by simon on 2016-02-06.
19 //
20 
21 #ifndef SUPER_BUBBA_AWESOME_SPACE_DIMENTION_H
22 #define SUPER_BUBBA_AWESOME_SPACE_DIMENTION_H
23 
28 class Dimension {
29 public:
30  enum DimensionUnit{PIXELS,PERCENTAGE,FILL,WRAP,PERCENTAGE_PLUS_PIXELS};
31 
37  float getSize(float room);
38 
42  static Dimension fromPercentage(float percentage);
43 
47  static Dimension fromPixels(int pixels);
48 
53  static Dimension fromPercentagePlusPixels(float percentage, int pixels);
54 
59  static Dimension fill();
60 
71  static Dimension fill(unsigned int weight);
72 
77  static Dimension wrap();
78 
82  DimensionUnit getUnit();
83 
87  int getWeight();
88 
92  int getPixels();
93 
97  float getPercentage();
98 
102  Dimension();
103 
104 private:
105  Dimension(DimensionUnit unit);
106  DimensionUnit unit;
107  int pixels = 0;
108  int weight = 0;
109  float percentage = 0.0f;
110 
111 };
112 
113 
114 #endif //SUPER_BUBBA_AWESOME_SPACE_DIMENTION_H
float getPercentage()
Definition: Dimension.cpp:78
int getWeight()
Definition: Dimension.cpp:70
float getSize(float room)
Definition: Dimension.cpp:23
static Dimension fromPixels(int pixels)
Definition: Dimension.cpp:39
static Dimension wrap()
Definition: Dimension.cpp:62
static Dimension fill()
Definition: Dimension.cpp:52
static Dimension fromPercentagePlusPixels(float percentage, int pixels)
Definition: Dimension.cpp:45
DimensionUnit getUnit()
Definition: Dimension.cpp:66
int getPixels()
Definition: Dimension.cpp:74
static Dimension fromPercentage(float percentage)
Definition: Dimension.cpp:33