Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Use cxx and hxx extensions for C++ source files

  • Loading branch information...
commit 6eab07f0d52a29791059d7d1b4cabc12ecb6c703 1 parent 61f6563
alexander-b authored May 02, 2012

Showing 41 changed files with 101 additions and 99 deletions. Show diff stats Hide diff stats

  1. 6  HACKING
  2. 78  Makefile.am
  3. 0  src/{action.h → action.hxx}
  4. 2  src/{actor.cpp → actor.cxx}
  5. 2  src/{actor.h → actor.hxx}
  6. 6  src/bin/{limbs_off.cpp → limbs_off.cxx}
  7. 4  src/{character.cpp → character.cxx}
  8. 4  src/{character.h → character.hxx}
  9. 2  src/{collision_handler.cpp → collision_handler.cxx}
  10. 4  src/{collision_handler.h → collision_handler.hxx}
  11. 4  src/{config_parser.cpp → config_parser.cxx}
  12. 2  src/{config_parser.h → config_parser.hxx}
  13. 0  src/{event_code.h → event_code.hxx}
  14. 0  src/{event_handler.h → event_handler.hxx}
  15. 8  src/{game.h → game.hxx}
  16. 6  src/game/{game.cpp → game.cxx}
  17. 4  src/{geometry.h → geometry.hxx}
  18. 2  src/{geometry_inl.h → geometry_inl.hxx}
  19. 0  src/{graphics.h → graphics.hxx}
  20. 8  src/graphics/{game_graphics_gl.h → game_graphics_gl.hxx}
  21. 2  src/graphics/game_graphics_gl/{camera.cpp → camera.cxx}
  22. 4  src/graphics/game_graphics_gl/{graphic.cpp → graphic.cxx}
  23. 2  src/graphics/game_graphics_gl/{screen.cpp → screen.cxx}
  24. 2  src/graphics/game_graphics_gl/{texture_loader.cpp → texture_loader.cxx}
  25. 2  src/graphics/{graphics.cpp → graphics.cxx}
  26. 4  src/{menu.h → menu.hxx}
  27. 4  src/menu/{menu.cpp → menu.cxx}
  28. 2  src/menu/{submenu.cpp → submenu.cxx}
  29. 4  src/{physics.h → physics.hxx}
  30. 2  src/physics/{game_physics.h → game_physics.hxx}
  31. 6  src/physics/game_physics/{game_physics.cpp → game_physics.cxx}
  32. 2  src/physics/{physics.cpp → physics.cxx}
  33. 2  src/{physics_inl.h → physics_inl.hxx}
  34. 4  src/{player.cpp → player.cxx}
  35. 8  src/{player.h → player.hxx}
  36. 2  src/{screen_element.cpp → screen_element.cxx}
  37. 0  src/{screen_element.h → screen_element.hxx}
  38. 2  src/{step_timer.cpp → step_timer.cxx}
  39. 0  src/{step_timer.h → step_timer.hxx}
  40. 2  src/{template_math.h → template_math.hxx}
  41. 2  src/{template_math_inl.h → template_math_inl.hxx}
6  HACKING
@@ -39,14 +39,16 @@ lowercase letter.
39 39
 
40 40
 -Comments
41 41
 Comments in header files that describe what the procedure, class or data 
42  
-member is for. Comments in cpp-files where complexity dictates a need for 
  42
+member is for. Comments in source files where complexity dictates a need for 
43 43
 them. TODOs and FIXMEs where needed.
44 44
 
45 45
 -File Naming
46 46
 Descriptive header file names. C++ source file names that are depending on a 
47 47
 single header are named the same as the header. Headers that are monumental to 
48 48
 several C++ sources are put in a directory that has the same name as the 
49  
-header. Exclusively lowercase letters with underscores in place of spaces.
  49
+header. Exclusively lowercase letters with underscores in place of spaces. 
  50
+Suffix for source code files should be ".cxx". Header files are suffixed 
  51
+".hxx".
50 52
 
51 53
 -Declaration order in classes
52 54
 Class variables and procedures are declared in this specific order: public, 
78  Makefile.am
@@ -48,45 +48,45 @@ AM_CFLAGS =\
48 48
 bin_PROGRAMS = limbs-off
49 49
 
50 50
 limbs_off_SOURCES = \
51  
-	src/config_parser.h \
52  
-	src/config_parser.cpp \
53  
-	src/step_timer.h \
54  
-	src/step_timer.cpp \
55  
-	src/template_math.h \
56  
-	src/template_math_inl.h \
57  
-	src/geometry.h \
58  
-	src/geometry_inl.h \
59  
-	src/physics.h \
60  
-	src/physics_inl.h \
61  
-	src/physics/physics.cpp \
62  
-	src/physics/game_physics.h \
63  
-	src/physics/game_physics/game_physics.cpp \
64  
-	src/graphics.h \
65  
-	src/graphics/graphics.cpp \
66  
-	src/graphics/game_graphics_gl.h \
67  
-	src/graphics/game_graphics_gl/camera.cpp \
68  
-	src/graphics/game_graphics_gl/graphic.cpp \
69  
-	src/graphics/game_graphics_gl/screen.cpp \
70  
-	src/graphics/game_graphics_gl/texture_loader.cpp \
71  
-	src/event_code.h \
72  
-	src/screen_element.h \
73  
-	src/screen_element.cpp \
74  
-	src/menu.h \
75  
-	src/menu/menu.cpp \
76  
-	src/menu/submenu.cpp \
77  
-	src/event_handler.h \
78  
-	src/collision_handler.h \
79  
-	src/collision_handler.cpp \
80  
-	src/character.h \
81  
-	src/character.cpp \
82  
-	src/action.h \
83  
-	src/actor.h \
84  
-	src/actor.cpp \
85  
-	src/player.h \
86  
-	src/player.cpp \
87  
-	src/game.h \
88  
-	src/game/game.cpp \
89  
-	src/bin/limbs_off.cpp
  51
+	src/config_parser.hxx \
  52
+	src/config_parser.cxx \
  53
+	src/step_timer.hxx \
  54
+	src/step_timer.cxx \
  55
+	src/template_math.hxx \
  56
+	src/template_math_inl.hxx \
  57
+	src/geometry.hxx \
  58
+	src/geometry_inl.hxx \
  59
+	src/physics.hxx \
  60
+	src/physics_inl.hxx \
  61
+	src/physics/physics.cxx \
  62
+	src/physics/game_physics.hxx \
  63
+	src/physics/game_physics/game_physics.cxx \
  64
+	src/graphics.hxx \
  65
+	src/graphics/graphics.cxx \
  66
+	src/graphics/game_graphics_gl.hxx \
  67
+	src/graphics/game_graphics_gl/camera.cxx \
  68
+	src/graphics/game_graphics_gl/graphic.cxx \
  69
+	src/graphics/game_graphics_gl/screen.cxx \
  70
+	src/graphics/game_graphics_gl/texture_loader.cxx \
  71
+	src/event_code.hxx \
  72
+	src/screen_element.hxx \
  73
+	src/screen_element.cxx \
  74
+	src/menu.hxx \
  75
+	src/menu/menu.cxx \
  76
+	src/menu/submenu.cxx \
  77
+	src/event_handler.hxx \
  78
+	src/collision_handler.hxx \
  79
+	src/collision_handler.cxx \
  80
+	src/character.hxx \
  81
+	src/character.cxx \
  82
+	src/action.hxx \
  83
+	src/actor.hxx \
  84
+	src/actor.cxx \
  85
+	src/player.hxx \
  86
+	src/player.cxx \
  87
+	src/game.hxx \
  88
+	src/game/game.cxx \
  89
+	src/bin/limbs_off.cxx
90 90
 
91 91
 limbs_off_LDFLAGS = 
92 92
 
0  src/action.h → src/action.hxx
File renamed without changes
2  src/actor.cpp → src/actor.cxx
@@ -17,7 +17,7 @@
17 17
  * along with Limbs Off.  If not, see <http://www.gnu.org/licenses/>.
18 18
  */
19 19
 
20  
-#include "actor.h"
  20
+#include "actor.hxx"
21 21
 
22 22
 Actor::Actor(Character* character) :
23 23
     character_(character) {
2  src/actor.h → src/actor.hxx
@@ -20,7 +20,7 @@
20 20
 #ifndef ACTOR_H_
21 21
 #define ACTOR_H_ 
22 22
 
23  
-#include "character.h"
  23
+#include "character.hxx"
24 24
 
25 25
 class Actor {
26 26
 public:
6  src/bin/limbs_off.cpp → src/bin/limbs_off.cxx
@@ -24,9 +24,9 @@
24 24
 
25 25
 #include <GL/gl.h>
26 26
 #include <SDL/SDL.h>
27  
-#include "event_code.h"
28  
-#include "game.h"
29  
-#include "menu.h"
  27
+#include "event_code.hxx"
  28
+#include "game.hxx"
  29
+#include "menu.hxx"
30 30
 
31 31
 int main(int argc, char *argv[]) {
32 32
 
4  src/character.cpp → src/character.cxx
@@ -18,8 +18,8 @@
18 18
  * along with Limbs Off.  If not, see <http://www.gnu.org/licenses/>.
19 19
  */
20 20
 
21  
-#include "character.h"
22  
-#include "collision_handler.h"
  21
+#include "character.hxx"
  22
+#include "collision_handler.hxx"
23 23
 
24 24
 int Character::collisionGroup_ = 0;
25 25
 
4  src/character.h → src/character.hxx
@@ -21,8 +21,8 @@
21 21
 #ifndef CHARACTER_H_
22 22
 #define CHARACTER_H_
23 23
 
24  
-#include "graphics/game_graphics_gl.h"
25  
-#include "physics/game_physics.h"
  24
+#include "graphics/game_graphics_gl.hxx"
  25
+#include "physics/game_physics.hxx"
26 26
 
27 27
 class Character {
28 28
 public:
2  src/collision_handler.cpp → src/collision_handler.cxx
@@ -17,7 +17,7 @@
17 17
  * along with Limbs Off.  If not, see <http://www.gnu.org/licenses/>.
18 18
  */
19 19
 
20  
-#include "collision_handler.h"
  20
+#include "collision_handler.hxx"
21 21
 
22 22
 CollisionHandler* CollisionHandler::instance_ = NULL;
23 23
 
4  src/collision_handler.h → src/collision_handler.hxx
@@ -21,8 +21,8 @@
21 21
 #define COLLISION_HANDLER_H_
22 22
 
23 23
 #include <map>
24  
-#include "character.h"
25  
-#include "physics.h"
  24
+#include "character.hxx"
  25
+#include "physics.hxx"
26 26
 
27 27
 class CollisionHandler {
28 28
 public:
4  src/config_parser.cpp → src/config_parser.cxx
@@ -19,8 +19,8 @@
19 19
 
20 20
 #include <fstream>
21 21
 #include <string>
22  
-#include "config_parser.h"
23  
-#include "player.h"
  22
+#include "config_parser.hxx"
  23
+#include "player.hxx"
24 24
 
25 25
 using namespace std;
26 26
 
2  src/config_parser.h → src/config_parser.hxx
@@ -20,7 +20,7 @@
20 20
 #ifndef CONFIG_PARSER_H_
21 21
 #define CONFIG_PARSER_H_
22 22
 
23  
-#include "player.h"
  23
+#include "player.hxx"
24 24
 
25 25
 namespace ConfigParser {
26 26
 /** Opens the config and reads the keys. */
0  src/event_code.h → src/event_code.hxx
File renamed without changes
0  src/event_handler.h → src/event_handler.hxx
File renamed without changes
8  src/game.h → src/game.hxx
@@ -21,10 +21,10 @@
21 21
 #ifndef GAME_H_
22 22
 #define GAME_H_
23 23
 
24  
-#include "graphics/game_graphics_gl.h"
25  
-#include "physics/game_physics.h"
26  
-#include "player.h"
27  
-#include "step_timer.h"
  24
+#include "graphics/game_graphics_gl.hxx"
  25
+#include "physics/game_physics.hxx"
  26
+#include "player.hxx"
  27
+#include "step_timer.hxx"
28 28
 
29 29
 class Game : public EventHandler {
30 30
 public:
6  src/game/game.cpp → src/game/game.cxx
@@ -23,9 +23,9 @@
23 23
 #endif
24 24
 
25 25
 #include <SDL/SDL.h>
26  
-#include "game.h"
27  
-#include "menu.h"
28  
-#include "config_parser.h"
  26
+#include "game.hxx"
  27
+#include "menu.hxx"
  28
+#include "config_parser.hxx"
29 29
 
30 30
 const double Game::MAX_FPS = 200;
31 31
 const double Game::STEPS_PER_SECOND = 600;
4  src/geometry.h → src/geometry.hxx
@@ -20,7 +20,7 @@
20 20
 #ifndef GEOMETRY_H_
21 21
 #define GEOMETRY_H_
22 22
 
23  
-#include "template_math.h"
  23
+#include "template_math.hxx"
24 24
 
25 25
 #define PI (3.141592653589793)
26 26
 #define IN_DEG (180.0 / PI)
@@ -96,6 +96,6 @@ class Circle: public Shape<T> {
96 96
 template<typename T>
97 97
 bool intersectLineCircle(vector2<T> a, vector2<T> b, T rr, T& t1, T& t2);
98 98
 
99  
-#include "geometry_inl.h"
  99
+#include "geometry_inl.hxx"
100 100
 
101 101
 #endif /* GEOMETRY_H_ */
2  src/geometry_inl.h → src/geometry_inl.hxx
@@ -20,7 +20,7 @@
20 20
 #ifndef GEOMETRY_INL_H_
21 21
 #define GEOMETRY_INL_H_
22 22
 
23  
-#include "geometry.h"
  23
+#include "geometry.hxx"
24 24
 
25 25
 template<typename T>
26 26
 inline vector2<T> vector2<T>::fromAngle(T angle) {
0  src/graphics.h → src/graphics.hxx
File renamed without changes
8  src/graphics/game_graphics_gl.h → src/graphics/game_graphics_gl.hxx
@@ -25,10 +25,10 @@
25 25
 #include <GL/gl.h>
26 26
 #include <SDL/SDL.h>
27 27
 #include <SDL/SDL_ttf.h>
28  
-#include "graphics.h"
29  
-#include "menu.h"
30  
-#include "physics.h"
31  
-#include "screen_element.h"
  28
+#include "graphics.hxx"
  29
+#include "menu.hxx"
  30
+#include "physics.hxx"
  31
+#include "screen_element.hxx"
32 32
 
33 33
 // We should make prototypes for all the classes or solve the problems that
34 34
 // cause the need for them in the first place. This looks a bit silly Lulzy
2  src/graphics/game_graphics_gl/camera.cpp → src/graphics/game_graphics_gl/camera.cxx
@@ -20,7 +20,7 @@
20 20
 
21 21
 #include <stdio.h>
22 22
 #include <math.h>
23  
-#include "graphics/game_graphics_gl.h"
  23
+#include "graphics/game_graphics_gl.hxx"
24 24
 
25 25
 Camera::Camera(state2p state, GLfloat radius, GLfloat rotation) :
26 26
     state_(state), targetState_(state), radius_(radius), targetRadius_(radius),
4  src/graphics/game_graphics_gl/graphic.cpp → src/graphics/game_graphics_gl/graphic.cxx
@@ -20,8 +20,8 @@
20 20
 
21 21
 #include <math.h>
22 22
 #include <fontconfig/fontconfig.h>
23  
-#include "graphics/game_graphics_gl.h"
24  
-#include "geometry.h"
  23
+#include "graphics/game_graphics_gl.hxx"
  24
+#include "geometry.hxx"
25 25
 
26 26
 GraphicFixture::GraphicFixture(Body* body) :
27 27
     body_(body) {
2  src/graphics/game_graphics_gl/screen.cpp → src/graphics/game_graphics_gl/screen.cxx
@@ -19,7 +19,7 @@
19 19
  */
20 20
 
21 21
 #include <SDL/SDL.h>
22  
-#include "graphics/game_graphics_gl.h"
  22
+#include "graphics/game_graphics_gl.hxx"
23 23
 
24 24
 bool Screen::fullscreen_ = false;
25 25
 int Screen::surfaceWidth_ = 640;
2  src/graphics/game_graphics_gl/texture_loader.cpp → src/graphics/game_graphics_gl/texture_loader.cxx
@@ -18,7 +18,7 @@
18 18
  */
19 19
 
20 20
 #include <png.h>
21  
-#include "graphics/game_graphics_gl.h"
  21
+#include "graphics/game_graphics_gl.hxx"
22 22
 
23 23
 const GLint FORMAT[] = { GL_LUMINANCE, GL_LUMINANCE_ALPHA, GL_RGB, GL_RGBA };
24 24
 
2  src/graphics/graphics.cpp → src/graphics/graphics.cxx
@@ -17,7 +17,7 @@
17 17
  * along with Limbs Off.  If not, see <http://www.gnu.org/licenses/>.
18 18
  */
19 19
 
20  
-#include "graphics.h"
  20
+#include "graphics.hxx"
21 21
 
22 22
 GraphicModifier::~GraphicModifier() {
23 23
 }
4  src/menu.h → src/menu.hxx
@@ -21,8 +21,8 @@
21 21
 #define MENU_H_
22 22
 
23 23
 #include <vector>
24  
-#include "event_handler.h"
25  
-#include "screen_element.h"
  24
+#include "event_handler.hxx"
  25
+#include "screen_element.hxx"
26 26
 
27 27
 class Submenu {
28 28
 public:
4  src/menu/menu.cpp → src/menu/menu.cxx
@@ -23,8 +23,8 @@
23 23
 
24 24
 #include <GL/gl.h>
25 25
 #include <SDL/SDL_ttf.h>
26  
-#include "event_code.h"
27  
-#include "menu.h"
  26
+#include "event_code.hxx"
  27
+#include "menu.hxx"
28 28
 
29 29
 Menu::Menu() {
30 30
     menus_[MAINMENU] = new Submenu();
2  src/menu/submenu.cpp → src/menu/submenu.cxx
@@ -18,7 +18,7 @@
18 18
  */
19 19
 
20 20
 #include <GL/glu.h>
21  
-#include "menu.h"
  21
+#include "menu.hxx"
22 22
 
23 23
 Submenu::Submenu() {
24 24
 }
4  src/physics.h → src/physics.hxx
@@ -22,7 +22,7 @@
22 22
 
23 23
 #include <math.h>
24 24
 #include <list>
25  
-#include "geometry.h"
  25
+#include "geometry.hxx"
26 26
 
27 27
 typedef double phys_t;
28 28
 
@@ -154,6 +154,6 @@ vector2p bounce1(Body* a, Body* b, vector2p& pa, vector2p pb, vector2p n,
154 154
 vector2p bounce2(Body* a, Body* b, vector2p& pa, vector2p& pb, vector2p n,
155 155
         phys_t restitution, phys_t friction, phys_t rr, phys_t addVel);
156 156
 
157  
-#include "physics_inl.h"
  157
+#include "physics_inl.hxx"
158 158
 
159 159
 #endif /* PHYSICS_H_ */
2  src/physics/game_physics.h → src/physics/game_physics.hxx
@@ -22,7 +22,7 @@
22 22
 #define GAME_PHYSICS_H_
23 23
 
24 24
 #include <vector>
25  
-#include "physics.h"
  25
+#include "physics.hxx"
26 26
 
27 27
 class Character;
28 28
 class Universe;
6  src/physics/game_physics/game_physics.cpp → src/physics/game_physics/game_physics.cxx
@@ -19,9 +19,9 @@
19 19
  */
20 20
 
21 21
 #include <math.h>
22  
-#include "collision_handler.h"
23  
-#include "geometry.h"
24  
-#include "physics/game_physics.h"
  22
+#include "collision_handler.hxx"
  23
+#include "geometry.hxx"
  24
+#include "physics/game_physics.hxx"
25 25
 
26 26
 SmallBody::SmallBody(state2p s, phys_t mass, phys_t orientation, phys_t av,
27 27
         phys_t moi, Shape<phys_t>* shape, int collisionGroup) :
2  src/physics/physics.cpp → src/physics/physics.cxx
@@ -17,7 +17,7 @@
17 17
  * along with Limbs Off.  If not, see <http://www.gnu.org/licenses/>.
18 18
  */
19 19
 
20  
-#include "physics.h"
  20
+#include "physics.hxx"
21 21
 
22 22
 void CollisionQueue::add(Collision c) {
23 23
     std::list<Collision>::iterator other, end = collisions_.end();
2  src/physics_inl.h → src/physics_inl.hxx
@@ -20,7 +20,7 @@
20 20
 #ifndef PHYSICS_INL_H_
21 21
 #define PHYSICS_INL_H_
22 22
 
23  
-#include "physics.h"
  23
+#include "physics.hxx"
24 24
 
25 25
 template<typename T>
26 26
 inline const state1<T> state1<T>::operator()(const T p0, const T v0) {
4  src/player.cpp → src/player.cxx
@@ -18,8 +18,8 @@
18 18
  */
19 19
 
20 20
 #include <SDL/SDL.h>
21  
-#include "character.h"
22  
-#include "player.h"
  21
+#include "character.hxx"
  22
+#include "player.hxx"
23 23
 
24 24
 Player::Player(Character* character) :
25 25
     Actor(character) {
8  src/player.h → src/player.hxx
@@ -20,10 +20,10 @@
20 20
 #ifndef PLAYER_H_
21 21
 #define PLAYER_H_ 
22 22
 
23  
-#include "actor.h"
24  
-#include "action.h"
25  
-#include "character.h"
26  
-#include "event_handler.h"
  23
+#include "actor.hxx"
  24
+#include "action.hxx"
  25
+#include "character.hxx"
  26
+#include "event_handler.hxx"
27 27
 
28 28
 class Player: public Actor, public EventHandler {
29 29
 public:
2  src/screen_element.cpp → src/screen_element.cxx
@@ -17,7 +17,7 @@
17 17
  * along with Limbs Off.  If not, see <http://www.gnu.org/licenses/>.
18 18
  */
19 19
 
20  
-#include "screen_element.h"
  20
+#include "screen_element.hxx"
21 21
 #include <stdlib.h>
22 22
 #include <string.h>
23 23
 
0  src/screen_element.h → src/screen_element.hxx
File renamed without changes
2  src/step_timer.cpp → src/step_timer.cxx
@@ -17,7 +17,7 @@
17 17
  * along with Limbs Off.  If not, see <http://www.gnu.org/licenses/>.
18 18
  */
19 19
 
20  
-#include "step_timer.h"
  20
+#include "step_timer.hxx"
21 21
 
22 22
 StepTimer::StepTimer() :
23 23
     time_(0.0), targetTime_(0.0), deltaTargetTime_(0.0) {
0  src/step_timer.h → src/step_timer.hxx
File renamed without changes
2  src/template_math.h → src/template_math.hxx
@@ -56,6 +56,6 @@ T max(T x, T y);
56 56
 template<typename T>
57 57
 T clampmag(T x, T m);
58 58
 
59  
-#include "template_math_inl.h"
  59
+#include "template_math_inl.hxx"
60 60
 
61 61
 #endif /* TEMPLATE_MATH_H_ */
2  src/template_math_inl.h → src/template_math_inl.hxx
@@ -20,7 +20,7 @@
20 20
 #ifndef TEMPLATE_MATH_INL_H_
21 21
 #define TEMPLATE_MATH_INL_H_
22 22
 
23  
-#include "template_math.h"
  23
+#include "template_math.hxx"
24 24
 
25 25
 template<>
26 26
 inline float sqrt<float> (float x) {

0 notes on commit 6eab07f

Please sign in to comment.
Something went wrong with that request. Please try again.