Alex Szpakowski avatar Alex Szpakowski committed 1dfca34

Fixed Object:typeOf for love.physics objects new to 0.8.0, removed vestigial ColorMode code

Comments (0)

Files changed (14)

platform/macosx/love-framework.xcodeproj/project.pbxproj

 				FRAMEWORK_SEARCH_PATHS = /Library/Frameworks;
 				GCC_OPTIMIZATION_LEVEL = s;
 				GCC_PREPROCESSOR_DEFINITIONS = LOVE_SUPPORT_GME;
-				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
+				GCC_WARN_SIGN_COMPARE = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES;
+				GCC_WARN_UNUSED_PARAMETER = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
 				HEADER_SEARCH_PATHS = (
 					"\"$(SRCROOT)/../../src\"",
 				FRAMEWORK_SEARCH_PATHS = /Library/Frameworks;
 				GCC_OPTIMIZATION_LEVEL = 0;
 				GCC_PREPROCESSOR_DEFINITIONS = LOVE_SUPPORT_GME;
-				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
+				GCC_WARN_SIGN_COMPARE = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES;
+				GCC_WARN_UNUSED_PARAMETER = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
 				HEADER_SEARCH_PATHS = (
 					"\"$(SRCROOT)/../../src\"",

src/common/delay.h

 
 void delay(unsigned int ms);
 
-}; // namespace love
+} // namespace love
 
 #endif // DELAY_H_

src/common/runtime.cpp

 
 	// Graphics
 	{"Drawable", GRAPHICS_DRAWABLE_ID},
+	{"DrawGable", GRAPHICS_DRAWGABLE_ID},
 	{"Image", GRAPHICS_IMAGE_ID},
 	{"Geometry", GRAPHICS_GEOMETRY_ID},
 	{"Font", GRAPHICS_FONT_ID},
 	{"World", PHYSICS_WORLD_ID},
 	{"Contact", PHYSICS_CONTACT_ID},
 	{"Body", PHYSICS_BODY_ID},
+	{"Fixture", PHYSICS_FIXTURE_ID},
 	{"Shape", PHYSICS_SHAPE_ID},
 	{"CircleShape", PHYSICS_CIRCLE_SHAPE_ID},
 	{"PolygonShape", PHYSICS_POLYGON_SHAPE_ID},
+	{"EdgeShape", PHYSICS_EDGE_SHAPE_ID},
+	{"ChainShape", PHYSICS_CHAIN_SHAPE_ID},
 	{"Joint", PHYSICS_JOINT_ID},
 	{"MouseJoint", PHYSICS_MOUSE_JOINT_ID},
 	{"DistanceJoint", PHYSICS_DISTANCE_JOINT_ID},
 	{"RevoluteJoint", PHYSICS_REVOLUTE_JOINT_ID},
 	{"PulleyJoint", PHYSICS_PULLEY_JOINT_ID},
 	{"GearJoint", PHYSICS_GEAR_JOINT_ID},
+	{"WeldJoint", PHYSICS_WELD_JOINT_ID},
+	{"RopeJoint", PHYSICS_ROPE_JOINT_ID},
+	{"WheelJoint", PHYSICS_WHEEL_JOINT_ID},
 
 	// Thread
 	{"Thread", THREAD_THREAD_ID},

src/modules/graphics/Graphics.cpp

 	return blendModes.find(in, out);
 }
 
-bool Graphics::getConstant(const char *in, ColorMode &out)
-{
-	return colorModes.find(in, out);
-}
-
-bool Graphics::getConstant(ColorMode in, const char  *&out)
-{
-	return colorModes.find(in, out);
-}
-
 bool Graphics::getConstant(const char *in, LineStyle &out)
 {
 	return lineStyles.find(in, out);
 
 StringMap<Graphics::BlendMode, Graphics::BLEND_MAX_ENUM> Graphics::blendModes(Graphics::blendModeEntries, sizeof(Graphics::blendModeEntries));
 
-StringMap<Graphics::ColorMode, Graphics::COLOR_MAX_ENUM>::Entry Graphics::colorModeEntries[] =
-{
-	{ "replace", Graphics::COLOR_REPLACE },
-	{ "modulate", Graphics::COLOR_MODULATE },
-	{ "combine", Graphics::COLOR_COMBINE },
-};
-
-StringMap<Graphics::ColorMode, Graphics::COLOR_MAX_ENUM> Graphics::colorModes(Graphics::colorModeEntries, sizeof(Graphics::colorModeEntries));
-
 StringMap<Graphics::LineStyle, Graphics::LINE_MAX_ENUM>::Entry Graphics::lineStyleEntries[] =
 {
 	{ "smooth", Graphics::LINE_SMOOTH },

src/modules/graphics/Graphics.h

 		BLEND_MAX_ENUM
 	};
 
-	enum ColorMode
-	{
-		COLOR_MODULATE = 1,
-		COLOR_REPLACE,
-		COLOR_COMBINE,
-		COLOR_MAX_ENUM
-	};
-
 	enum LineStyle
 	{
 		LINE_ROUGH = 1,
 	static bool getConstant(const char *in, BlendMode &out);
 	static bool getConstant(BlendMode in, const char  *&out);
 
-	static bool getConstant(const char *in, ColorMode &out);
-	static bool getConstant(ColorMode in, const char  *&out);
-
 	static bool getConstant(const char *in, LineStyle &out);
 	static bool getConstant(LineStyle in, const char  *&out);
 
 	static StringMap<BlendMode, BLEND_MAX_ENUM>::Entry blendModeEntries[];
 	static StringMap<BlendMode, BLEND_MAX_ENUM> blendModes;
 
-	static StringMap<ColorMode, COLOR_MAX_ENUM>::Entry colorModeEntries[];
-	static StringMap<ColorMode, COLOR_MAX_ENUM> colorModes;
-
 	static StringMap<LineStyle, LINE_MAX_ENUM>::Entry lineStyleEntries[];
 	static StringMap<LineStyle, LINE_MAX_ENUM> lineStyles;
 

src/modules/graphics/opengl/Canvas.cpp

 // none, opengl >= 3.0, extensions
 struct FramebufferStrategy
 {
+	virtual ~FramebufferStrategy() {}
+
 	/// create a new framebuffer, depth_stencil and texture
 	/**
 	 * @param[out] framebuffer   Framebuffer name

src/modules/graphics/opengl/Shader.cpp

 	{
 		GLenum err = glGetError();
 
-		if (err == GL_INVALID_ENUM) // invalid or unsupported shader type
+		if (err == GL_INVALID_ENUM)
 			throw love::Exception("Cannot create %s shader object: %s shaders not supported.", typestr, typestr);
-		else // other errors should only happen between glBegin() and glEnd()
+		else
 			throw love::Exception("Cannot create %s shader object.", typestr);
 	}
 
 
 	glCompileShader(shaderid);
 
-	// Get any warnings the shader compiler may have produced
+	// Get any warnings the shader compiler may have produced.
 	GLint infologlen;
 	glGetShaderiv(shaderid, GL_INFO_LOG_LENGTH, &infologlen);
 
 	GLchar *infolog = new GLchar[infologlen + 1];
 	glGetShaderInfoLog(shaderid, infologlen, NULL, infolog);
 
-	// Save any warnings for later querying
+	// Save any warnings for later querying.
 	if (infologlen > 0)
 		shaderWarnings[type] = infolog;
 
 void Shader::createProgram(const std::vector<GLuint> &shaderids)
 {
 	program = glCreateProgram();
-	if (program == 0) // should only fail when called between glBegin() and glEnd()
+	if (program == 0)
 		throw love::Exception("Cannot create shader program object.");
 
 	std::vector<GLuint>::const_iterator it;
 
 	glLinkProgram(program);
 
+	// flag shaders for auto-deletion when the program object is deleted.
 	for (it = shaderids.begin(); it != shaderids.end(); ++it)
-		glDeleteShader(*it); // flag shaders for auto-deletion when program object is deleted
+		glDeleteShader(*it);
 
 	GLint status;
 	glGetProgramiv(program, GL_LINK_STATUS, &status);
 	GLsizei bufsize;
 	glGetProgramiv(program, GL_ACTIVE_UNIFORM_MAX_LENGTH, (GLint *) &bufsize);
 
+	if (bufsize <= 0)
+		return;
+
 	for (int i = 0; i < numuniforms; i++)
 	{
 		GLchar *cname = new GLchar[bufsize];
 
 	createProgram(shaderids);
 
+	// Retreive all active uniform variables in this shader from OpenGL.
 	mapActiveUniforms();
 
 	if (current == this)
 	{
-		current = NULL; // make sure glUseProgram gets called
+		// make sure glUseProgram gets called.
+		current = NULL;
 		attach();
 	}
 
 	if (size < 2 || size > 4)
 	{
 		throw love::Exception("Invalid matrix size: %dx%d "
-							  "(can only set 2x2, 3x3 or 4x4 matrices).", size,size);
+							  "(can only set 2x2, 3x3 or 4x4 matrices.)", size,size);
 	}
 
 	const Uniform &u = getUniform(name);
 
 std::string Shader::getGLSLVersion()
 {
-	// GL_SHADING_LANGUAGE_VERSION may not be available in OpenGL < 2.0.
-	const char *tmp = (const char *) glGetString(GL_SHADING_LANGUAGE_VERSION);
-	if (tmp == NULL)
+	const char *tmp = 0;
+
+	// GL_SHADING_LANGUAGE_VERSION isn't available in OpenGL < 2.0.
+	if (GL_VERSION_2_0)
+		tmp = (const char *) glGetString(GL_SHADING_LANGUAGE_VERSION);
+
+	if (tmp == 0)
 		return "0.0";
 
 	// the version string always begins with a version number of the format

src/modules/graphics/opengl/wrap_Graphics.cpp

 	return 0;
 }
 
-int w_origin(lua_State *L)
+int w_origin(lua_State * /*L*/)
 {
 	instance->origin();
 	return 0;

src/modules/graphics/opengl/wrap_Shader.cpp

 static T *_getScalars(lua_State *L, int count, size_t &dimension)
 {
 	dimension = 1;
+	T *values = new T[count];
 
-	T *values = new T[count];
 	for (int i = 0; i < count; ++i)
 	{
 		if (lua_isnumber(L, 3 + i))

src/modules/image/CompressedData.cpp

 
 void CompressedData::checkMipmapLevelExists(int miplevel) const
 {
-	if (miplevel < 0 || miplevel >= dataImages.size())
+	if (miplevel < 0 || miplevel >= (int) dataImages.size())
 		throw love::Exception("Mipmap level %d does not exist", miplevel);
 }
 

src/modules/image/ImageData.cpp

 	pixels[y*getWidth()+x] = c;
 }
 
-pixel ImageData::getPixel(int x, int y)
+pixel ImageData::getPixel(int x, int y) const
 {
 	if (!inside(x, y))
 		throw love::Exception("Attempt to get out-of-range pixel!");

src/modules/image/ImageData.h

 	 * @param y The location along the y-axis.
 	 * @return The color for the given location.
 	 **/
-	pixel getPixel(int x, int y);
+	pixel getPixel(int x, int y) const;
 
 	/**
 	 * Encodes raw pixel data into a given format.

src/modules/image/magpie/DevilHandler.cpp

 	ilShutDown();
 }
 
-bool DevilHandler::canDecode(love::filesystem::FileData *data)
+bool DevilHandler::canDecode(love::filesystem::FileData * /*data*/)
 {
 	// DevIL can decode a lot of formats...
 	return true;

src/modules/math/MathModule.cpp

 
 // LOVE
 #include "MathModule.h"
-#include "common/math.h"
 
 // STL
 #include <cmath>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.