Changed class organization
This commit is contained in:
79
main.cpp
79
main.cpp
@@ -114,9 +114,50 @@ public:
|
||||
~App();
|
||||
};
|
||||
|
||||
|
||||
Demo::Demo(App* _app) : GApplet(_app), app(_app) {
|
||||
}
|
||||
|
||||
void clearInstances()
|
||||
{
|
||||
for(size_t i = 0; i < instances.size(); i++)
|
||||
{
|
||||
delete instances.at(i);
|
||||
}
|
||||
delete dataModel;
|
||||
}
|
||||
|
||||
void OnError(int err, std::string msg = "")
|
||||
{
|
||||
std::string emsg = "An unexpected error has occured and DUOM 5 has to quit. We're sorry!" + msg;
|
||||
clearInstances();
|
||||
//DialogBox(NULL, MAKEINTRESOURCE(IDD_DIALOG1), NULL, NULL);
|
||||
MessageBox(NULL, emsg.c_str(),"Dynamica Crash", MB_OK);
|
||||
exit(err);
|
||||
}
|
||||
|
||||
std::string ExePath() {
|
||||
char buffer[MAX_PATH];
|
||||
GetModuleFileName( NULL, buffer, MAX_PATH );
|
||||
std::string::size_type pos = std::string( buffer ).find_last_of( "\\/" );
|
||||
return std::string( buffer ).substr( 0, pos);
|
||||
}
|
||||
|
||||
std::string GetFileInPath(std::string file)
|
||||
{
|
||||
std::string name = ExePath() + file;
|
||||
struct stat buf;
|
||||
if (stat(name.c_str(), &buf) != -1)
|
||||
{
|
||||
return name;
|
||||
}
|
||||
else
|
||||
OnError(202, " \r\nFile not found: " + name);
|
||||
return NULL;
|
||||
|
||||
|
||||
}
|
||||
|
||||
#include <sstream>
|
||||
std::string Convert (float number){
|
||||
std::ostringstream buff;
|
||||
@@ -385,22 +426,8 @@ void Demo::onInit() {
|
||||
|
||||
|
||||
|
||||
void clearInstances()
|
||||
{
|
||||
for(size_t i = 0; i < instances.size(); i++)
|
||||
{
|
||||
delete instances.at(i);
|
||||
}
|
||||
delete dataModel;
|
||||
}
|
||||
void OnError(int err, std::string msg = "")
|
||||
{
|
||||
std::string emsg = "An unexpected error has occured and DUOM 5 has to quit. We're sorry!" + msg;
|
||||
clearInstances();
|
||||
//DialogBox(NULL, MAKEINTRESOURCE(IDD_DIALOG1), NULL, NULL);
|
||||
MessageBox(NULL, emsg.c_str(),"Dynamica Crash", MB_OK);
|
||||
exit(err);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Demo::onCleanup() {
|
||||
clearInstances();
|
||||
@@ -588,27 +615,7 @@ void Demo::onUserInput(UserInput* ui) {
|
||||
|
||||
|
||||
|
||||
std::string ExePath() {
|
||||
char buffer[MAX_PATH];
|
||||
GetModuleFileName( NULL, buffer, MAX_PATH );
|
||||
std::string::size_type pos = std::string( buffer ).find_last_of( "\\/" );
|
||||
return std::string( buffer ).substr( 0, pos);
|
||||
}
|
||||
|
||||
std::string GetFileInPath(std::string file)
|
||||
{
|
||||
std::string name = ExePath() + file;
|
||||
struct stat buf;
|
||||
if (stat(name.c_str(), &buf) != -1)
|
||||
{
|
||||
return name;
|
||||
}
|
||||
else
|
||||
OnError(202, " \r\nFile not found: " + name);
|
||||
return NULL;
|
||||
|
||||
|
||||
}
|
||||
|
||||
void makeFlag(Vector3 &vec, RenderDevice* &rd)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user