From c56da9642ef016cabcd12fd8ffd2b89e872ce9c9 Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Sat, 17 Jan 2009 15:10:26 +0000 Subject: [PATCH] Add forward declarations headers --- src/GameObjFwd.hpp | 26 ++++++++++++++++++++++++++ src/GraphicsFwd.hpp | 24 ++++++++++++++++++++++++ src/Makefile.am | 4 ++-- src/Missile.cpp | 4 ++++ src/Missile.hpp | 6 ++---- 5 files changed, 58 insertions(+), 6 deletions(-) create mode 100644 src/GameObjFwd.hpp create mode 100644 src/GraphicsFwd.hpp diff --git a/src/GameObjFwd.hpp b/src/GameObjFwd.hpp new file mode 100644 index 0000000..a05bdb8 --- /dev/null +++ b/src/GameObjFwd.hpp @@ -0,0 +1,26 @@ +// +// GameObjFwd.hpp -- Forward declaration for most game objects. +// Copyright (C) 2008 Nick Gasson +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// + +#ifndef INC_GAMEOBJFWD_HPP +#define INC_GAMEOBJFWD_HPP + +class Ship; +class ObjectGrid; +class Viewport; + +#endif diff --git a/src/GraphicsFwd.hpp b/src/GraphicsFwd.hpp new file mode 100644 index 0000000..1a007df --- /dev/null +++ b/src/GraphicsFwd.hpp @@ -0,0 +1,24 @@ +// +// GraphicsFwd.hpp -- Forward declaration for most graphics objects. +// Copyright (C) 2008 Nick Gasson +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// + +#ifndef INC_GRAPHICSFWD_HPP +#define INC_GRAPHICSFWD_HPP + +class Image; + +#endif diff --git a/src/Makefile.am b/src/Makefile.am index 396b204..9addefa 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -5,7 +5,7 @@ AM_CXXFLAGS=$(LANDER_CFLAGS) $(SDL_CFLAGS) -Wall AM_LDFLAGS=$(LANDER_LIBS) $(SDL_LIBS) -lGLU $(LTLIBINTL) lander_SOURCES = Main.cpp Game.hpp Game.cpp \ Font.cpp Font.hpp HighScores.cpp HighScores.hpp Input.cpp \ - Input.hpp Platform.hpp LoadOnce.hpp \ + Input.hpp Platform.hpp LoadOnce.hpp GraphicsFwd.hpp \ OpenGL.cpp OpenGL.hpp Menu.cpp Menu.hpp Emitter.cpp \ Emitter.hpp ScreenManager.cpp ScreenManager.hpp \ ObjectGrid.hpp ObjectGrid.cpp Asteroid.hpp Asteroid.cpp \ @@ -16,7 +16,7 @@ lander_SOURCES = Main.cpp Game.hpp Game.cpp \ Image.cpp AnimatedImage.hpp AnimatedImage.cpp \ Texture.hpp Texture.cpp Options.hpp Options.cpp \ ConfigFile.hpp ConfigFile.cpp SoundEffect.hpp \ - SoundEffect.cpp Fade.hpp Fade.cpp + SoundEffect.cpp Fade.hpp Fade.cpp GameObjFwd.hpp localedir = $(datadir)/locale diff --git a/src/Missile.cpp b/src/Missile.cpp index 27849bd..be8f331 100644 --- a/src/Missile.cpp +++ b/src/Missile.cpp @@ -16,8 +16,12 @@ // along with this program. If not, see . // +#include "Platform.hpp" #include "Missile.hpp" #include "LoadOnce.hpp" +#include "Image.hpp" +#include "ObjectGrid.hpp" +#include "Ship.hpp" Image *Missile::image = NULL; diff --git a/src/Missile.hpp b/src/Missile.hpp index c277f78..5437b15 100644 --- a/src/Missile.hpp +++ b/src/Missile.hpp @@ -19,10 +19,8 @@ #ifndef INC_MISSILE_HPP #define INC_MISSILE_HPP -#include "ObjectGrid.hpp" -#include "Viewport.hpp" -#include "Image.hpp" -#include "Ship.hpp" +#include "GameObjFwd.hpp" +#include "GraphicsFwd.hpp" class Missile { public: -- 2.39.2