Skip to content

Commit

Permalink
clang-formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
mls-m5 committed Jun 14, 2020
1 parent e3655df commit 89075cd
Show file tree
Hide file tree
Showing 21 changed files with 1,505 additions and 1,505 deletions.
18 changes: 18 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

Language: Cpp
BasedOnStyle: LLVM
IndentWidth: 4
SortIncludes: true
AccessModifierOffset: -4
AlwaysBreakTemplateDeclarations: true
AllowShortFunctionsOnASingleLine: None
#AllowAllArgumentsOnNextLine: true
BinPackArguments: false
BinPackParameters: false
BreakBeforeBraces: Custom
BraceWrapping:
BeforeCatch: true
BeforeElse: true

AlwaysBreakAfterReturnType: None
PenaltyReturnTypeOnItsOwnLine: 1000000
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,10 @@ rym.exe
rym.pro
rym.pro.user

rym.cflags
rym.config
rym.creator
rym.cxxflags
rym.files
rym.includes
rym.creator.user
2 changes: 1 addition & 1 deletion .settings/language.settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1857985525194055588" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="565444017656832857" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
Expand Down
19 changes: 9 additions & 10 deletions broadphase.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,21 @@
* Author: Mattias Larsson Sköld
*/


#pragma once
#include "vec.h"

#include "graf.h"
#include "vec.h"

using game::obj::Unit;

class BroadPhase {
public:
virtual ~BroadPhase() = default;
virtual class Unit *getNearest(Vec &p, double limit, Unit *ignore) = 0;
virtual class Unit *collision(Vec &p, Unit *ignore) = 0;
virtual void add(Unit* u) = 0;
virtual void update(double t) = 0;
virtual void removeDead() = 0;
virtual void draw() = 0;
virtual void setCenter(Vec center) = 0;
virtual class Unit *getNearest(Vec &p, double limit, Unit *ignore) = 0;
virtual class Unit *collision(Vec &p, Unit *ignore) = 0;
virtual void add(Unit *u) = 0;
virtual void update(double t) = 0;
virtual void removeDead() = 0;
virtual void draw() = 0;
virtual void setCenter(Vec center) = 0;
};

2 changes: 0 additions & 2 deletions common.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
* Author: Mattias Larsson Sköld
*/


#pragma once

constexpr double pi = 3.1415926535897932384626433832795028841971693;
constexpr double pi2 = pi * 2;
constexpr float pif = static_cast<float>(pi);
constexpr float pi2f = static_cast<float>(pi2);

148 changes: 67 additions & 81 deletions draw-gl1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,117 +2,103 @@
* draw-win.cpp
*
* Created on: 15 jan. 2016
* Author: mattr
* Author: Mattias Larsson SKöld
*/

#include "draw.h"
#include "GL/gl.h"
#include "draw.h"

#include <iostream>

constexpr double angularMultiplier = 180. / pi;



using namespace std;

void modelTransform(Vec p, double a, double scale) {

void modelTransform(Vec /*p*/, double /*a*/, double /*scale*/) {
}

void resetTransform() {

}
void setCam(Vec p, double a) {
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glRotatef(-a * angularMultiplier, 0,0,1);
glScalef(.05,.05,.05);
glTranslatef(-p.x, -p.y, 0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glRotated(-a * angularMultiplier, 0, 0, 1);
glScaled(.05, .05, .05);
glTranslated(-p.x, -p.y, 0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
void camTransform() {

}

void drawShip(Vec p, double a) {
glPushMatrix();
glTranslatef(p.x, p.y, 0);
glRotatef(a * angularMultiplier, 0,0,1);
glBegin(GL_TRIANGLES);
glColor3f(1,1,1);
glVertex2f(0.f, 1.f);
glVertex2f(.5f, -1.f);
glVertex2f(-.5f, -1.f);
glEnd();
glPopMatrix();

glPushMatrix();
glTranslated(p.x, p.y, 0);
glRotated(a * angularMultiplier, 0, 0, 1);
glBegin(GL_TRIANGLES);
glColor3f(1, 1, 1);
glVertex2f(0.f, 1.f);
glVertex2f(.5f, -1.f);
glVertex2f(-.5f, -1.f);
glEnd();
glPopMatrix();
}
void drawStar(Vec p) {

void drawStar(Vec /*p*/) {
}



void drawArea(Vec p, double a, double r) {
glPushMatrix();
glTranslatef(p.x, p.y, 0);
glScalef(r, r, r);
glRotatef(a, 0,0,1);
glBegin(GL_LINE_LOOP);
glColor3f(.8,.8, 1);
glVertex2f(-1, -1);
glVertex2f(-1, 1);
glVertex2f(1, 1);
glVertex2f(1, -1);
glEnd();
glPopMatrix();
glPushMatrix();
glTranslated(p.x, p.y, 0);
glScaled(r, r, r);
glRotated(a, 0, 0, 1);
glBegin(GL_LINE_LOOP);
glColor3f(.8f, .8f, 1);
glVertex2f(-1, -1);
glVertex2f(-1, 1);
glVertex2f(1, 1);
glVertex2f(1, -1);
glEnd();
glPopMatrix();
}


void drawComet(Vec p, double a, double r) {
glPushMatrix();
glTranslatef(p.x, p.y, 0);
glScalef(r, r, r);
glRotatef(a, 0,0,1);
glBegin(GL_TRIANGLE_FAN);
glColor3f(.8,.8, 1);
glVertex2f(-1, -1);
glVertex2f(-1, 1);
glVertex2f(1, 1);
glVertex2f(1, -1);
glEnd();
glPopMatrix();
glPushMatrix();
glTranslated(p.x, p.y, 0);
glScaled(r, r, r);
glRotated(a, 0, 0, 1);
glBegin(GL_TRIANGLE_FAN);
glColor3f(.8f, .8f, 1.f);
glVertex2f(-1, -1);
glVertex2f(-1, 1);
glVertex2f(1, 1);
glVertex2f(1, -1);
glEnd();
glPopMatrix();
}
void drawProjectile(Vec p, double a, double scale) {

void drawProjectile(Vec /*p*/, double /*a*/, double /*scale*/) {
}
void drawExplosion(Vec p, double size) {
glPushMatrix();
glTranslatef(p.x, p.y, 0);
glScalef(size, size, size);
glBegin(GL_TRIANGLE_FAN);
glColor3f(.8,.8, 1);
glVertex2f(-1, -1);
glVertex2f(-1, 1);
glVertex2f(1, 1);
glVertex2f(1, -1);
glEnd();
glPopMatrix();

glPushMatrix();
glTranslated(p.x, p.y, 0);
glScaled(size, size, size);
glBegin(GL_TRIANGLE_FAN);
glColor3d(.8, .8, 1);
glVertex2f(-1, -1);
glVertex2f(-1, 1);
glVertex2f(1, 1);
glVertex2f(1, -1);
glEnd();
glPopMatrix();
}
void drawSmoke(Vec p1, Vec p2, double alpha1, double alpha2){
glBegin(GL_LINES);
glColor4f(1,1,1, alpha2);
glVertex3dv(&p1.x);
glVertex3dv(&p2.x);
glEnd();
void drawSmoke(Vec p1, Vec p2, double /*alpha1*/, double alpha2) {
glBegin(GL_LINES);
glColor4d(1, 1, 1, alpha2);
glVertex3dv(&p1.x);
glVertex3dv(&p2.x);
glEnd();
}
bool initDrawModule(double perspective){

bool initDrawModule(double /*perspective*/) {
return false;
}
void flushDraw(){

void flushDraw() {
}


Loading

0 comments on commit 89075cd

Please sign in to comment.