aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2017-08-24 01:09:12 +0100
committerYann Herklotz <ymherklotz@gmail.com>2017-08-24 01:09:12 +0100
commitf96af48ad82f1ddfab1402ca5c6eafd82af2b217 (patch)
tree0eea4b97d600460f386cb82611ce40d3ccf1bc7d
parent5403490b941f7c031bf1aafdb91b1098f69edbf2 (diff)
downloadYAGE-f96af48ad82f1ddfab1402ca5c6eafd82af2b217.tar.gz
YAGE-f96af48ad82f1ddfab1402ca5c6eafd82af2b217.zip
Adding rules to clang-format.
-rw-r--r--.clang-format1
-rw-r--r--include/YAGE/Math/matrix.hpp12
-rw-r--r--include/YAGE/yage.hpp10
-rw-r--r--src/body.cpp10
-rw-r--r--src/inputmanager.cpp10
-rw-r--r--src/particlebody.cpp5
-rw-r--r--src/spritebatch.cpp5
-rw-r--r--src/window.cpp5
-rw-r--r--test/matrixtest.cpp5
-rw-r--r--test/windowtest.cpp5
-rw-r--r--test/yagetest.cpp5
11 files changed, 57 insertions, 16 deletions
diff --git a/.clang-format b/.clang-format
index 13ea9cc7..cedf99a1 100644
--- a/.clang-format
+++ b/.clang-format
@@ -4,6 +4,7 @@ IndentWidth: 4
---
Language: Cpp
AccessModifierOffset: -4
+AllowShortFunctionsOnASingleLine: Inline
AlwaysBreakTemplateDeclarations: true
BreakBeforeBraces: Linux
...
diff --git a/include/YAGE/Math/matrix.hpp b/include/YAGE/Math/matrix.hpp
index 249edcc7..e2dd1944 100644
--- a/include/YAGE/Math/matrix.hpp
+++ b/include/YAGE/Math/matrix.hpp
@@ -31,7 +31,8 @@
namespace yage
{
-template <int Rows, int Cols, class Type> class Matrix;
+template <int Rows, int Cols, class Type>
+class Matrix;
/** @internal Namespace for internal details.
*
@@ -51,7 +52,8 @@ namespace detail
*
* Internal Row class to return a value in the row of the matrix.
*/
-template <int Rows, int Cols, class Type> class Row
+template <int Rows, int Cols, class Type>
+class Row
{
private:
Matrix<Rows, Cols, Type> *parent_;
@@ -85,7 +87,8 @@ public:
* This is the base matrix class that can be used by all the other matrix
* like data structures.
*/
-template <int Rows = 4, int Cols = 4, class Type = double> class Matrix
+template <int Rows = 4, int Cols = 4, class Type = double>
+class Matrix
{
// friended with the row class so that it can access protected member data
friend class detail::Row<Rows, Cols, Type>;
@@ -323,7 +326,8 @@ public:
*
* Two dimensional vector class.
*/
-template <class Type = double> class Vector2 : public Vector<2, Type>
+template <class Type = double>
+class Vector2 : public Vector<2, Type>
{
public:
Vector2<Type>() : Vector<2, Type>() {}
diff --git a/include/YAGE/yage.hpp b/include/YAGE/yage.hpp
index b426eed9..50a1f857 100644
--- a/include/YAGE/yage.hpp
+++ b/include/YAGE/yage.hpp
@@ -28,8 +28,14 @@
namespace yage
{
-bool init() { return SDL_Init(SDL_INIT_VIDEO); }
-void quit() { SDL_Quit(); }
+bool init()
+{
+ return SDL_Init(SDL_INIT_VIDEO);
+}
+void quit()
+{
+ SDL_Quit();
+}
};
#endif
diff --git a/src/body.cpp b/src/body.cpp
index 96d01c22..036059a3 100644
--- a/src/body.cpp
+++ b/src/body.cpp
@@ -15,9 +15,15 @@ namespace yage
const double Body::GRAVITY = -9.81;
-double Body::xPosition() const { return position_[0]; }
+double Body::xPosition() const
+{
+ return position_[0];
+}
-double Body::yPosition() const { return position_[1]; }
+double Body::yPosition() const
+{
+ return position_[1];
+}
Body::Body(Vector2d position, double mass, Vector2d velocity, bool gravity)
: position_(std::move(position)), mass_(mass),
diff --git a/src/inputmanager.cpp b/src/inputmanager.cpp
index cbb9d2df..1595dba0 100644
--- a/src/inputmanager.cpp
+++ b/src/inputmanager.cpp
@@ -11,9 +11,15 @@
namespace yage
{
-void InputManager::keyPressed(unsigned key) { key_map_[key] = true; }
+void InputManager::keyPressed(unsigned key)
+{
+ key_map_[key] = true;
+}
-void InputManager::keyReleased(unsigned key) { key_map_[key] = false; }
+void InputManager::keyReleased(unsigned key)
+{
+ key_map_[key] = false;
+}
bool InputManager::isKeyPressed(unsigned key) const
{
diff --git a/src/particlebody.cpp b/src/particlebody.cpp
index 20682368..3eea4183 100644
--- a/src/particlebody.cpp
+++ b/src/particlebody.cpp
@@ -20,7 +20,10 @@ ParticleBody::ParticleBody(const Vector2d &position, double mass,
{
}
-void ParticleBody::applyForce(const Vector2d &force) { force_ += force; }
+void ParticleBody::applyForce(const Vector2d &force)
+{
+ force_ += force;
+}
void ParticleBody::update()
{
diff --git a/src/spritebatch.cpp b/src/spritebatch.cpp
index efca0b8d..4d4f1b19 100644
--- a/src/spritebatch.cpp
+++ b/src/spritebatch.cpp
@@ -43,7 +43,10 @@ SpriteBatch::~SpriteBatch()
}
}
-void SpriteBatch::init() { createVertexArray(); }
+void SpriteBatch::init()
+{
+ createVertexArray();
+}
void SpriteBatch::begin()
{
diff --git a/src/window.cpp b/src/window.cpp
index 14671bf9..6eca459d 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -18,7 +18,10 @@ namespace yage
Window::Window() = default;
-Window::~Window() { SDL_DestroyWindow(window_); }
+Window::~Window()
+{
+ SDL_DestroyWindow(window_);
+}
void Window::create(const std::string &window_name, int width, int height,
unsigned flags)
diff --git a/test/matrixtest.cpp b/test/matrixtest.cpp
index d388948b..bbcbb440 100644
--- a/test/matrixtest.cpp
+++ b/test/matrixtest.cpp
@@ -47,7 +47,10 @@ int vectorDotProduct(const std::vector<int> &vec_contents_f,
return x;
}
-bool matrixMultiplication() { return false; }
+bool matrixMultiplication()
+{
+ return false;
+}
// TESTS
diff --git a/test/windowtest.cpp b/test/windowtest.cpp
index 73e2f82c..22760c21 100644
--- a/test/windowtest.cpp
+++ b/test/windowtest.cpp
@@ -10,7 +10,10 @@
#include "yage.hpp"
-TEST(Window, Open) { ASSERT_TRUE(true); }
+TEST(Window, Open)
+{
+ ASSERT_TRUE(true);
+}
int main(int argc, char **argv)
{
diff --git a/test/yagetest.cpp b/test/yagetest.cpp
index 90d915a8..17ecf85a 100644
--- a/test/yagetest.cpp
+++ b/test/yagetest.cpp
@@ -10,7 +10,10 @@
#include "yage.hpp"
-TEST(YAGE, InitQuit) { ASSERT_TRUE(true); }
+TEST(YAGE, InitQuit)
+{
+ ASSERT_TRUE(true);
+}
int main(int argc, char **argv)
{