Misc. code cosmetics and improvements

This commit is contained in:
Alex Szpakowski
2013-04-18 02:14:35 -03:00
parent 6fd3038405
commit bf6d1c258b
7 changed files with 27 additions and 29 deletions
+1
View File
@@ -45,6 +45,7 @@ Graphics::Graphics()
, lineWidth(1)
, matrixLimit(0)
, userMatrices(0)
, colorMask()
{
currentWindow = love::window::sdl::Window::getSingleton();
}
+8 -8
View File
@@ -35,11 +35,8 @@ namespace graphics
namespace opengl
{
// OpenGL class instance singleton.
OpenGL gl;
OpenGL::OpenGL()
: contexInitialized(false)
: contextInitialized(false)
, maxAnisotropy(1.0f)
, state()
{
@@ -47,7 +44,7 @@ OpenGL::OpenGL()
void OpenGL::initContext()
{
if (contexInitialized)
if (contextInitialized)
return;
initOpenGLFunctions();
@@ -99,15 +96,15 @@ void OpenGL::initContext()
createDefaultTexture();
contexInitialized = true;
contextInitialized = true;
}
void OpenGL::deInitContext()
{
if (!contexInitialized)
if (!contextInitialized)
return;
contexInitialized = false;
contextInitialized = false;
}
void OpenGL::initOpenGLFunctions()
@@ -396,6 +393,9 @@ graphics::Image::Wrap OpenGL::getTextureWrap()
return w;
}
// OpenGL class instance singleton.
OpenGL gl;
} // opengl
} // graphics
} // love
+5 -5
View File
@@ -103,22 +103,22 @@ public:
/**
* Sets the image filter mode for the currently bound texture.
* Returns the actual amount of anisotropic filtering set.
*/
**/
float setTextureFilter(const graphics::Image::Filter &f);
/**
* Returns the image filter mode for the currently bound texture.
*/
**/
graphics::Image::Filter getTextureFilter();
/**
* Sets the image wrap mode for the currently bound texture.
*/
**/
void setTextureWrap(const graphics::Image::Wrap &w);
/**
* Returns the image wrap mode for the currently bound texture.
*/
**/
graphics::Image::Wrap getTextureWrap();
private:
@@ -126,7 +126,7 @@ private:
void initOpenGLFunctions();
void createDefaultTexture();
bool contexInitialized;
bool contextInitialized;
float maxAnisotropy;
// Tracked OpenGL state.
+2 -2
View File
@@ -54,8 +54,8 @@ int w_getDimensions(lua_State *L);
int w_isCreated(lua_State *L);
int w_setScissor(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_getAlphaTest(lua_State *L);
int w_newImage(lua_State *L);
@@ -40,6 +40,7 @@ int w_ParticleSystem_setEmissionRate(lua_State *L);
int w_ParticleSystem_setLifetime(lua_State *L);
int w_ParticleSystem_setParticleLife(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_setSpread(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_getY(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_getSpread(lua_State *L);
int w_ParticleSystem_getOffsetX(lua_State *L);
+1 -7
View File
@@ -82,18 +82,12 @@ namespace math
Math Math::instance;
Math::Math()
: rng(newRandomGenerator())
: rng()
{
// prevent the runtime from free()-ing this
retain();
}
Math::~Math()
{
if (rng)
rng->release();
}
RandomGenerator *Math::newRandomGenerator()
{
return new RandomGenerator();
+8 -7
View File
@@ -41,18 +41,19 @@ class Math : public Module
{
private:
RandomGenerator *rng;
RandomGenerator rng;
public:
virtual ~Math();
virtual ~Math()
{}
/**
* @copydoc RandomGenerator::randomseed()
**/
inline void randomseed(uint64 seed)
{
rng->randomseed(seed);
rng.randomseed(seed);
}
/**
@@ -60,7 +61,7 @@ public:
**/
inline double random()
{
return rng->random();
return rng.random();
}
/**
@@ -68,7 +69,7 @@ public:
**/
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)
{
return rng->random(min, max);
return rng.random(min, max);
}
/**
@@ -84,7 +85,7 @@ public:
**/
inline double randomnormal(double stddev)
{
return rng->randomnormal(stddev);
return rng.randomnormal(stddev);
}
/**