Skip to content

Commit 4d57bba

Browse files
committed
Merge pull request #102 from GearChicken/release/1.0
Updated headers in include/
2 parents 659678e + 8c295e5 commit 4d57bba

22 files changed

+519
-496
lines changed

include/MINX/Game.hpp

+24-26
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ freely, subject to the following restrictions:
2424
>
2525
*/
2626

27+
#ifndef MINX_GAME_HPP_
28+
#define MINX_GAME_HPP_
29+
2730
#include "API.hpp"
2831

2932
#include <ft2build.h>
@@ -47,54 +50,51 @@ freely, subject to the following restrictions:
4750
#include <thread>
4851
#include <mutex>
4952

50-
#ifndef MINX_GAME_HPP_
51-
#define MINX_GAME_HPP_
52-
5353
namespace MINX
5454
{
5555
/** The class that handles everything.
56-
* When using the library, your code will probably construct, Initialize() and Run() your subclass of Game.
56+
* When using the library, your code will probably construct and Run() your subclass of Games
5757
*/
5858
class MINX_API Game
5959
{
6060
public:
61-
/** The constructor, which handles some of the initialization code for the Game.
61+
/** The constructor, which handles some of the initialization code for the Game
6262
*/
6363
Game();
6464

65-
/** This handles the rest of the initialization code for the game.
65+
/** This handles the rest of the initialization code for the game
6666
*/
6767
virtual void Initialize();
6868

69-
/** Loads content used by the game.
69+
/** Loads content used by the game
7070
*/
7171
virtual void LoadContent();
7272

73-
/** Updates the game state.
74-
* Should be extended when you create a subclass of Game.
75-
* @param gameTime the GameTime to use when updating.
73+
/** Updates the game state
74+
* Should be extended when you create a subclass of Game
75+
* @param gameTime the GameTime to use when updating
7676
*/
7777
virtual void Update(GameTime* gameTime);
7878

79-
/** Unloads content used by the game.
79+
/** Unloads content used by the game
8080
*/
8181
virtual void UnloadContent();
8282

83-
/** Draws the state of the game every frame.
84-
* This method is called by a different thread than Update(), so it is ok to use sleeps in Update() and not worry about freezing the drawing, or vice versa.
85-
* @param gameTime the GameTime to use when drawing.
83+
/** Draws the state of the game every frame
84+
* This method is called by a different thread than Update(), so it is ok to use sleeps in Update() and not worry about freezing the drawing, or vice versa
85+
* @param gameTime the GameTime to use when drawing
8686
*/
8787
virtual void Draw(GameTime* gameTime);
8888

89-
/** Handles Update()ing, Draw()ing, and event handling.
89+
/** Handles Update()ing, Draw()ing, and event handling
9090
*/
9191
void Run();
9292

93-
/** A pointer to the window used by the game.
93+
/** A pointer to the window used by the game
9494
*/
9595
Graphics::GameWindow* gameWindow;
9696

97-
/** A pointer to a vector of pointers to the GameComponents used in the game.
97+
/** A pointer to a vector of pointers to the GameComponents used in the game
9898
*/
9999
std::vector<GameComponent*>* Components;
100100

@@ -117,21 +117,19 @@ namespace MINX
117117
*/
118118
bool isRunning;
119119

120-
/** Set's the Game's RenderTarget and clears to the clearColor.
121-
*/
122-
void SetRenderTarget(Graphics::RenderTarget* target, Graphics::Color clearColor);
123-
124-
/** Set's the Game's RenderTarget and clears to cornflower blue.
120+
/** Set's the Game's RenderTarget and clears to the clearColor
121+
* @param target The RenderTarget to render to, defaults to NULL, if null the entire window is used
122+
* @param clearColor The color to clear the RenderTarget to, defaults to CornflowerBlue
125123
*/
126-
void SetRenderTarget(Graphics::RenderTarget* target);
124+
void SetRenderTarget(Graphics::RenderTarget* target = NULL, Graphics::Color clearColor = Graphics::Color::CornflowerBlue);
127125

128126
protected:
129127
/** An instance of freetype used to draw text
130128
*/
131129
FT_Library freeTypeLibrary;
132130

133131
private:
134-
/** A pointer to the GameTime being used by the game.
132+
/** A pointer to the GameTime being used by the game
135133
*/
136134
GameTime* gameTime;
137135

@@ -155,8 +153,8 @@ namespace MINX
155153
*/
156154
static Graphics::RenderTarget* activeRenderTarget;
157155

158-
friend class MINX::Graphics::Font;
159-
friend class MINX::Graphics::TextureBatch;
156+
friend class MINX::Graphics::Font;
157+
friend class MINX::Graphics::TextureBatch;
160158
};
161159
}
162160
#endif

include/MINX/GameComponent.hpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ freely, subject to the following restrictions:
2424
>
2525
*/
2626

27+
#ifndef MINX_GAMECOMPONENT_HPP_
28+
#define MINX_GAMECOMPONENT_HPP_
29+
2730
#include "API.hpp"
2831

2932
#include "GameTime.hpp"
3033

31-
#ifndef MINX_GAMECOMPONENT_HPP_
32-
#define MINX_GAMECOMPONENT_HPP_
33-
3434
namespace MINX
3535
{
3636
class MINX_API Game; //forward declaration to avoid circular dependency problems
@@ -41,28 +41,28 @@ namespace MINX
4141
{
4242
public:
4343
/** Creates the GameComponent
44-
* @param attachTo A pointer to the Game to attach to.
44+
* @param attachTo A pointer to the Game to attach to
4545
*/
4646
GameComponent(Game* attachTo);
4747

4848
/** Destructs a GameComponent
4949
*/
5050
virtual ~GameComponent();
5151

52-
/** Initializes the GameComponent.
52+
/** Initializes the GameComponent
5353
*/
5454
virtual void Initialize();
5555

56-
/** Update()s the GameComponent.
57-
* @param gameTime the GameTime to update the GameComponent with.
56+
/** Update()s the GameComponent
57+
* @param gameTime the GameTime to update the GameComponent with
5858
*/
5959
virtual void Update(GameTime* gameTime);
6060

61-
/** Whether or not this GameComponent is enabled.
61+
/** Whether or not this GameComponent is enabled
6262
*/
6363
bool enabled;
6464

65-
/** A pointer to the Game that this GameComponent is attached to.
65+
/** A pointer to the Game that this GameComponent is attached to
6666
*/
6767
Game* game;
6868
};

include/MINX/GameTime.hpp

+8-4
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ freely, subject to the following restrictions:
2424
>
2525
*/
2626

27+
#ifndef MINX_GAMETIME_HPP_
28+
#define MINX_GAMETIME_HPP_
29+
2730
#include "API.hpp"
2831

2932
#include <thread>
3033
#include <chrono>
3134
#include <GL/glew.h>
3235
#include <GLFW/glfw3.h>
3336

34-
#ifndef MINX_GAMETIME_HPP_
35-
#define MINX_GAMETIME_HPP_
36-
3737
namespace MINX
3838
{
3939
class MINX_API Game;
@@ -69,8 +69,12 @@ namespace MINX
6969
float GetDeltaTimeSecondsF();
7070

7171
/** Limits the updates per second of the current thread by delaying
72+
* @param desiredFPS the FPS to limit to
7273
*/
73-
inline void LimitFPS(unsigned int desiredFPS){std::this_thread::sleep_for(std::chrono::milliseconds(static_cast<long>(1000/desiredFPS-(GetDeltaTimeSeconds()))));}
74+
inline void LimitFPS(unsigned int desiredFPS)
75+
{
76+
std::this_thread::sleep_for(std::chrono::milliseconds(static_cast<long>(1000/desiredFPS-(GetDeltaTimeSeconds()))));
77+
}
7478

7579
private:
7680
/** Constructs a GameTime

include/MINX/Graphics/Color.hpp

+16-17
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
21
/*
32
# MINX
43
54
Copyright (c) 2013-2014 Liam Middlebrook, Benjamin Pylko
65
76
This software is provided 'as-is', without any express or implied
87
warranty. In no event will the authors be held liable for any damages
9-
arising from the use of this software.
8+
arising from the use of this software
109
1110
Permission is granted to anyone to use this software for any purpose,
1211
including commercial applications, and to alter it and redistribute it
@@ -15,13 +14,13 @@ freely, subject to the following restrictions:
1514
> 1\. The origin of this software must not be misrepresented; you must not
1615
> claim that you wrote the original software. If you use this software
1716
> in a product, an acknowledgment in the product documentation would be
18-
> appreciated but is not required.
17+
> appreciated but is not required
1918
>
2019
> 2\. Altered source versions must be plainly marked as such, and must not be
21-
> misrepresented as being the original software.
20+
> misrepresented as being the original software
2221
>
2322
> 3\. This notice may not be removed or altered from any source
24-
> distribution.
23+
> distribution
2524
>
2625
*/
2726

@@ -34,39 +33,39 @@ namespace MINX
3433
{
3534
namespace Graphics
3635
{
37-
/** A struct representing a color.
36+
/** A struct representing a color
3837
*/
3938
struct MINX_API Color
4039
{
41-
/** The red component of the color.
40+
/** The red component of the color
4241
*/
4342
double R;
4443

45-
/** The green component of the color.
44+
/** The green component of the color
4645
*/
4746
double G;
4847

49-
/** The blue component of the color.
48+
/** The blue component of the color
5049
*/
5150
double B;
5251

53-
/** The alpha component of the color.
52+
/** The alpha component of the color
5453
*/
5554
double A;
5655

5756
/** Constructs the Color with a default value of White
5857
*/
5958
Color();
6059

61-
/** Constructs a color with the given red, green, blue, and alpha values.
62-
*/
63-
Color(double r, double g, double b, double a);
64-
65-
/** Constructs a color with the given red, green, and blue values.
60+
/** Constructs a color with the given red, green, blue, and alpha values
61+
* @param r The red value of the color
62+
* @param g The green value of the color
63+
* @param b The blue value of the color
64+
* @param a The alpha (opacity) value of the color, defaults to 255.0 (opaque)
6665
*/
67-
Color(double r, double g, double b);
66+
Color(double r, double g, double b, double a = 255.0);
6867

69-
/** Tests equality between two Colors.
68+
/** Tests equality between two Colors
7069
*/
7170
bool operator==(const Color& compareTo);
7271

include/MINX/Graphics/Font.hpp

+24-24
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
21
/*
32
# MINX
43
54
Copyright (c) 2013-2014 Liam Middlebrook, Benjamin Pylko
65
76
This software is provided 'as-is', without any express or implied
87
warranty. In no event will the authors be held liable for any damages
9-
arising from the use of this software.
8+
arising from the use of this software
109
1110
Permission is granted to anyone to use this software for any purpose,
1211
including commercial applications, and to alter it and redistribute it
@@ -15,15 +14,15 @@ freely, subject to the following restrictions:
1514
> 1\. The origin of this software must not be misrepresented; you must not
1615
> claim that you wrote the original software. If you use this software
1716
> in a product, an acknowledgment in the product documentation would be
18-
> appreciated but is not required.
17+
> appreciated but is not required
1918
>
2019
> 2\. Altered source versions must be plainly marked as such, and must not be
21-
> misrepresented as being the original software.
20+
> misrepresented as being the original software
2221
>
2322
> 3\. This notice may not be removed or altered from any source
24-
> distribution.
23+
> distribution
2524
>
26-
*/
25+
*/
2726

2827
#ifndef MINX_FONT_HPP_
2928
#define MINX_FONT_HPP_
@@ -56,43 +55,44 @@ namespace MINX
5655
Font(Game* gameHandle, char* fileLocation, GLuint shaderProgram);
5756

5857
/** Renders Text Onto the Screen using a string from the C++ standard library
59-
* @param text The text to render to the screen.
60-
* @param x The X component of the screen to draw the text to.
61-
* @param y The Y component of the screen to draw the text to.
62-
* @param fontSixe The size in points (pt.) to draw the font.
58+
* @param text The text to render to the screen
59+
* @param x The X component of the screen to draw the text to
60+
* @param y The Y component of the screen to draw the text to
61+
* @param fontSixe The size in points (pt.) to draw the font
6362
*/
6463
void RenderText(std::string text, float x, float y, int fontSize);
6564

6665
/** Renders Text Onto the Screen using a c-string (char*)
67-
* @param text The text to render to the screen.
68-
* @param x The X component of the screen to draw the text to.
69-
* @param y The Y component of the screen to draw the text to.
70-
* @param fontSixe The size in points (pt.) to draw the font.
66+
* @param text The text to render to the screen
67+
* @param x The X component of the screen to draw the text to
68+
* @param y The Y component of the screen to draw the text to
69+
* @param fontSixe The size in points (pt.) to draw the font
7170
*/
7271
void RenderText(const char* text, float x, float y, int fontSize);
7372

7473
/** Renders Text Onto the Screen using a string from the C++ standard library
75-
* @param text The text to render to the screen.
76-
* @param x The X component of the screen to draw the text to.
77-
* @param y The Y component of the screen to draw the text to.
78-
* @param fontSixe The size in points (pt.) to draw the font.
74+
* @param text The text to render to the screen
75+
* @param x The X component of the screen to draw the text to
76+
* @param y The Y component of the screen to draw the text to
77+
* @param fontSixe The size in points (pt.) to draw the font
7978
*/
8079
void RenderText(std::string text, float x, float y, int fontSize, Color color);
8180

8281
/** Renders Text Onto the Screen using a c-string (char*)
83-
* @param text The text to render to the screen.
84-
* @param x The X component of the screen to draw the text to.
85-
* @param y The Y component of the screen to draw the text to.
86-
* @param fontSixe The size in points (pt.) to draw the font.
82+
* @param text The text to render to the screen
83+
* @param x The X component of the screen to draw the text to
84+
* @param y The Y component of the screen to draw the text to
85+
* @param fontSize The size in points (pt.) to draw the font
8786
*/
8887
void RenderText(const char* text, float x, float y, int fontSize, Color color);
8988

9089
/** Gets the size of the text if it were to be rendered
91-
* @param text The text to check the size of.
92-
* @param fontSize The size in points (pt.) to check the size of.
90+
* @param text The text to check the size of
91+
* @param fontSize The size in points (pt.) to check the size of
9392
* @return The Size of the Text as a Vector2 with the width as the X component and the height as the Y component
9493
*/
9594
Vector2 TextSize(const char *text, int fontSize);
95+
9696
private:
9797
float getMaxHeightGap(const char *text, int fontSize);
9898
GLuint shaderProgram;

0 commit comments

Comments
 (0)