Cleaning up
This commit is contained in:
1 parent
5cb87b3303
commit
d412a88f20
8 files changed
+81
-90
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user