Merged default into minor

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2014-08-07 18:10:19 -03:00
52 changed files with 861 additions and 579 deletions
+60 -59
View File
@@ -54,50 +54,6 @@ namespace graphics
namespace opengl
{
// During display mode changing, certain
// variables about the OpenGL context are
// lost.
struct DisplayState
{
// Colors.
Color color;
Color backgroundColor;
// Blend mode.
Graphics::BlendMode blendMode;
// Line.
Graphics::LineStyle lineStyle;
Graphics::LineJoin lineJoin;
// Point.
float pointSize;
// Scissor.
bool scissor;
OpenGL::Viewport scissorBox;
// Color mask.
bool colorMask[4];
bool wireframe;
// Default values.
DisplayState()
{
color.set(255,255,255,255);
backgroundColor.set(0, 0, 0, 255);
blendMode = Graphics::BLEND_ALPHA;
lineStyle = Graphics::LINE_SMOOTH;
lineJoin = Graphics::LINE_JOIN_MITER;
pointSize = 1.0f;
scissor = false;
colorMask[0] = colorMask[1] = colorMask[2] = colorMask[3] = true;
wireframe = false;
}
};
class Graphics : public love::graphics::Graphics
{
public:
@@ -108,10 +64,6 @@ public:
// Implements Module.
const char *getName() const;
DisplayState saveState();
void restoreState(const DisplayState &s);
virtual void setViewportSize(int width, int height);
virtual bool setMode(int width, int height, bool &sRGB);
virtual void unSetMode();
@@ -244,10 +196,22 @@ public:
**/
Font *getFont() const;
void setShader(Shader *shader);
void setShader();
Shader *getShader() const;
void setCanvas(Canvas *canvas);
void setCanvas(const std::vector<Canvas *> &canvases);
void setCanvas(const std::vector<Object::StrongRef<Canvas>> &canvases);
void setCanvas();
std::vector<Canvas *> getCanvas() const;
/**
* Sets the enabled color components when rendering.
**/
void setColorMask(bool r, bool g, bool b, bool a);
void setColorMask(const bool mask[4]);
/**
* Gets the current color mask.
@@ -447,8 +411,9 @@ public:
**/
bool isSupported(Support feature) const;
void push();
void push(StackType type = STACK_TRANSFORM);
void pop();
void rotate(float r);
void scale(float x, float y = 1.0f);
void translate(float x, float y);
@@ -457,17 +422,50 @@ public:
private:
Font *currentFont;
struct DisplayState
{
// Colors.
Color color;
Color backgroundColor;
// Blend mode.
BlendMode blendMode;
// Line.
float lineWidth;
LineStyle lineStyle;
LineJoin lineJoin;
// Point.
float pointSize;
// Scissor.
bool scissor;
OpenGL::Viewport scissorBox;
Object::StrongRef<Font> font;
Object::StrongRef<Shader> shader;
std::vector<Object::StrongRef<Canvas>> canvases;
// Color mask.
bool colorMask[4];
bool wireframe;
DisplayState();
DisplayState(const DisplayState &other);
~DisplayState();
DisplayState &operator = (const DisplayState &other);
};
void restoreState(const DisplayState &s);
void restoreStateChecked(const DisplayState &s);
love::window::Window *currentWindow;
std::vector<double> pixel_size_stack; // stores current size of a pixel (needed for line drawing)
LineStyle lineStyle;
LineJoin lineJoin;
float lineWidth;
GLint matrixLimit;
GLint userMatrices;
bool colorMask[4];
bool wireframe;
int width;
int height;
@@ -475,7 +473,10 @@ private:
bool activeStencil;
DisplayState savedState;
std::vector<DisplayState> states;
std::vector<StackType> stackTypes; // Keeps track of the pushed stack types.
static const size_t MAX_USER_STACK_DEPTH = 64;
bool displayedMinReqWarning;