Optimizations
This commit is contained in:
parent
916a41e064
commit
f2dca8749b
@ -15,7 +15,7 @@ public:
|
||||
|
||||
TApplicationInterface();
|
||||
|
||||
virtual ~TApplicationInterface() { }
|
||||
virtual ~TApplicationInterface();
|
||||
|
||||
virtual void OuterInit(int screenWidth, int screenHeight, float matrixWidth, float matrixHeight);
|
||||
|
||||
|
@ -40,8 +40,6 @@ public:
|
||||
|
||||
TDataTriangleList Data;
|
||||
|
||||
bool NeedRefreshBuffer;//Dummy for Android, but you need this for PC
|
||||
|
||||
virtual void RefreshBuffer() { } //Dummy for Android, but you need this for PC
|
||||
|
||||
TTriangleListAncestor();
|
||||
@ -78,12 +76,16 @@ public:
|
||||
|
||||
class TTriangleList : public TTriangleListAncestor //Implementation differs for Windows and Android
|
||||
{
|
||||
public:
|
||||
|
||||
mutable std::map<std::string, std::shared_ptr<VBOObject> > VertBufferArr;
|
||||
protected:
|
||||
virtual void InnerRefreshBuffer();
|
||||
|
||||
bool NeedPrepareBufferObjects;
|
||||
|
||||
bool NeedRefreshBuffer; //Dummy for Android, but you need this for PC
|
||||
public:
|
||||
|
||||
mutable std::map<std::string, std::shared_ptr<VBOObject>> VertBufferArr;
|
||||
|
||||
TTriangleList();
|
||||
|
||||
~TTriangleList();
|
||||
|
@ -17,28 +17,11 @@ class TApplication : public TApplicationAncestor
|
||||
{
|
||||
protected:
|
||||
public:
|
||||
int X, Y, Width, Height; //Window position and size
|
||||
|
||||
TApplication() : X(0), Y(0), Width(4), Height(4) { }
|
||||
|
||||
virtual void OuterInit(int screenWidth, int screenHeight, float matrixWidth, float matrixHeight);
|
||||
|
||||
virtual void InnerInit() = 0;
|
||||
//To do on init
|
||||
|
||||
virtual void OuterDeinit();
|
||||
|
||||
virtual void InnerDeinit() = 0;
|
||||
//To do on deinit
|
||||
|
||||
virtual void InnerDraw() = 0;
|
||||
//What to draw
|
||||
|
||||
virtual void InnerUpdate(cardinal timer) = 0;
|
||||
//To do on update
|
||||
|
||||
};
|
||||
|
||||
void CreateEngine();
|
||||
void DestroyEngine();
|
||||
|
||||
} //namespace SE
|
||||
|
||||
#include "include/GUIManager/WidgetTemplatesImpl.h"
|
||||
|
@ -109,12 +109,6 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
TApplicationAncestor();
|
||||
|
||||
|
||||
virtual void OuterDeinit();
|
||||
//To do on deinit
|
||||
|
||||
virtual void OuterDraw();
|
||||
//What to draw
|
||||
|
||||
|
@ -17,47 +17,11 @@ class TApplication : public TApplicationAncestor
|
||||
{
|
||||
protected:
|
||||
public:
|
||||
int X, Y, Width, Height; //Window position and size
|
||||
|
||||
TApplication() : X(0), Y(0), Width(4), Height(4) { }
|
||||
|
||||
virtual void OuterInit(int screenWidth, int screenHeight, float matrixWidth, float matrixHeight);
|
||||
|
||||
virtual void InnerInit() = 0;
|
||||
//To do on init
|
||||
|
||||
virtual void OuterDeinit();
|
||||
|
||||
virtual void InnerDeinit() = 0;
|
||||
//To do on deinit
|
||||
|
||||
//virtual void OuterDraw();
|
||||
|
||||
virtual void InnerDraw() = 0;
|
||||
//What to draw
|
||||
|
||||
//virtual void OuterUpdate(cardinal timer);
|
||||
|
||||
virtual void InnerUpdate(cardinal timer) = 0;
|
||||
//To do on update
|
||||
|
||||
virtual void UpdateQuick() { };
|
||||
//To process input - this method is called more frequently than Update()
|
||||
|
||||
virtual void OnMouseMove(TMouseState& mouseState) { }
|
||||
//To do on mouse move (with or without pressed buttons)
|
||||
|
||||
virtual void OnMouseDown(TMouseState& mouseState) { }
|
||||
//To do on mouse up (with or without pressed buttons)
|
||||
|
||||
virtual void OnMouseUp(TMouseState& mouseState) { }
|
||||
//To do on mouse down (with or without pressed buttons)
|
||||
//Be careful - even when user "upped" button, in mouseState this button appears as pressed
|
||||
|
||||
virtual void OnMouseWheel(short int delta) { }
|
||||
//To do on mouse wheel move
|
||||
};
|
||||
|
||||
void CreateEngine();
|
||||
void DestroyEngine();
|
||||
|
||||
} //namespace SE
|
||||
|
||||
|
||||
|
@ -25,40 +25,24 @@ extern HDC hDC; //Device context
|
||||
|
||||
class TApplication : public TApplicationAncestor
|
||||
{
|
||||
protected:
|
||||
std::string LogFilename; //Log file name
|
||||
public:
|
||||
int X, Y, Width, Height; //Window position and size
|
||||
|
||||
std::string WindowName; //Window name
|
||||
TApplication();
|
||||
|
||||
TApplication() : X(0), Y(0), Width(800), Height(600), WindowName("Salmon Engine"), LogFilename("log.txt") { }
|
||||
|
||||
const std::string& GetLogFilename() { return LogFilename; }
|
||||
|
||||
virtual void InnerInit() = 0;
|
||||
//To do on init
|
||||
|
||||
virtual void InnerDeinit() = 0;
|
||||
//To do on deinit
|
||||
|
||||
virtual void InnerDraw() = 0;
|
||||
//What to draw
|
||||
|
||||
virtual void InnerUpdate(cardinal timer) = 0;
|
||||
//To do on update
|
||||
~TApplication();
|
||||
|
||||
virtual void UpdateQuick() { };
|
||||
//To process input - this method is called more frequently than Update()
|
||||
|
||||
|
||||
virtual void OnMouseWheel(short int delta) { }
|
||||
//To do on mouse wheel move
|
||||
|
||||
virtual void OnKeyPress(cardinal key); //Try not to override this. But if you need to override, call ancestor!
|
||||
};
|
||||
|
||||
int MainLoop(TApplication& application);
|
||||
bool CreateEngine(int width, int height, int x = 0, int y = 0, std::string windowName = "Salmon Engine App", std::string logFileName = "log.txt");
|
||||
void MainLoop(TApplication* app);
|
||||
void DestroyEngine();
|
||||
|
||||
} //namespace SE
|
||||
|
||||
|
@ -9,6 +9,10 @@ TApplicationInterface::TApplicationInterface()
|
||||
{
|
||||
}
|
||||
|
||||
TApplicationInterface::~TApplicationInterface()
|
||||
{
|
||||
}
|
||||
|
||||
void TApplicationInterface::OuterInit(int screenWidth, int screenHeight, float matrixWidth, float matrixHeight)
|
||||
{
|
||||
ResourceManager->MainThreadId = boost::this_thread::get_id();
|
||||
|
@ -94,15 +94,6 @@ void TGUIManager::Update(cardinal dt)
|
||||
(*(i->SignalMap[CONST_HOLD_SIGNAL_NAME]))(TSignalParam(dt));
|
||||
|
||||
}
|
||||
|
||||
for (TRenderPairList::iterator itr = i->Widget->TriangleListVector.begin(); itr != i->Widget->TriangleListVector.end(); ++itr)
|
||||
{
|
||||
if (itr->second.NeedRefreshBuffer)
|
||||
{
|
||||
itr->second.RefreshBuffer();
|
||||
itr->second.NeedRefreshBuffer = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (TWidgetTrasfromTaskList::iterator i = WidgetTrasfromTaskList.begin(); i != WidgetTrasfromTaskList.end(); )
|
||||
@ -225,7 +216,7 @@ void TGUIManager::MoveWidgetByIterator(TWidgetArr::iterator widget, vec2 shift)
|
||||
*i += vec3(shift, 0);
|
||||
}
|
||||
|
||||
itr->second.NeedRefreshBuffer = true;
|
||||
itr->second.RefreshBuffer();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -235,7 +235,7 @@ void THalibutExternalAnimObject::RefreshTriangleListVector()
|
||||
RenderPairIter->second.Data.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB][i*6+5] = tex1;
|
||||
}
|
||||
|
||||
RenderPairIter->second.NeedRefreshBuffer = true;
|
||||
RenderPairIter->second.RefreshBuffer();
|
||||
|
||||
}
|
||||
|
||||
|
@ -64,12 +64,10 @@ TDataTriangleList& TDataTriangleList::operator+=(const TDataTriangleList& dataTr
|
||||
|
||||
|
||||
TTriangleListAncestor::TTriangleListAncestor()
|
||||
: NeedRefreshBuffer(false)
|
||||
{
|
||||
}
|
||||
|
||||
TTriangleListAncestor::TTriangleListAncestor(const TTriangleListAncestor& c)
|
||||
: NeedRefreshBuffer(false)
|
||||
{
|
||||
Data = c.Data;
|
||||
}
|
||||
@ -77,13 +75,11 @@ TTriangleListAncestor::TTriangleListAncestor(const TTriangleListAncestor& c)
|
||||
TTriangleListAncestor& TTriangleListAncestor::operator=(const TTriangleListAncestor& c)
|
||||
{
|
||||
Data = c.Data;
|
||||
NeedRefreshBuffer = c.NeedRefreshBuffer;
|
||||
|
||||
RefreshBuffer();
|
||||
return *this;
|
||||
}
|
||||
|
||||
TTriangleListAncestor::TTriangleListAncestor(const TDataTriangleList& dataTriangleList)
|
||||
: NeedRefreshBuffer(false)
|
||||
{
|
||||
Data = dataTriangleList;
|
||||
}
|
||||
@ -91,7 +87,7 @@ TTriangleListAncestor::TTriangleListAncestor(const TDataTriangleList& dataTriang
|
||||
TTriangleListAncestor& TTriangleListAncestor::operator=(const TDataTriangleList& dataTriangleList)
|
||||
{
|
||||
Data = dataTriangleList;
|
||||
NeedRefreshBuffer = true;
|
||||
RefreshBuffer();
|
||||
|
||||
return *this;
|
||||
}
|
||||
@ -106,6 +102,7 @@ TTriangleListAncestor::~TTriangleListAncestor()
|
||||
TTriangleList::TTriangleList()
|
||||
: TTriangleListAncestor()
|
||||
, NeedPrepareBufferObjects(true)
|
||||
, NeedRefreshBuffer(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -113,11 +110,10 @@ TTriangleList::~TTriangleList()
|
||||
{
|
||||
}
|
||||
|
||||
void TTriangleList::RefreshBuffer()
|
||||
void TTriangleList::InnerRefreshBuffer()
|
||||
{
|
||||
AssertIfInMainThread();
|
||||
|
||||
|
||||
if (NeedPrepareBufferObjects && Data.Vec2CoordArr.size() > 0 && Data.Vec3CoordArr.size() > 0)
|
||||
{
|
||||
|
||||
@ -161,13 +157,10 @@ void TTriangleList::RefreshBuffer()
|
||||
glBufferData(GL_ARRAY_BUFFER, 0, NULL, GL_STATIC_DRAW);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
BOOST_FOREACH(auto& i, Data.Vec2CoordArr)
|
||||
{
|
||||
glBindBuffer(GL_ARRAY_BUFFER, VertBufferArr[i.first]->Buffer);
|
||||
@ -180,7 +173,17 @@ void TTriangleList::RefreshBuffer()
|
||||
RefreshAttribBuffer3fv(i.first, Data.Vec3CoordArr);
|
||||
}
|
||||
|
||||
NeedRefreshBuffer = false;
|
||||
}
|
||||
|
||||
|
||||
void TTriangleList::RefreshBuffer()
|
||||
{
|
||||
if (!NeedRefreshBuffer)
|
||||
{
|
||||
NeedRefreshBuffer = true;
|
||||
PerformInMainThreadAsync(boost::bind(&TTriangleList::InnerRefreshBuffer, this));
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ bool TSalmonRenderer::BindOpenGLFunctions()
|
||||
char* glVersion = (char*)glGetString(GL_VERSION);
|
||||
bool ok = true;
|
||||
|
||||
*Console<<std::string("Render::OpenGL glVersion = ")+glVersion;
|
||||
*Console<<std::string("Render::OpenGL glVersion = ") + glVersion;
|
||||
|
||||
//Requires OpenGL 2.0 or above
|
||||
if (glVersion[0]>='2')
|
||||
|
@ -5,40 +5,22 @@
|
||||
namespace SE
|
||||
{
|
||||
|
||||
void TApplication::OuterInit(int screenWidth, int screenHeight, float matrixWidth, float matrixHeight)
|
||||
|
||||
void CreateEngine()
|
||||
{
|
||||
OuterDeinit();
|
||||
|
||||
Console = new TJavaConsole;
|
||||
DestroyEngine();
|
||||
|
||||
Console = new TJavaConsole;
|
||||
|
||||
*Console<<std::string("Console successfully started!!!");
|
||||
|
||||
ResourceManager = new TResourceManager;
|
||||
|
||||
ResourceManager->MainThreadId = boost::this_thread::get_id();
|
||||
|
||||
Renderer = new TSalmonRendererAndroid;
|
||||
|
||||
ResourceManager->ScriptManager.BindBasicFunctions();
|
||||
|
||||
Renderer->InitOpenGL(screenWidth, screenHeight, matrixWidth, matrixHeight);
|
||||
|
||||
InnerInit();
|
||||
|
||||
CheckGlError();
|
||||
}
|
||||
|
||||
|
||||
void TApplication::OuterDeinit()
|
||||
void DestroyEngine()
|
||||
{
|
||||
|
||||
if (Console != NULL)
|
||||
{
|
||||
*Console<<"OuterDeinit";
|
||||
}
|
||||
|
||||
InnerDeinit();
|
||||
|
||||
if (ResourceManager != NULL)
|
||||
{
|
||||
delete ResourceManager;
|
||||
@ -47,7 +29,7 @@ void TApplication::OuterDeinit()
|
||||
|
||||
if (Console != NULL)
|
||||
{
|
||||
*Console<<"Resource manager deleted, deleting salmon render";
|
||||
*Console<<"Resource manager deleted, deleting salmon render";
|
||||
}
|
||||
|
||||
if (Renderer != NULL)
|
||||
@ -57,17 +39,14 @@ void TApplication::OuterDeinit()
|
||||
}
|
||||
if (Console != NULL)
|
||||
{
|
||||
*Console<<"salmon render deleted";
|
||||
*Console<<"salmon render deleted";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (Console != NULL)
|
||||
{
|
||||
delete Console;
|
||||
Console = NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} //namespace SE
|
@ -61,17 +61,6 @@ TResourceManager::~TResourceManager()
|
||||
}
|
||||
|
||||
|
||||
TApplicationAncestor::TApplicationAncestor()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void TApplicationAncestor::OuterDeinit()
|
||||
{
|
||||
InnerDeinit();
|
||||
}
|
||||
|
||||
|
||||
void TApplicationAncestor::OuterDraw()
|
||||
{
|
||||
TryUpdateMainThreadId();
|
||||
|
@ -6,41 +6,21 @@
|
||||
namespace SE
|
||||
{
|
||||
|
||||
void TApplication::OuterInit(int screenWidth, int screenHeight, float matrixWidth, float matrixHeight)
|
||||
void CreateEngine()
|
||||
{
|
||||
|
||||
OuterDeinit();
|
||||
|
||||
Console = new TIosConsole;
|
||||
DestroyEngine();
|
||||
|
||||
Console = new TIosConsole;
|
||||
|
||||
*Console<<std::string("Console successfully started!!!");
|
||||
|
||||
ResourceManager = new TResourceManager;
|
||||
|
||||
ResourceManager->MainThreadId = boost::this_thread::get_id();
|
||||
|
||||
Renderer = new TSalmonRendererIos;
|
||||
|
||||
ResourceManager->ScriptManager.BindBasicFunctions();
|
||||
|
||||
Renderer->InitOpenGL(screenWidth, screenHeight, matrixWidth, matrixHeight);
|
||||
|
||||
InnerInit();
|
||||
|
||||
CheckGlError();
|
||||
Renderer = new TSalmonRendererIos;
|
||||
}
|
||||
|
||||
|
||||
void TApplication::OuterDeinit()
|
||||
void DestroyEngine()
|
||||
{
|
||||
|
||||
if (Console != NULL)
|
||||
{
|
||||
*Console<<"OuterDeinit";
|
||||
}
|
||||
|
||||
InnerDeinit();
|
||||
|
||||
if (ResourceManager != NULL)
|
||||
{
|
||||
delete ResourceManager;
|
||||
@ -49,7 +29,7 @@ void TApplication::OuterDeinit()
|
||||
|
||||
if (Console != NULL)
|
||||
{
|
||||
*Console<<"Resource manager deleted, deleting salmon render";
|
||||
*Console<<"Resource manager deleted, deleting salmon render";
|
||||
}
|
||||
|
||||
if (Renderer != NULL)
|
||||
@ -59,29 +39,16 @@ void TApplication::OuterDeinit()
|
||||
}
|
||||
if (Console != NULL)
|
||||
{
|
||||
*Console<<"salmon render deleted";
|
||||
*Console<<"salmon render deleted";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (Console != NULL)
|
||||
{
|
||||
delete Console;
|
||||
Console = NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
void TApplication::OuterDraw()
|
||||
{
|
||||
InnerDraw();
|
||||
}
|
||||
|
||||
void TApplication::OuterUpdate(cardinal timer)
|
||||
{
|
||||
InnerUpdate(timer);
|
||||
}*/
|
||||
|
||||
|
||||
} //namespace SE
|
@ -35,6 +35,15 @@ vec2 MouseTotalShift;
|
||||
bool MouseButtonPressed = false;
|
||||
bool MouseMoved = false;
|
||||
|
||||
|
||||
TApplication::TApplication()
|
||||
{
|
||||
}
|
||||
|
||||
TApplication::~TApplication()
|
||||
{
|
||||
}
|
||||
|
||||
void TApplication::OnKeyPress(cardinal key)
|
||||
{
|
||||
if (IsConsoleOut)
|
||||
@ -207,7 +216,7 @@ case WM_MOUSEMOVE:
|
||||
|
||||
if (MouseButtonPressed)
|
||||
{
|
||||
vec2 currentMousePos(static_cast<float>(mouseState.X), static_cast<float>(App->Height - mouseState.Y));
|
||||
vec2 currentMousePos(static_cast<float>(mouseState.X), static_cast<float>(Renderer->GetScreenHeight() - mouseState.Y));
|
||||
vec2 shift = (MouseButtonPos - currentMousePos);
|
||||
//shift.v[1] = - shift.v[1];
|
||||
App->OuterOnMove(shift);
|
||||
@ -232,7 +241,7 @@ case WM_MOUSEMOVE:
|
||||
mouseState.MiddleButtonPressed = (wParam & MK_MBUTTON);
|
||||
mouseState.RightButtonPressed = (wParam & MK_RBUTTON);
|
||||
|
||||
MouseButtonPos = vec2(static_cast<float>(mouseState.X), static_cast<float>(App->Height - mouseState.Y));
|
||||
MouseButtonPos = vec2(static_cast<float>(mouseState.X), static_cast<float>(Renderer->GetScreenHeight() - mouseState.Y));
|
||||
|
||||
if (mouseState.LeftButtonPressed)
|
||||
{
|
||||
@ -259,11 +268,11 @@ case WM_MOUSEMOVE:
|
||||
|
||||
if (MouseMoved)
|
||||
{
|
||||
App->OuterOnTapUpAfterShift(vec2(static_cast<float>(mouseState.X), static_cast<float>(App->Height - mouseState.Y)));
|
||||
App->OuterOnTapUpAfterShift(vec2(static_cast<float>(mouseState.X), static_cast<float>(Renderer->GetScreenHeight() - mouseState.Y)));
|
||||
}
|
||||
else
|
||||
{
|
||||
App->OuterOnTapUp(vec2(static_cast<float>(mouseState.X), static_cast<float>(App->Height - mouseState.Y)));
|
||||
App->OuterOnTapUp(vec2(static_cast<float>(mouseState.X), static_cast<float>(Renderer->GetScreenHeight() - mouseState.Y)));
|
||||
}
|
||||
|
||||
MouseButtonPressed = false;
|
||||
@ -346,95 +355,60 @@ bool CreateOpenGLWindow(const char* title, int x, int y, int width, int height,H
|
||||
wglMakeCurrent( hDC, hRC );
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
int MainLoop(TApplication& application)
|
||||
bool CreateEngine(int width, int height, int x, int y, std::string windowName, std::string logFileName)
|
||||
{
|
||||
MSG msg;
|
||||
|
||||
|
||||
//Here console log is not created so we can not use ErrorCommon
|
||||
try
|
||||
{
|
||||
Console = new TFileConsole(application.GetLogFilename());
|
||||
Console = new TFileConsole(logFileName);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
exit(1);
|
||||
return false;
|
||||
}
|
||||
|
||||
//Here console log is already created
|
||||
try
|
||||
{
|
||||
|
||||
*Console<<"Log started";
|
||||
|
||||
if (!CreateOpenGLWindow(application.WindowName.c_str(), application.X, application.Y, application.Width, application.Height,Hwnd,hDC,hRC))
|
||||
if (!CreateOpenGLWindow(windowName.c_str(), x, y, width, height, Hwnd, hDC, hRC))
|
||||
{
|
||||
*Console<<"Unable to create OpenGL Window!";
|
||||
exit(1);
|
||||
return false;
|
||||
}
|
||||
|
||||
*Console<<"OpenGL Window created";
|
||||
|
||||
|
||||
if (App != NULL)
|
||||
throw ErrorCommon();
|
||||
|
||||
App = &application;
|
||||
try
|
||||
{
|
||||
|
||||
Renderer = new TSalmonRenderer;
|
||||
ResourceManager = new TResourceManager;
|
||||
|
||||
int width;
|
||||
int height;
|
||||
|
||||
GetWindowWidthHeight(width, height);
|
||||
return Renderer->BindOpenGLFunctions();
|
||||
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (Renderer->BindOpenGLFunctions())
|
||||
{
|
||||
|
||||
App->OuterInit(width, height, static_cast<float>(width), static_cast<float>(height));
|
||||
|
||||
ShowWindow(Hwnd, SW_SHOW);
|
||||
UpdateWindow(Hwnd);
|
||||
|
||||
NewTickCount = GetTickCount();
|
||||
LastTickCount = NewTickCount;
|
||||
|
||||
bool StayIn = true;
|
||||
|
||||
while (StayIn)
|
||||
{
|
||||
while(PeekMessage(&msg, Hwnd, 0, 0, PM_NOREMOVE))
|
||||
{
|
||||
if(GetMessage(&msg, Hwnd, 0, 0))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
StayIn = false;
|
||||
}
|
||||
}
|
||||
DrawScene();
|
||||
|
||||
ProcessTickCount();
|
||||
}
|
||||
|
||||
}
|
||||
void DestroyEngine()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
*Console<<"Program prepares to quit";
|
||||
|
||||
App->OuterDeinit();
|
||||
|
||||
delete ResourceManager;
|
||||
delete Renderer;
|
||||
|
||||
|
||||
wglMakeCurrent(NULL, NULL);
|
||||
ReleaseDC(Hwnd,hDC);
|
||||
ReleaseDC(Hwnd, hDC);
|
||||
wglDeleteContext(hRC);
|
||||
DestroyWindow(Hwnd);
|
||||
|
||||
@ -447,8 +421,40 @@ int MainLoop(TApplication& application)
|
||||
|
||||
delete Console;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void MainLoop(TApplication* app)
|
||||
{
|
||||
App = app;
|
||||
|
||||
MSG msg;
|
||||
|
||||
ShowWindow(Hwnd, SW_SHOW);
|
||||
UpdateWindow(Hwnd);
|
||||
|
||||
NewTickCount = GetTickCount();
|
||||
LastTickCount = NewTickCount;
|
||||
|
||||
bool StayIn = true;
|
||||
|
||||
while (StayIn)
|
||||
{
|
||||
while(PeekMessage(&msg, Hwnd, 0, 0, PM_NOREMOVE))
|
||||
{
|
||||
if(GetMessage(&msg, Hwnd, 0, 0))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
StayIn = false;
|
||||
}
|
||||
}
|
||||
DrawScene();
|
||||
|
||||
ProcessTickCount();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user