Browse Source

Renamed some things.

Alex Szpakowski 9 years ago
parent
commit
cf4b409302

+ 3 - 2
src/common/Memoizer.cpp

@@ -19,12 +19,13 @@
  **/
  **/
  
  
 #include "Memoizer.h"
 #include "Memoizer.h"
-#include <cstddef>
+
+#include <unordered_map>
 
 
 namespace love
 namespace love
 {
 {
 
 
-std::map<void *, void *> Memoizer::objectMap;
+static std::unordered_map<void *, void *> objectMap;
 
 
 void Memoizer::add(void *key, void *val)
 void Memoizer::add(void *key, void *val)
 {
 {

+ 0 - 7
src/common/Memoizer.h

@@ -21,8 +21,6 @@
 #ifndef LOVE_MEMOIZER_H
 #ifndef LOVE_MEMOIZER_H
 #define LOVE_MEMOIZER_H
 #define LOVE_MEMOIZER_H
 
 
-#include <map>
-
 namespace love
 namespace love
 {
 {
 
 
@@ -31,14 +29,9 @@ class Memoizer
 public:
 public:
 
 
 	static void add(void *key, void *val);
 	static void add(void *key, void *val);
-
 	static void remove(void *key);
 	static void remove(void *key);
-
 	static void *find(void *key);
 	static void *find(void *key);
 
 
-private:
-
-	static std::map<void *, void *> objectMap;
 }; // Memoizer
 }; // Memoizer
 
 
 } // love
 } // love

+ 1 - 1
src/common/config.h

@@ -148,7 +148,7 @@
 #endif
 #endif
 
 
 // Check we have a sane configuration
 // Check we have a sane configuration
-#if !defined(LOVE_WINDOWS) && !defined(LOVE_LINUX) && !defined(LOVE_IOS) && !defined(LOVE_MACOSX)
+#if !defined(LOVE_WINDOWS) && !defined(LOVE_LINUX) && !defined(LOVE_IOS) && !defined(LOVE_MACOSX) && !defined(LOVE_ANDROID)
 #	error Could not detect target platform
 #	error Could not detect target platform
 #endif
 #endif
 #if !defined(LOVE_LITTLE_ENDIAN) && !defined(LOVE_BIG_ENDIAN)
 #if !defined(LOVE_LITTLE_ENDIAN) && !defined(LOVE_BIG_ENDIAN)

+ 1 - 1
src/common/delay.cpp

@@ -25,7 +25,7 @@
 namespace love
 namespace love
 {
 {
 
 
-void delay(unsigned int ms)
+void sleep(unsigned int ms)
 {
 {
 	SDL_Delay(ms);
 	SDL_Delay(ms);
 }
 }

+ 1 - 1
src/common/delay.h

@@ -24,7 +24,7 @@
 namespace love
 namespace love
 {
 {
 
 
-void delay(unsigned int ms);
+void sleep(unsigned int ms);
 
 
 } // namespace love
 } // namespace love
 
 

+ 3 - 3
src/common/math.h

@@ -76,7 +76,7 @@ struct Triangle
 	Vertex a, b, c;
 	Vertex a, b, c;
 };
 };
 
 
-inline int next_p2(int x)
+inline int nextP2(int x)
 {
 {
 	x += (x == 0);
 	x += (x == 0);
 	x--;
 	x--;
@@ -84,9 +84,9 @@ inline int next_p2(int x)
 	return ++x;
 	return ++x;
 }
 }
 
 
-inline float next_p2(float x)
+inline float nextP2(float x)
 {
 {
-	return static_cast<float>(next_p2(static_cast<int>(x)));
+	return (float) nextP2((int) x);
 }
 }
 
 
 } // love
 } // love

+ 1 - 1
src/modules/audio/openal/Audio.cpp

@@ -57,7 +57,7 @@ void Audio::PoolThread::threadFunction()
 		}
 		}
 
 
 		pool->update();
 		pool->update();
-		delay(5);
+		sleep(5);
 	}
 	}
 }
 }
 
 

+ 9 - 9
src/modules/graphics/Graphics.cpp

@@ -142,14 +142,14 @@ bool Graphics::getConstant(CompareMode in, const char *&out)
 	return compareModes.find(in, out);
 	return compareModes.find(in, out);
 }
 }
 
 
-bool Graphics::getConstant(const char *in, Support &out)
+bool Graphics::getConstant(const char *in, Feature &out)
 {
 {
-	return support.find(in, out);
+	return features.find(in, out);
 }
 }
 
 
-bool Graphics::getConstant(Support in, const char *&out)
+bool Graphics::getConstant(Feature in, const char *&out)
 {
 {
-	return support.find(in, out);
+	return features.find(in, out);
 }
 }
 
 
 bool Graphics::getConstant(const char *in, SystemLimit &out)
 bool Graphics::getConstant(const char *in, SystemLimit &out)
@@ -263,14 +263,14 @@ StringMap<Graphics::CompareMode, Graphics::COMPARE_MAX_ENUM>::Entry Graphics::co
 
 
 StringMap<Graphics::CompareMode, Graphics::COMPARE_MAX_ENUM> Graphics::compareModes(Graphics::compareModeEntries, sizeof(Graphics::compareModeEntries));
 StringMap<Graphics::CompareMode, Graphics::COMPARE_MAX_ENUM> Graphics::compareModes(Graphics::compareModeEntries, sizeof(Graphics::compareModeEntries));
 
 
-StringMap<Graphics::Support, Graphics::SUPPORT_MAX_ENUM>::Entry Graphics::supportEntries[] =
+StringMap<Graphics::Feature, Graphics::FEATURE_MAX_ENUM>::Entry Graphics::featureEntries[] =
 {
 {
-	{ "multicanvasformats", SUPPORT_MULTI_CANVAS_FORMATS },
-	{ "clampzero", SUPPORT_CLAMP_ZERO },
-	{ "lighten", SUPPORT_LIGHTEN },
+	{ "multicanvasformats", FEATURE_MULTI_CANVAS_FORMATS },
+	{ "clampzero", FEATURE_CLAMP_ZERO },
+	{ "lighten", FEATURE_LIGHTEN },
 };
 };
 
 
-StringMap<Graphics::Support, Graphics::SUPPORT_MAX_ENUM> Graphics::support(Graphics::supportEntries, sizeof(Graphics::supportEntries));
+StringMap<Graphics::Feature, Graphics::FEATURE_MAX_ENUM> Graphics::features(Graphics::featureEntries, sizeof(Graphics::featureEntries));
 
 
 StringMap<Graphics::SystemLimit, Graphics::LIMIT_MAX_ENUM>::Entry Graphics::systemLimitEntries[] =
 StringMap<Graphics::SystemLimit, Graphics::LIMIT_MAX_ENUM>::Entry Graphics::systemLimitEntries[] =
 {
 {

+ 9 - 9
src/modules/graphics/Graphics.h

@@ -136,12 +136,12 @@ public:
 		COMPARE_MAX_ENUM
 		COMPARE_MAX_ENUM
 	};
 	};
 
 
-	enum Support
+	enum Feature
 	{
 	{
-		SUPPORT_MULTI_CANVAS_FORMATS,
-		SUPPORT_CLAMP_ZERO,
-		SUPPORT_LIGHTEN,
-		SUPPORT_MAX_ENUM
+		FEATURE_MULTI_CANVAS_FORMATS,
+		FEATURE_CLAMP_ZERO,
+		FEATURE_LIGHTEN,
+		FEATURE_MAX_ENUM
 	};
 	};
 
 
 	enum Renderer
 	enum Renderer
@@ -291,8 +291,8 @@ public:
 	static bool getConstant(const char *in, CompareMode &out);
 	static bool getConstant(const char *in, CompareMode &out);
 	static bool getConstant(CompareMode in, const char *&out);
 	static bool getConstant(CompareMode in, const char *&out);
 
 
-	static bool getConstant(const char *in, Support &out);
-	static bool getConstant(Support in, const char *&out);
+	static bool getConstant(const char *in, Feature &out);
+	static bool getConstant(Feature in, const char *&out);
 
 
 	static bool getConstant(const char *in, SystemLimit &out);
 	static bool getConstant(const char *in, SystemLimit &out);
 	static bool getConstant(SystemLimit in, const char *&out);
 	static bool getConstant(SystemLimit in, const char *&out);
@@ -329,8 +329,8 @@ private:
 	static StringMap<CompareMode, COMPARE_MAX_ENUM>::Entry compareModeEntries[];
 	static StringMap<CompareMode, COMPARE_MAX_ENUM>::Entry compareModeEntries[];
 	static StringMap<CompareMode, COMPARE_MAX_ENUM> compareModes;
 	static StringMap<CompareMode, COMPARE_MAX_ENUM> compareModes;
 
 
-	static StringMap<Support, SUPPORT_MAX_ENUM>::Entry supportEntries[];
-	static StringMap<Support, SUPPORT_MAX_ENUM> support;
+	static StringMap<Feature, FEATURE_MAX_ENUM>::Entry featureEntries[];
+	static StringMap<Feature, FEATURE_MAX_ENUM> features;
 
 
 	static StringMap<SystemLimit, LIMIT_MAX_ENUM>::Entry systemLimitEntries[];
 	static StringMap<SystemLimit, LIMIT_MAX_ENUM>::Entry systemLimitEntries[];
 	static StringMap<SystemLimit, LIMIT_MAX_ENUM> systemLimits;
 	static StringMap<SystemLimit, LIMIT_MAX_ENUM> systemLimits;

+ 1 - 1
src/modules/graphics/opengl/Canvas.cpp

@@ -352,7 +352,7 @@ bool Canvas::setWrap(const Texture::Wrap &w)
 	wrap = w;
 	wrap = w;
 
 
 	if ((GLAD_ES_VERSION_2_0 && !(GLAD_ES_VERSION_3_0 || GLAD_OES_texture_npot))
 	if ((GLAD_ES_VERSION_2_0 && !(GLAD_ES_VERSION_3_0 || GLAD_OES_texture_npot))
-		&& (width != next_p2(width) || height != next_p2(height)))
+		&& (width != nextP2(width) || height != nextP2(height)))
 	{
 	{
 		if (wrap.s != WRAP_CLAMP || wrap.t != WRAP_CLAMP)
 		if (wrap.s != WRAP_CLAMP || wrap.t != WRAP_CLAMP)
 			success = false;
 			success = false;

+ 1 - 1
src/modules/graphics/opengl/Font.h

@@ -195,7 +195,7 @@ public:
 	uint32 getTextureCacheID() const;
 	uint32 getTextureCacheID() const;
 
 
 	static bool getConstant(const char *in, AlignMode &out);
 	static bool getConstant(const char *in, AlignMode &out);
-	static bool getConstant(AlignMode in, const char  *&out);
+	static bool getConstant(AlignMode in, const char *&out);
 
 
 	static int fontCount;
 	static int fontCount;
 
 

+ 5 - 5
src/modules/graphics/opengl/Graphics.cpp

@@ -1106,7 +1106,7 @@ void Graphics::setBlendMode(BlendMode mode, BlendAlpha alphamode)
 
 
 	if (mode == BLEND_LIGHTEN || mode == BLEND_DARKEN)
 	if (mode == BLEND_LIGHTEN || mode == BLEND_DARKEN)
 	{
 	{
-		if (!isSupported(SUPPORT_LIGHTEN))
+		if (!isSupported(FEATURE_LIGHTEN))
 			throw love::Exception("The 'lighten' and 'darken' blend modes are not supported on this system.");
 			throw love::Exception("The 'lighten' and 'darken' blend modes are not supported on this system.");
 	}
 	}
 
 
@@ -1680,15 +1680,15 @@ double Graphics::getSystemLimit(SystemLimit limittype) const
 	}
 	}
 }
 }
 
 
-bool Graphics::isSupported(Support feature) const
+bool Graphics::isSupported(Feature feature) const
 {
 {
 	switch (feature)
 	switch (feature)
 	{
 	{
-	case SUPPORT_MULTI_CANVAS_FORMATS:
+	case FEATURE_MULTI_CANVAS_FORMATS:
 		return Canvas::isMultiFormatMultiCanvasSupported();
 		return Canvas::isMultiFormatMultiCanvasSupported();
-	case SUPPORT_CLAMP_ZERO:
+	case FEATURE_CLAMP_ZERO:
 		return gl.isClampZeroTextureWrapSupported();
 		return gl.isClampZeroTextureWrapSupported();
-	case SUPPORT_LIGHTEN:
+	case FEATURE_LIGHTEN:
 		return GLAD_VERSION_1_4 || GLAD_ES_VERSION_3_0 || GLAD_EXT_blend_minmax;
 		return GLAD_VERSION_1_4 || GLAD_ES_VERSION_3_0 || GLAD_EXT_blend_minmax;
 	default:
 	default:
 		return false;
 		return false;

+ 1 - 1
src/modules/graphics/opengl/Graphics.h

@@ -468,7 +468,7 @@ public:
 	/**
 	/**
 	 * Gets whether a graphics feature is supported on this system.
 	 * Gets whether a graphics feature is supported on this system.
 	 **/
 	 **/
-	bool isSupported(Support feature) const;
+	bool isSupported(Feature feature) const;
 
 
 	void push(StackType type = STACK_TRANSFORM);
 	void push(StackType type = STACK_TRANSFORM);
 	void pop();
 	void pop();

+ 2 - 2
src/modules/graphics/opengl/Image.cpp

@@ -308,7 +308,7 @@ bool Image::loadVolatile()
 
 
 	// NPOT textures don't support mipmapping without full NPOT support.
 	// NPOT textures don't support mipmapping without full NPOT support.
 	if ((GLAD_ES_VERSION_2_0 && !(GLAD_ES_VERSION_3_0 || GLAD_OES_texture_npot))
 	if ((GLAD_ES_VERSION_2_0 && !(GLAD_ES_VERSION_3_0 || GLAD_OES_texture_npot))
-		&& (width != next_p2(width) || height != next_p2(height)))
+		&& (width != nextP2(width) || height != nextP2(height)))
 	{
 	{
 		flags.mipmaps = false;
 		flags.mipmaps = false;
 		filter.mipmap = FILTER_NONE;
 		filter.mipmap = FILTER_NONE;
@@ -519,7 +519,7 @@ bool Image::setWrap(const Texture::Wrap &w)
 	wrap = w;
 	wrap = w;
 
 
 	if ((GLAD_ES_VERSION_2_0 && !(GLAD_ES_VERSION_3_0 || GLAD_OES_texture_npot))
 	if ((GLAD_ES_VERSION_2_0 && !(GLAD_ES_VERSION_3_0 || GLAD_OES_texture_npot))
-		&& (width != next_p2(width) || height != next_p2(height)))
+		&& (width != nextP2(width) || height != nextP2(height)))
 	{
 	{
 		if (wrap.s != WRAP_CLAMP || wrap.t != WRAP_CLAMP)
 		if (wrap.s != WRAP_CLAMP || wrap.t != WRAP_CLAMP)
 			success = false;
 			success = false;

+ 3 - 3
src/modules/graphics/opengl/wrap_Graphics.cpp

@@ -1387,11 +1387,11 @@ int w_setDefaultShaderCode(lua_State *L)
 
 
 int w_getSupported(lua_State *L)
 int w_getSupported(lua_State *L)
 {
 {
-	lua_createtable(L, 0, (int) Graphics::SUPPORT_MAX_ENUM);
+	lua_createtable(L, 0, (int) Graphics::FEATURE_MAX_ENUM);
 
 
-	for (int i = 0; i < (int) Graphics::SUPPORT_MAX_ENUM; i++)
+	for (int i = 0; i < (int) Graphics::FEATURE_MAX_ENUM; i++)
 	{
 	{
-		Graphics::Support feature = (Graphics::Support) i;
+		auto feature = (Graphics::Feature) i;
 		const char *name = nullptr;
 		const char *name = nullptr;
 
 
 		if (!Graphics::getConstant(feature, name))
 		if (!Graphics::getConstant(feature, name))

+ 1 - 1
src/modules/timer/sdl/Timer.cpp

@@ -53,7 +53,7 @@ const char *Timer::getName() const
 void Timer::sleep(double seconds) const
 void Timer::sleep(double seconds) const
 {
 {
 	if (seconds > 0)
 	if (seconds > 0)
-		delay((unsigned int)(seconds*1000));
+		love::sleep((unsigned int)(seconds*1000));
 }
 }
 
 
 } // sdl
 } // sdl

+ 1 - 2
src/modules/video/theora/Video.cpp

@@ -112,8 +112,7 @@ void Worker::threadFunction()
 			}
 			}
 		}
 		}
 
 
-		// sleep
-		love::delay(2);
+		love::sleep(2);
 	}
 	}
 }
 }