Browse Source

Misc. code cosmetics and improvements

Alex Szpakowski 12 years ago
parent
commit
bf6d1c258b

+ 1 - 0
src/modules/graphics/opengl/Graphics.cpp

@@ -45,6 +45,7 @@ Graphics::Graphics()
 	, lineWidth(1)
 	, lineWidth(1)
 	, matrixLimit(0)
 	, matrixLimit(0)
 	, userMatrices(0)
 	, userMatrices(0)
+	, colorMask()
 {
 {
 	currentWindow = love::window::sdl::Window::getSingleton();
 	currentWindow = love::window::sdl::Window::getSingleton();
 }
 }

+ 8 - 8
src/modules/graphics/opengl/OpenGL.cpp

@@ -35,11 +35,8 @@ namespace graphics
 namespace opengl
 namespace opengl
 {
 {
 
 
-// OpenGL class instance singleton.
-OpenGL gl;
-
 OpenGL::OpenGL()
 OpenGL::OpenGL()
-	: contexInitialized(false)
+	: contextInitialized(false)
 	, maxAnisotropy(1.0f)
 	, maxAnisotropy(1.0f)
 	, state()
 	, state()
 {
 {
@@ -47,7 +44,7 @@ OpenGL::OpenGL()
 
 
 void OpenGL::initContext()
 void OpenGL::initContext()
 {
 {
-	if (contexInitialized)
+	if (contextInitialized)
 		return;
 		return;
 
 
 	initOpenGLFunctions();
 	initOpenGLFunctions();
@@ -99,15 +96,15 @@ void OpenGL::initContext()
 
 
 	createDefaultTexture();
 	createDefaultTexture();
 
 
-	contexInitialized = true;
+	contextInitialized = true;
 }
 }
 
 
 void OpenGL::deInitContext()
 void OpenGL::deInitContext()
 {
 {
-	if (!contexInitialized)
+	if (!contextInitialized)
 		return;
 		return;
 
 
-	contexInitialized = false;
+	contextInitialized = false;
 }
 }
 
 
 void OpenGL::initOpenGLFunctions()
 void OpenGL::initOpenGLFunctions()
@@ -396,6 +393,9 @@ graphics::Image::Wrap OpenGL::getTextureWrap()
 	return w;
 	return w;
 }
 }
 
 
+// OpenGL class instance singleton.
+OpenGL gl;
+
 } // opengl
 } // opengl
 } // graphics
 } // graphics
 } // love
 } // love

+ 5 - 5
src/modules/graphics/opengl/OpenGL.h

@@ -103,22 +103,22 @@ public:
 	/**
 	/**
 	 * Sets the image filter mode for the currently bound texture.
 	 * Sets the image filter mode for the currently bound texture.
 	 * Returns the actual amount of anisotropic filtering set.
 	 * Returns the actual amount of anisotropic filtering set.
-	 */
+	 **/
 	float setTextureFilter(const graphics::Image::Filter &f);
 	float setTextureFilter(const graphics::Image::Filter &f);
 
 
 	/**
 	/**
 	 * Returns the image filter mode for the currently bound texture.
 	 * Returns the image filter mode for the currently bound texture.
-	 */
+	 **/
 	graphics::Image::Filter getTextureFilter();
 	graphics::Image::Filter getTextureFilter();
 
 
 	/**
 	/**
 	 * Sets the image wrap mode for the currently bound texture.
 	 * Sets the image wrap mode for the currently bound texture.
-	 */
+	 **/
 	void setTextureWrap(const graphics::Image::Wrap &w);
 	void setTextureWrap(const graphics::Image::Wrap &w);
 
 
 	/**
 	/**
 	 * Returns the image wrap mode for the currently bound texture.
 	 * Returns the image wrap mode for the currently bound texture.
-	 */
+	 **/
 	graphics::Image::Wrap getTextureWrap();
 	graphics::Image::Wrap getTextureWrap();
 
 
 private:
 private:
@@ -126,7 +126,7 @@ private:
 	void initOpenGLFunctions();
 	void initOpenGLFunctions();
 	void createDefaultTexture();
 	void createDefaultTexture();
 
 
-	bool contexInitialized;
+	bool contextInitialized;
 	float maxAnisotropy;
 	float maxAnisotropy;
 
 
 	// Tracked OpenGL state.
 	// Tracked OpenGL state.

+ 2 - 2
src/modules/graphics/opengl/wrap_Graphics.h

@@ -54,8 +54,8 @@ int w_getDimensions(lua_State *L);
 int w_isCreated(lua_State *L);
 int w_isCreated(lua_State *L);
 int w_setScissor(lua_State *L);
 int w_setScissor(lua_State *L);
 int w_getScissor(lua_State *L);
 int w_getScissor(lua_State *L);
-int w_defineMask(lua_State *L);
-int w_setMask(lua_State *L);
+int w_newStencil(lua_State *L);
+int w_setStencil(lua_State *L);
 int w_setAlphaTest(lua_State *L);
 int w_setAlphaTest(lua_State *L);
 int w_getAlphaTest(lua_State *L);
 int w_getAlphaTest(lua_State *L);
 int w_newImage(lua_State *L);
 int w_newImage(lua_State *L);

+ 2 - 0
src/modules/graphics/opengl/wrap_ParticleSystem.h

@@ -40,6 +40,7 @@ int w_ParticleSystem_setEmissionRate(lua_State *L);
 int w_ParticleSystem_setLifetime(lua_State *L);
 int w_ParticleSystem_setLifetime(lua_State *L);
 int w_ParticleSystem_setParticleLife(lua_State *L);
 int w_ParticleSystem_setParticleLife(lua_State *L);
 int w_ParticleSystem_setPosition(lua_State *L);
 int w_ParticleSystem_setPosition(lua_State *L);
+int w_ParticleSystem_setAreaSpread(lua_State *L);
 int w_ParticleSystem_setDirection(lua_State *L);
 int w_ParticleSystem_setDirection(lua_State *L);
 int w_ParticleSystem_setSpread(lua_State *L);
 int w_ParticleSystem_setSpread(lua_State *L);
 int w_ParticleSystem_setRelativeDirection(lua_State *L);
 int w_ParticleSystem_setRelativeDirection(lua_State *L);
@@ -58,6 +59,7 @@ int w_ParticleSystem_setOffset(lua_State *L);
 int w_ParticleSystem_getX(lua_State *L);
 int w_ParticleSystem_getX(lua_State *L);
 int w_ParticleSystem_getY(lua_State *L);
 int w_ParticleSystem_getY(lua_State *L);
 int w_ParticleSystem_getPosition(lua_State *L);
 int w_ParticleSystem_getPosition(lua_State *L);
+int w_ParticleSystem_getAreaSpread(lua_State *L);
 int w_ParticleSystem_getDirection(lua_State *L);
 int w_ParticleSystem_getDirection(lua_State *L);
 int w_ParticleSystem_getSpread(lua_State *L);
 int w_ParticleSystem_getSpread(lua_State *L);
 int w_ParticleSystem_getOffsetX(lua_State *L);
 int w_ParticleSystem_getOffsetX(lua_State *L);

+ 1 - 7
src/modules/math/MathModule.cpp

@@ -82,18 +82,12 @@ namespace math
 Math Math::instance;
 Math Math::instance;
 
 
 Math::Math()
 Math::Math()
-	: rng(newRandomGenerator())
+	: rng()
 {
 {
 	// prevent the runtime from free()-ing this
 	// prevent the runtime from free()-ing this
 	retain();
 	retain();
 }
 }
 
 
-Math::~Math()
-{
-	if (rng)
-		rng->release();
-}
-
 RandomGenerator *Math::newRandomGenerator()
 RandomGenerator *Math::newRandomGenerator()
 {
 {
 	return new RandomGenerator();
 	return new RandomGenerator();

+ 8 - 7
src/modules/math/MathModule.h

@@ -41,18 +41,19 @@ class Math : public Module
 {
 {
 private:
 private:
 
 
-	RandomGenerator *rng;
+	RandomGenerator rng;
 
 
 public:
 public:
 
 
-	virtual ~Math();
+	virtual ~Math()
+	{}
 
 
 	/**
 	/**
 	 * @copydoc RandomGenerator::randomseed()
 	 * @copydoc RandomGenerator::randomseed()
 	 **/
 	 **/
 	inline void randomseed(uint64 seed)
 	inline void randomseed(uint64 seed)
 	{
 	{
-		rng->randomseed(seed);
+		rng.randomseed(seed);
 	}
 	}
 
 
 	/**
 	/**
@@ -60,7 +61,7 @@ public:
 	 **/
 	 **/
 	inline double random()
 	inline double random()
 	{
 	{
-		return rng->random();
+		return rng.random();
 	}
 	}
 
 
 	/**
 	/**
@@ -68,7 +69,7 @@ public:
 	 **/
 	 **/
 	inline double random(double max)
 	inline double random(double max)
 	{
 	{
-		return rng->random(max);
+		return rng.random(max);
 	}
 	}
 
 
 	/**
 	/**
@@ -76,7 +77,7 @@ public:
 	 **/
 	 **/
 	inline double random(double min, double max)
 	inline double random(double min, double max)
 	{
 	{
-		return rng->random(min, max);
+		return rng.random(min, max);
 	}
 	}
 
 
 	/**
 	/**
@@ -84,7 +85,7 @@ public:
 	 **/
 	 **/
 	inline double randomnormal(double stddev)
 	inline double randomnormal(double stddev)
 	{
 	{
-		return rng->randomnormal(stddev);
+		return rng.randomnormal(stddev);
 	}
 	}
 
 
 	/**
 	/**