[Scripts] Add clang-format

This commit is contained in:
Andre Meyering 2018-10-31 14:45:06 +01:00
parent 8c992e539e
commit 96a0749d91
4 changed files with 173 additions and 168 deletions

View file

@ -1,6 +1,6 @@
---
Language: Cpp
BasedOnStyle: WebKit
ColumnLimit: 100
ColumnLimit: 0
FixNamespaceComments: true
...

View file

@ -0,0 +1,16 @@
#!/usr/bin/env bash
SCRIPT_PATH="$( cd "$(dirname "$0")" ; pwd -P )"
pushd "${SCRIPT_PATH}/.." > /dev/null
echo "Format all files using clang-format"
# We currently don't format test files
find . ! -path "./build/*" ! -path "./test/*" \
-type f \( -name "*.c" \
-o -name "*.hpp" \) \
-exec clang-format \
-i -style=file {} \;
popd > /dev/null

View file

@ -4,7 +4,8 @@
int width = 800;
int height = 600;
void init(int argc, char** argv) {
void init(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE);
glutInitWindowSize(width, height);
@ -17,7 +18,6 @@ void init(int argc, char** argv) {
glOrtho(-2.0, 2.0, -2.0, 2.0, -2.0, 2.0);
gluLookAt(0.25, 0.5, 0.1, 0, 0, 0, 0, 1, 0);
////////////////////////////////////////////////////////////////////
glEnable(GL_CULL_FACE);
@ -26,7 +26,6 @@ void init(int argc, char** argv) {
////////////////////////////////////////////////////////////////////
}
void display(void)
{
@ -72,7 +71,6 @@ void display(void)
glFlush();
}
int main(int argc, char** argv)
{
init(argc, argv);
@ -80,5 +78,3 @@ int main(int argc, char** argv)
glutMainLoop();
return 0;
}

View file

@ -1,7 +1,7 @@
#include <GL/glut.h>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#define PI 3.14159265358979323846
#define PIf 3.14159265358979323846f
@ -9,7 +9,8 @@
static int width = 800;
static int height = 600;
void init(int argc, char** argv) {
void init(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE);
glutInitWindowSize(width, height);
@ -25,7 +26,9 @@ void init(int argc, char** argv) {
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
void drawCoordinateSystem(float* origin, int xLength, int yLength, int numTicksX, int numTicksY, float minX, float maxX, float minY, float maxY) {
void drawCoordinateSystem(float* origin, int xLength, int yLength, int numTicksX, int numTicksY,
float minX, float maxX, float minY, float maxY)
{
float xTickDistance = (float)xLength / (float)numTicksX;
float yTickDistance = (float)yLength / (float)numTicksY;
@ -83,7 +86,6 @@ void drawCoordinateSystem(float* origin, int xLength, int yLength, int numTicksX
}
}
void drawCircle(float origin[2], float center[2], float radius, GLint numPoints)
{
//////////////////////////////////////////////////////////////////////////////////////////////
@ -103,9 +105,6 @@ void drawCircle(float origin[2], float center[2], float radius, GLint numPoints)
//////////////////////////////////////////////////////////////////////////////////////////////
}
void display(void)
{
int n;
@ -120,7 +119,6 @@ void display(void)
int yLength = 400;
float size = 2;
/* settings for the coordinate system */
int numTicksX = 6;
int numTicksY = 4;
@ -135,7 +133,6 @@ void display(void)
drawCoordinateSystem(origin, xLength, yLength, numTicksX, numTicksY, minX, maxX, minY, maxY);
for (n = 0; n < 3; n++) {
///////////////////////////////////////////////////////////////////////////////
@ -157,11 +154,9 @@ void display(void)
drawCircle(origin, center, radius[n], numPoints);
}
glFlush();
}
int main(int argc, char** argv)
{
init(argc, argv);
@ -170,5 +165,3 @@ int main(int argc, char** argv)
glutMainLoop();
return 0;
}