Cleaning up
This commit is contained in:
parent
5cb87b3303
commit
d412a88f20
@ -342,7 +342,6 @@ LOCAL_SRC_FILES += src/Render/SalmonRender/SalmonRenderAndroid.cpp
|
||||
LOCAL_SRC_FILES += src/Render/SalmonRender/Cameras.cpp
|
||||
|
||||
LOCAL_SRC_FILES += src/Animation/SalmonAnimation.cpp
|
||||
LOCAL_SRC_FILES += src/ApplicationInterface.cpp
|
||||
LOCAL_SRC_FILES += src/SalmonEngineAndroid.cpp
|
||||
LOCAL_SRC_FILES += src/SalmonEngineInterface.cpp
|
||||
LOCAL_LDLIBS := -lGLESv2
|
||||
|
@ -16,7 +16,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\include\Animation\SalmonAnimation.h" />
|
||||
<ClInclude Include="..\include\ApplicationInterface.h" />
|
||||
<ClInclude Include="..\include\Engine.h" />
|
||||
<ClInclude Include="..\include\FontManager\FontManager.h" />
|
||||
<ClInclude Include="..\include\FrameManager\FrameManager.h" />
|
||||
@ -63,7 +62,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\Animation\SalmonAnimation.cpp" />
|
||||
<ClCompile Include="..\src\ApplicationInterface.cpp" />
|
||||
<ClCompile Include="..\src\FontManager\FontManager.cpp" />
|
||||
<ClCompile Include="..\src\FrameManager\FrameManager.cpp" />
|
||||
<ClCompile Include="..\src\GlobalConst.cpp" />
|
||||
|
@ -1,43 +0,0 @@
|
||||
#ifndef APPLICATION_INTERFACE_H_INCLUDED
|
||||
#define APPLICATION_INTERFACE_H_INCLUDED
|
||||
|
||||
#include "include/Utils/Utils.h"
|
||||
|
||||
namespace SE
|
||||
{
|
||||
|
||||
class TApplicationInterface
|
||||
{
|
||||
protected:
|
||||
bool IsConsoleOut;
|
||||
public:
|
||||
|
||||
|
||||
TApplicationInterface();
|
||||
|
||||
virtual ~TApplicationInterface();
|
||||
|
||||
virtual void OuterInit(int screenWidth, int screenHeight, float matrixWidth, float matrixHeight);
|
||||
|
||||
virtual void InnerInit() { }
|
||||
//To do on init
|
||||
|
||||
virtual void OuterDeinit();
|
||||
|
||||
virtual void InnerDeinit() { }
|
||||
//To do on deinit
|
||||
|
||||
virtual void OuterDraw() { }
|
||||
|
||||
virtual void InnerDraw() { }
|
||||
//What to draw
|
||||
|
||||
virtual void OuterUpdate(cardinal timer) { }
|
||||
|
||||
virtual void InnerUpdate(cardinal timer) { }
|
||||
};
|
||||
|
||||
} //namespace SE
|
||||
|
||||
|
||||
#endif
|
@ -5,9 +5,6 @@
|
||||
This code combines all headers for Salmon engine into one header file
|
||||
*/
|
||||
|
||||
|
||||
#include "include/ApplicationInterface.h"
|
||||
|
||||
#include "include/Render/SalmonRender/SalmonRenderInterface.h"
|
||||
|
||||
#ifdef TARGET_ANDROID
|
||||
@ -103,12 +100,22 @@ struct TMouseState
|
||||
|
||||
|
||||
|
||||
class TApplicationAncestor : public TApplicationInterface
|
||||
class TApplicationAncestor
|
||||
{
|
||||
protected:
|
||||
|
||||
bool IsConsoleOut;
|
||||
public:
|
||||
|
||||
TApplicationAncestor();
|
||||
|
||||
virtual ~TApplicationAncestor();
|
||||
|
||||
virtual void OuterInit(int screenWidth, int screenHeight, float matrixWidth, float matrixHeight);
|
||||
|
||||
|
||||
virtual void OuterDeinit();
|
||||
|
||||
|
||||
virtual void OuterDraw();
|
||||
//What to draw
|
||||
|
||||
@ -125,7 +132,18 @@ public:
|
||||
virtual void OuterOnTapUpAfterMove(vec2 p);
|
||||
|
||||
virtual void OuterOnMove(vec2 shift);
|
||||
|
||||
|
||||
virtual void InnerInit() { }
|
||||
|
||||
virtual void InnerDeinit() { }
|
||||
|
||||
virtual void InnerDraw() { }
|
||||
|
||||
virtual void InnerUpdate(cardinal timer) { }
|
||||
|
||||
|
||||
|
||||
virtual void InnerOnTapDown(vec2 p) { }
|
||||
|
||||
virtual void InnerOnTapUp(vec2 p) { }
|
||||
@ -134,6 +152,8 @@ public:
|
||||
|
||||
virtual void InnerOnMove(vec2 shift) { }
|
||||
|
||||
|
||||
|
||||
virtual void OnMouseMove(TMouseState& mouseState) { } //Windows only
|
||||
|
||||
virtual void OnMouseWheel(short int delta) { }
|
||||
|
@ -44,6 +44,27 @@ bool CreateEngine(int width, int height, int x = 0, int y = 0, std::string windo
|
||||
void MainLoop(TApplication* app);
|
||||
void DestroyEngine();
|
||||
|
||||
|
||||
//APPTYPE must be inherited from TApplication
|
||||
template<typename APPTYPE>
|
||||
void OuterMainLoop(int width, int height)
|
||||
{
|
||||
|
||||
if (CreateEngine(width, height))
|
||||
{
|
||||
TApplication* app = new APPTYPE;
|
||||
|
||||
app->OuterInit(width, height, static_cast<float>(width), static_cast<float>(height));
|
||||
|
||||
MainLoop(app);
|
||||
|
||||
app->OuterDeinit();
|
||||
|
||||
DestroyEngine();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} //namespace SE
|
||||
|
||||
//This file includes templates that call any of three singletones: Console, ResourceManager or Renderer
|
||||
|
@ -1,38 +0,0 @@
|
||||
#include "include/Engine.h"
|
||||
|
||||
|
||||
namespace SE
|
||||
{
|
||||
|
||||
TApplicationInterface::TApplicationInterface()
|
||||
: IsConsoleOut(false)
|
||||
{
|
||||
}
|
||||
|
||||
TApplicationInterface::~TApplicationInterface()
|
||||
{
|
||||
}
|
||||
|
||||
void TApplicationInterface::OuterInit(int screenWidth, int screenHeight, float matrixWidth, float matrixHeight)
|
||||
{
|
||||
ResourceManager->MainThreadId = boost::this_thread::get_id();
|
||||
|
||||
ResourceManager->ScriptManager.BindBasicFunctions();
|
||||
|
||||
Renderer->InitOpenGL(screenWidth, screenHeight, matrixWidth, matrixHeight);
|
||||
|
||||
InnerInit();
|
||||
|
||||
CheckGlError();
|
||||
|
||||
srand(static_cast<unsigned int>(time(0)));
|
||||
}
|
||||
|
||||
void TApplicationInterface::OuterDeinit()
|
||||
{
|
||||
CheckGlError("OuterDeinit");
|
||||
InnerDeinit();
|
||||
}
|
||||
|
||||
|
||||
} //namespace SE
|
@ -8,7 +8,6 @@ namespace SE
|
||||
|
||||
void CreateEngine()
|
||||
{
|
||||
DestroyEngine();
|
||||
|
||||
Console = new TJavaConsole;
|
||||
|
||||
|
@ -60,6 +60,41 @@ TResourceManager::~TResourceManager()
|
||||
|
||||
}
|
||||
|
||||
//==================================================
|
||||
//============ TApplicationAncestor ================
|
||||
//==================================================
|
||||
|
||||
TApplicationAncestor::TApplicationAncestor()
|
||||
: IsConsoleOut(false)
|
||||
{
|
||||
}
|
||||
|
||||
TApplicationAncestor::~TApplicationAncestor()
|
||||
{
|
||||
}
|
||||
|
||||
void TApplicationAncestor::OuterInit(int screenWidth, int screenHeight, float matrixWidth, float matrixHeight)
|
||||
{
|
||||
ResourceManager->MainThreadId = boost::this_thread::get_id();
|
||||
|
||||
ResourceManager->ScriptManager.BindBasicFunctions();
|
||||
|
||||
Renderer->InitOpenGL(screenWidth, screenHeight, matrixWidth, matrixHeight);
|
||||
|
||||
InnerInit();
|
||||
|
||||
CheckGlError();
|
||||
|
||||
srand(static_cast<unsigned int>(time(0)));
|
||||
}
|
||||
|
||||
|
||||
void TApplicationAncestor::OuterDeinit()
|
||||
{
|
||||
CheckGlError("OuterDeinit");
|
||||
InnerDeinit();
|
||||
}
|
||||
|
||||
|
||||
void TApplicationAncestor::OuterDraw()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user