RioEngine  0.1
My first attempt to create a 3D WYSIWYG Game Engine
main.cpp
Go to the documentation of this file.
1 //--------------------------------------------------------------- @License begins
2 // RioEngine: The late night Coke -without whores- debugging sessions
3 // 2012-2015 Leopoldo Lomas Flores. Torreon, Coahuila. MEXICO
4 // leopoldolomas [at] gmail
5 // www.rioengine.com
6 // www.leopoldolomas.info
7 // "You have a problem, you face it like a man."
8 //
9 // This is free and unencumbered software released into the public domain.
10 //
11 // Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
12 // software, either in source code form or as a compiled binary, for any purpose,
13 // commercial or non-commercial, and by any means.
14 //
15 // In jurisdictions that recognize copyright laws, the author or authors of this
16 // software dedicate any and all copyright interest in the software to the public
17 // domain. We make this dedication for the benefit of the public at large and to
18 // the detriment of our heirs and successors. We intend this dedication to be
19 // an overt act of relinquishment in perpetuity of all present and future
20 // rights to this software under copyright law.
21 //
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS
24 // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE
25 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
26 // CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 //--------------------------------------------------------------- @License ends
29 
30 #include <windows.h>
31 #include <tchar.h>
32 #include <QApplication>
33 #include <QtMessageHandler>
34 #include "macro.h"
35 #include "editor/editorwindow.h"
37 
38 #if VLD_ENABLED
39 #include <vld.h>
40 #endif
41 
43 QtMessageHandler logWindowMessageHandler;
44 QtMessageHandler mainMessageHandler;
45 
46 void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg) {
47  (mainMessageHandler)(type, context, msg); // redirect the message to the console
48 
49  if(logWindow) {
50  logWindow->log(msg);
51  }
52 }
53 
54 int main(int argc, char *argv[])
55 {
56 #if VLD_ENABLED
57  std::string str = "MemoryLeaksReport.txt";
58  std::wstring widestr = std::wstring(str.begin(), str.end());
60 #endif
61 
62  QApplication a(argc, argv);
63  a.setStyle("Fusion");
64 
65  logWindow = new LogWindow();
66  logWindow->show();
67 
68  logWindowMessageHandler = QtMessageHandler(myMessageOutput);
69  mainMessageHandler = qInstallMessageHandler(logWindowMessageHandler);
70 
72  w.show();
73 
74  int result = a.exec();
75 
76 #if VLD_ENABLED
78 #endif
79 
80  SAFE_RELEASE(logWindow);
81 
82  return result;
83 }
LogWindow * logWindow
Definition: main.cpp:42
void log(QString message)
Definition: logwindow.cpp:44
#define VLD_OPT_REPORT_TO_FILE
Definition: vld_def.h:29
#define VLDSetReportOptions(a, b)
Definition: vld.h:305
QtMessageHandler logWindowMessageHandler
Definition: main.cpp:43
#define VLDReportLeaks()
Definition: vld.h:293
void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
Definition: main.cpp:46
#define SAFE_RELEASE(x)
Definition: cobject.h:36
QtMessageHandler mainMessageHandler
Definition: main.cpp:44
int main(int argc, char *argv[])
Definition: main.cpp:54