Browse Source

Use C++11's in-line member initializers instead of default constructors with initializer lists, for some structs.

--HG--
branch : minor
Alex Szpakowski 11 years ago
parent
commit
cf7342f8b7

+ 3 - 9
src/modules/audio/openal/Source.h

@@ -165,15 +165,9 @@ private:
 
 
 	struct Cone
 	struct Cone
 	{
 	{
-		int innerAngle; // degrees
-		int outerAngle; // degrees
-		float outerVolume;
-
-		Cone()
-			: innerAngle(360)
-			, outerAngle(360)
-			, outerVolume(0.0f)
-		{}
+		int innerAngle = 360; // degrees
+		int outerAngle = 360; // degrees
+		float outerVolume = 0.0f;
 	} cone;
 	} cone;
 
 
 	float offsetSamples;
 	float offsetSamples;

+ 0 - 23
src/modules/graphics/Texture.cpp

@@ -27,29 +27,6 @@ namespace graphics
 
 
 Texture::Filter Texture::defaultFilter;
 Texture::Filter Texture::defaultFilter;
 
 
-Texture::Filter::Filter()
-	: min(FILTER_LINEAR)
-	, mag(FILTER_LINEAR)
-	, mipmap(FILTER_NONE)
-	, anisotropy(1.0f)
-{
-}
-
-Texture::Wrap::Wrap()
-	: s(WRAP_CLAMP)
-	, t(WRAP_CLAMP)
-{
-}
-
-Texture::Texture()
-	: width(0)
-	, height(0)
-	, filter(getDefaultFilter())
-	, wrap()
-	, vertices()
-{
-}
-
 Texture::~Texture()
 Texture::~Texture()
 {
 {
 }
 }

+ 6 - 8
src/modules/graphics/Texture.h

@@ -57,18 +57,16 @@ public:
 
 
 	struct Filter
 	struct Filter
 	{
 	{
-		Filter();
-		FilterMode min;
-		FilterMode mag;
-		FilterMode mipmap;
-		float anisotropy;
+		FilterMode min    = FILTER_LINEAR;
+		FilterMode mag    = FILTER_LINEAR;
+		FilterMode mipmap = FILTER_NONE;
+		float anisotropy  = 1.0f;
 	};
 	};
 
 
 	struct Wrap
 	struct Wrap
 	{
 	{
-		Wrap();
-		WrapMode s;
-		WrapMode t;
+		WrapMode s = WRAP_CLAMP;
+		WrapMode t = WRAP_CLAMP;
 	};
 	};
 
 
 	Texture();
 	Texture();

+ 2 - 4
src/modules/graphics/opengl/Image.h

@@ -60,10 +60,8 @@ public:
 
 
 	struct Flags
 	struct Flags
 	{
 	{
-		bool mipmaps;
-		bool sRGB;
-
-		Flags() : mipmaps(false), sRGB(false) {}
+		bool mipmaps = false;
+		bool sRGB = false;;
 	};
 	};
 
 
 	/**
 	/**

+ 6 - 7
src/modules/image/magpie/FormatHandler.h

@@ -44,18 +44,17 @@ public:
 	// Raw RGBA pixel data.
 	// Raw RGBA pixel data.
 	struct DecodedImage
 	struct DecodedImage
 	{
 	{
-		int width, height;
-		size_t size;
-		unsigned char *data;
-		DecodedImage() : width(0), height(0), size(0), data(0) {}
+		int width   = 0;
+		int height  = 0;
+		size_t size = 0;
+		unsigned char *data = nullptr;
 	};
 	};
 
 
 	// Pixel data encoded in a particular format.
 	// Pixel data encoded in a particular format.
 	struct EncodedImage
 	struct EncodedImage
 	{
 	{
-		size_t size;
-		unsigned char *data;
-		EncodedImage() : size(0), data(0) {}
+		size_t size = 0;
+		unsigned char *data = nullptr;
 	};
 	};
 
 
 	/**
 	/**

+ 0 - 17
src/modules/window/Window.cpp

@@ -38,23 +38,6 @@ void Window::swapBuffers()
 {
 {
 }
 }
 
 
-WindowSettings::WindowSettings()
-	: fullscreen(false)
-	, fstype(Window::FULLSCREEN_TYPE_EXCLUSIVE)
-	, vsync(true)
-	, msaa(0)
-	, resizable(false)
-	, minwidth(1)
-	, minheight(1)
-	, borderless(false)
-	, centered(true)
-	, display(0)
-	, highdpi(false)
-	, sRGB(false)
-	, refreshrate(0.0)
-{
-}
-
 bool Window::getConstant(const char *in, Window::FullscreenType &out)
 bool Window::getConstant(const char *in, Window::FullscreenType &out)
 {
 {
 	return fullscreenTypes.find(in, out);
 	return fullscreenTypes.find(in, out);

+ 14 - 17
src/modules/window/Window.h

@@ -186,23 +186,20 @@ private:
 
 
 struct WindowSettings
 struct WindowSettings
 {
 {
-	WindowSettings();
-
-	bool fullscreen; // = false
-	Window::FullscreenType fstype; // = FULLSCREEN_TYPE_EXCLUSIVE
-	bool vsync; // = true
-	int msaa; // = 0
-	bool resizable; // = false
-	int minwidth; // = 1
-	int minheight; // = 1
-	bool borderless; // = false
-	bool centered; // = true
-	int display; // = 0
-	bool highdpi; // false
-	bool sRGB; // false
-	double refreshrate; // 0.0
-
-}; // WindowSettings
+	bool fullscreen = false;
+	Window::FullscreenType fstype = Window::FULLSCREEN_TYPE_EXCLUSIVE;
+	bool vsync = true;
+	int msaa = 0;
+	bool resizable = false;
+	int minwidth = 1;
+	int minheight = 1;
+	bool borderless = false;
+	bool centered = true;
+	int display = 0;
+	bool highdpi = false;
+	bool sRGB = false;
+	double refreshrate = 0.0;
+};
 
 
 } // window
 } // window
 } // love
 } // love

+ 0 - 8
src/modules/window/sdl/Window.cpp

@@ -57,14 +57,6 @@ Window::~Window()
 	SDL_QuitSubSystem(SDL_INIT_VIDEO);
 	SDL_QuitSubSystem(SDL_INIT_VIDEO);
 }
 }
 
 
-Window::_currentMode::_currentMode()
-	: width(800)
-	, height(600)
-	, settings()
-	, icon(0)
-{
-}
-
 bool Window::setWindow(int width, int height, WindowSettings *settings)
 bool Window::setWindow(int width, int height, WindowSettings *settings)
 {
 {
 	WindowSettings f;
 	WindowSettings f;

+ 2 - 4
src/modules/window/sdl/Window.h

@@ -111,10 +111,8 @@ private:
 
 
 	struct _currentMode
 	struct _currentMode
 	{
 	{
-		_currentMode();
-
-		int width;
-		int height;
+		int width  = 800;
+		int height = 600;
 		WindowSettings settings;
 		WindowSettings settings;
 		Object::StrongRef<love::image::ImageData> icon;
 		Object::StrongRef<love::image::ImageData> icon;