Permalink
Browse files

Added: PhysicProcessor class with prelim collision detection routines.

Added: Ellipse class.
Added: CollisionObject base class.
Fixed: some #ifdefs relating to renderer selection.
Updated: code in verious places relating to how the renderer is accessed.
Added: workaround forcing IniFile to always save contents on destruction.
  • Loading branch information...
1 parent 676b424 commit edaf1a18979b07ccd7c078996c3b688b6d487a47 @pokeparadox committed May 2, 2012
View
@@ -17,6 +17,7 @@
<Compiler>
<Add option="-g" />
<Add option="-fPIC" />
+ <Add option="-DPENJIN_SDL" />
</Compiler>
<Linker>
<Add library="PenjinTwoTextFileD" />
View
@@ -18,6 +18,7 @@
<Add option="-fPIC" />
<Add option="-DPLATFORM_PC" />
<Add option="-DPENJIN_SDL" />
+ <Add option="-D_DEBUG" />
</Compiler>
<Linker>
<Add library="PenjinTwoStringUtilityD" />
@@ -63,6 +64,8 @@
<Unit filename="include/ColourHSV.cpp" />
<Unit filename="include/DimensionObject.cpp" />
<Unit filename="include/DimensionObject.h" />
+ <Unit filename="include/Ellipse.cpp" />
+ <Unit filename="include/Ellipse.h" />
<Unit filename="include/GFX.cpp" />
<Unit filename="include/GFX.h" />
<Unit filename="include/Image.cpp" />
@@ -77,6 +80,8 @@
<Unit filename="include/PositionObject.h" />
<Unit filename="include/Primitive.cpp" />
<Unit filename="include/Primitive.h" />
+ <Unit filename="include/RadialObject.cpp" />
+ <Unit filename="include/RadialObject.h" />
<Unit filename="include/Rectangle.cpp" />
<Unit filename="include/Rectangle.h" />
<Unit filename="include/RenderObject.cpp" />
View
@@ -17,6 +17,7 @@
<Compiler>
<Add option="-g" />
<Add option="-fPIC" />
+ <Add option="-D_DEBUG" />
</Compiler>
<Linker>
<Add library="PenjinTwoTextFileD" />
View
@@ -46,10 +46,12 @@
<Linker>
<Add directory="$(#PenjinTwo.lib)" />
</Linker>
+ <Unit filename="include/CollisionObject.cpp" />
+ <Unit filename="include/CollisionObject.h" />
<Unit filename="include/CollisionRegion.cpp" />
<Unit filename="include/CollisionRegion.h" />
- <Unit filename="include/RadialObject.cpp" />
- <Unit filename="include/RadialObject.h" />
+ <Unit filename="include/PhysicsProcessor.cpp" />
+ <Unit filename="include/PhysicsProcessor.h" />
<Unit filename="include/SimpleDirection.cpp" />
<Unit filename="include/SimpleDirection.h" />
<Extensions>
@@ -16,6 +16,8 @@
<Compiler>
<Add option="-g" />
<Add option="-fPIC" />
+ <Add option="-DPENJIN_GL" />
+ <Add option="-D_DEBUG" />
</Compiler>
<Linker>
<Add directory="$(#PenjinTwo.lib)/Linux" />
View
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<CodeBlocks_project_file>
+ <FileVersion major="1" minor="6" />
+ <Project>
+ <Option title="PenjinTwoRendererSDL_2D" />
+ <Option pch_mode="2" />
+ <Option compiler="linux" />
+ <Build>
+ <Target title="Lin Debug">
+ <Option output="lib/Linux/libPenjinTwoRendererSDL_2DD" prefix_auto="1" extension_auto="1" />
+ <Option object_output="obj/Linux/Debug" />
+ <Option type="3" />
+ <Option compiler="linux" />
+ <Option createDefFile="1" />
+ <Option createStaticLib="1" />
+ <Compiler>
+ <Add option="-g" />
+ <Add option="-fPIC" />
+ <Add option="-DPENJIN_SDL" />
+ <Add option="-D_DEBUG" />
+ </Compiler>
+ <Linker>
+ <Add directory="$(#PenjinTwo.lib)/Linux" />
+ </Linker>
+ </Target>
+ <Target title="Lin Release">
+ <Option output="lib/Linux/libPenjinTwoRendererSDL_2D" prefix_auto="1" extension_auto="1" />
+ <Option object_output="obj/Linux/Release/" />
+ <Option type="3" />
+ <Option compiler="linux" />
+ <Option createDefFile="1" />
+ <Option createStaticLib="1" />
+ <Compiler>
+ <Add option="-O2" />
+ <Add option="-fPIC" />
+ </Compiler>
+ <Linker>
+ <Add option="-s" />
+ <Add directory="$(#PenjinTwo.lib)/Linux" />
+ </Linker>
+ </Target>
+ </Build>
+ <Compiler>
+ <Add option="-Wall" />
+ <Add option="-fexceptions" />
+ <Add directory="$(#PenjinTwo.include)" />
+ </Compiler>
+ <Linker>
+ <Add directory="$(#PenjinTwo.lib)" />
+ </Linker>
+ <Unit filename="include/RendererSDL_2d.cpp" />
+ <Unit filename="include/RendererSDL_2d.h" />
+ <Extensions>
+ <envvars />
+ <code_completion />
+ <lib_finder disable_auto="1" />
+ <debugger />
+ </Extensions>
+ </Project>
+</CodeBlocks_project_file>
View
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<CodeBlocks_project_file>
+ <FileVersion major="1" minor="6" />
+ <Project>
+ <Option title="PenjinTwoRendererSDL_3D" />
+ <Option pch_mode="2" />
+ <Option compiler="linux" />
+ <Build>
+ <Target title="Lin Debug">
+ <Option output="lib/Linux/libPenjinTwoRendererSDL_3DD" prefix_auto="1" extension_auto="1" />
+ <Option object_output="obj/Linux/Debug" />
+ <Option type="3" />
+ <Option compiler="linux" />
+ <Option createDefFile="1" />
+ <Option createStaticLib="1" />
+ <Compiler>
+ <Add option="-g" />
+ <Add option="-fPIC" />
+ </Compiler>
+ <Linker>
+ <Add library="PenjinTwoD" />
+ <Add directory="$(#PenjinTwo.lib)/Linux" />
+ </Linker>
+ </Target>
+ <Target title="Lin Release">
+ <Option output="lib/Linux/libPenjinTwoRendererSDL_3D" prefix_auto="1" extension_auto="1" />
+ <Option object_output="obj/Linux/Release/" />
+ <Option type="3" />
+ <Option compiler="linux" />
+ <Option createDefFile="1" />
+ <Option createStaticLib="1" />
+ <Compiler>
+ <Add option="-O2" />
+ <Add option="-fPIC" />
+ </Compiler>
+ <Linker>
+ <Add option="-s" />
+ <Add library="PenjinTwo" />
+ <Add directory="$(#PenjinTwo.lib)/Linux" />
+ </Linker>
+ </Target>
+ </Build>
+ <Compiler>
+ <Add option="-Wall" />
+ <Add option="-fexceptions" />
+ <Add directory="$(#PenjinTwo.include)" />
+ </Compiler>
+ <Linker>
+ <Add directory="$(#PenjinTwo.lib)" />
+ </Linker>
+ <Extensions>
+ <envvars />
+ <code_completion />
+ <lib_finder disable_auto="1" />
+ <debugger />
+ </Extensions>
+ </Project>
+</CodeBlocks_project_file>
View
@@ -16,6 +16,8 @@
<Compiler>
<Add option="-g" />
<Add option="-fPIC" />
+ <Add option="-DPLATFORM_PC" />
+ <Add option="-D_DEBUG" />
</Compiler>
<Linker>
<Add library="PenjinTwoIniFileD" />
View
@@ -16,6 +16,7 @@
<Compiler>
<Add option="-g" />
<Add option="-fPIC" />
+ <Add option="-D_DEBUG" />
</Compiler>
<Linker>
<Add directory="$(#PenjinTwo.lib)/Linux" />
@@ -0,0 +1,12 @@
+#include "CollisionObject.h"
+using Penjin::CollisionObject;
+
+CollisionObject::CollisionObject()
+{
+ //ctor
+}
+
+CollisionObject::~CollisionObject()
+{
+ //dtor
+}
View
@@ -0,0 +1,19 @@
+#ifndef COLLISIONOBJECT_H
+#define COLLISIONOBJECT_H
+
+#include "Object.h"
+
+namespace Penjin
+{
+ class CollisionObject : public Object
+ {
+ public:
+ CollisionObject();
+ virtual ~CollisionObject();
+
+
+ protected:
+ private:
+ };
+}
+#endif // COLLISIONOBJECT_H
View
@@ -0,0 +1,19 @@
+#include "Ellipse.h"
+#include "GFX.h"
+using Penjin::Ellipse;
+
+Ellipse::Ellipse()
+{
+ //ctor
+}
+
+Ellipse::~Ellipse()
+{
+ //dtor
+}
+
+void Ellipse::render()
+{
+ GFX->setDrawColour(*this);
+ GFX->drawEllipse(position,getRadius(),getRadius2());
+}
View
@@ -0,0 +1,23 @@
+#ifndef ELLIPSE_H
+#define ELLIPSE_H
+
+#include "Primitive.h"
+#include "RadialObject.h"
+
+namespace Penjin
+{
+ class Ellipse : public Primitive, public RadialObject
+ {
+ public:
+ Ellipse();
+ virtual ~Ellipse();
+
+ virtual void render();
+
+ protected:
+ private:
+ };
+}
+
+
+#endif // ELLIPSE_H
View
@@ -41,14 +41,20 @@ void GPU::setMode(const string& engine, const unsigned int& dims)
{
if(engine == "SDL")
renderer = GFX_SDL_2D::getInstance();
+ #ifdef PENJIN_GL
else if (engine == "GL")
renderer = GFX_GL_2D::getInstance();
+ #endif
}
+ #ifdef PENJIN_3D
else if(dims == 3)
{
if(engine == "SDL")
renderer = GFX_SDL_3D::getInstance();
+ #ifdef PENJIN_GL
else if (engine == "GL")
renderer = GFX_GL_3D::getInstance();
+ #endif
}
+ #endif
}
View
@@ -29,17 +29,16 @@ using std::string;
#include "Singleton.h"
#include "Renderer.h"
-#if PENJIN_SDL
- #include "RendererSDL_2d.h"
-#elif PENJIN_GL
+ #include "RendererSDL_2d.h"
+#if PENJIN_GL
#include "RendererGL_2d.h"
#endif
+
#ifdef PENJIN_3D
-#if PENJIN_SDL
#include "RendererSDL_3d.h"
-#elif PENJIN_GL
- #include "RendererGL_3d.h"
-#endif
+ #if PENJIN_GL
+ #include "RendererGL_3d.h"
+ #endif
#endif
namespace Penjin
View
@@ -101,22 +101,22 @@ Penjin::ERRORS Game::loadConfig()
GPU_SINGLETON::getInstance()->setMode(cMan->getGFXEngine(),cMan->getGFXDimensions());
// If the config was accepted by config manager we can apply the settings!
- Penjin::GFX->setFrameRate(cMan->getFrameRate());
- Penjin::GFX->setWidth(cMan->getWidth());
- Penjin::GFX->setHeight(cMan->getHeight());
- Penjin::GFX->setBaseWidth(cMan->getBaseWidth());
- Penjin::GFX->setBaseHeight(cMan->getBaseHeight());
- Penjin::GFX->setBitsPerPixel(cMan->getBPP());
- Penjin::GFX->setFullscreen(cMan->getFullscreen());
+ GFX->setFrameRate(cMan->getFrameRate());
+ GFX->setWidth(cMan->getWidth());
+ GFX->setHeight(cMan->getHeight());
+ GFX->setBaseWidth(cMan->getBaseWidth());
+ GFX->setBaseHeight(cMan->getBaseHeight());
+ GFX->setBitsPerPixel(cMan->getBPP());
+ GFX->setFullscreen(cMan->getFullscreen());
string value = cMan->getScaleMode();
if(value == "PokeScale")
- Penjin::GFX->setScaleMode(smPOKESCALE);
+ GFX->setScaleMode(smPOKESCALE);
else if(value == "PreScale")
- Penjin::GFX->setScaleMode(smPRESCALE);
+ GFX->setScaleMode(smPRESCALE);
else
- Penjin::GFX->setScaleMode(smNONE);
+ GFX->setScaleMode(smNONE);
- Penjin::GFX->applyVideoSettings();
+ GFX->applyVideoSettings();
Penjin::TextMan::getInstance()->load(cMan->getSystemFont(), cMan->getSystemFontSize());
return e;
}
@@ -132,7 +132,6 @@ void Game::loop()
{
// We have to get the state pointer to begin with
Penjin::StateManager* sm = Penjin::StateMan::getInstance();
- Penjin::Renderer* gfx = Penjin::GFX;
state = sm->getState();
while(!state->getShouldQuit())
{
@@ -151,8 +150,8 @@ void Game::loop()
}
state->update(); // Update physics/objects/logic
state->render(); // render manually rendered objects
- gfx->renderQueue(); // render objects entrusted into our (to be) optimised render queue
- gfx->blit(); // Force the blit to the screen
- gfx->frameLimiter(); // restrict frame rate
+ GFX->renderQueue(); // render objects entrusted into our (to be) optimised render queue
+ GFX->blit(); // Force the blit to the screen
+ GFX->frameLimiter(); // restrict frame rate
}
}
View
@@ -18,7 +18,7 @@
along with PenjinTwo. If not, see <http://www.gnu.org/licenses/>.
*/
/**
- * \file Game2 is a base class for creating a game.
+ * \file Game is a base class for creating a game.
* \author Kevin Winfield-Pantoja
*/
#ifndef GAME_H
Oops, something went wrong.

0 comments on commit edaf1a1

Please sign in to comment.