Compare commits
383 Commits
0.0.12
...
optimizati
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ae174c1fdc | ||
|
|
4d13650c6d | ||
|
|
913fc16657 | ||
|
|
44c2928c6a | ||
|
|
7b87773abf | ||
|
|
b2240a4ad0 | ||
|
|
8848d37d0f | ||
|
|
b8c23348ba | ||
|
|
782504278c | ||
|
|
a4ef9bbad1 | ||
|
|
559dfea041 | ||
|
|
01bc10f852 | ||
|
|
f9a1eea0d2 | ||
|
|
5501b7a5d7 | ||
|
|
68ccf1be6e | ||
|
|
6eed189855 | ||
|
|
39173f34a1 | ||
|
|
55f3ff8964 | ||
|
|
bb01d01950 | ||
|
|
22ed6acc7f | ||
|
|
72057499ce | ||
|
|
2292a82a85 | ||
|
|
aa11f5f120 | ||
|
|
1fe59aa9ff | ||
|
|
5e449d8882 | ||
|
|
f1d0d48dfa | ||
|
|
1e27e105b7 | ||
|
|
476610fe06 | ||
|
|
7898df7a8e | ||
|
|
552be1ec54 | ||
|
|
6b3230abd0 | ||
|
|
718bce5289 | ||
|
|
55f59e46e0 | ||
|
|
bc8742b5f5 | ||
|
|
08d8dc4df0 | ||
|
|
d8ba0dcfc8 | ||
|
|
6be44fa9f1 | ||
|
|
284cd129e0 | ||
|
|
fdc4f4e647 | ||
|
|
3417a34f37 | ||
|
|
7f0b358f80 | ||
|
|
bf291d6fe3 | ||
|
|
3f6d032c10 | ||
|
|
d16bf9e39b | ||
|
|
828584a2d9 | ||
|
|
69d78f139f | ||
|
|
d51bde7330 | ||
|
|
d12654b4d3 | ||
|
|
5a20b4aefc | ||
|
|
08a3f9f307 | ||
|
|
77ce5c9a5a | ||
|
|
8a097f7eb1 | ||
|
|
e9a13b8163 | ||
|
|
78875d3b7e | ||
|
|
33a43c5072 | ||
|
|
f2347970c4 | ||
|
|
d0b0ffd7f1 | ||
|
|
ab242470b6 | ||
|
|
03eceeae93 | ||
|
|
2919f4ebaa | ||
|
|
1dd930af49 | ||
|
|
98e73cd7ca | ||
|
|
057d86e05a | ||
|
|
89f9e0bfa2 | ||
|
|
61d07a8557 | ||
|
|
948835df98 | ||
|
|
e83a67ade2 | ||
|
|
6ec4ab466d | ||
|
|
f5f5f269d5 | ||
|
|
d492e438d2 | ||
|
|
1700258001 | ||
|
|
ff5b855e12 | ||
|
|
c9bb2ae72b | ||
|
|
5773584f48 | ||
|
|
7e2eb2c694 | ||
|
|
f7d6781698 | ||
|
|
30a05af3b2 | ||
|
|
b1af53995a | ||
|
|
866d644c63 | ||
|
|
1108af7cf3 | ||
|
|
7b4abe3efe | ||
|
|
5dd6ae7d9c | ||
|
|
0566dd0217 | ||
|
|
99d5a1de38 | ||
|
|
5020de484c | ||
|
|
62208a14a5 | ||
|
|
d7b491e073 | ||
|
|
c50d2a8166 | ||
|
|
d2e0b29051 | ||
|
|
4df67897dc | ||
|
|
0f0be7f0b9 | ||
|
|
581f8a3413 | ||
|
|
0174605a3e | ||
|
|
edf1bc701b | ||
|
|
69d55d0a5c | ||
|
|
99ab8e1620 | ||
|
|
ebe7ad682e | ||
|
|
abe406990b | ||
|
|
78c6dec932 | ||
|
|
2c65001536 | ||
|
|
07a2eb4d98 | ||
|
|
ea072e424a | ||
|
|
8b3da447a4 | ||
|
|
77615c5b8f | ||
|
|
dc6c002250 | ||
|
|
70fba67b6e | ||
|
|
1159be9b1b | ||
|
|
6752c5da68 | ||
|
|
77b7c3e62b | ||
|
|
7d7552d141 | ||
|
|
7f7e015706 | ||
|
|
ebbbbb3a69 | ||
|
|
b608a3ab9e | ||
|
|
ccf3ade099 | ||
|
|
3c2ae53449 | ||
|
|
421498e1fe | ||
|
|
8909ded488 | ||
|
|
5114ceb4b7 | ||
|
|
1472b7d6a5 | ||
|
|
52d2cbf5dd | ||
|
|
e4529a949a | ||
|
|
6d1428ced9 | ||
|
|
0f700aeda5 | ||
|
|
7273ee9ce0 | ||
|
|
1a7cd2e250 | ||
|
|
99f78be344 | ||
|
|
ee528d1245 | ||
|
|
18b856602c | ||
|
|
0dcd054da3 | ||
|
|
268a0cd2ee | ||
|
|
c71dcb8a91 | ||
|
|
24306c04ec | ||
|
|
b986815fcb | ||
|
|
a70cc31d28 | ||
|
|
b097cb15e4 | ||
|
|
b18ebfb56f | ||
|
|
eade3d8e93 | ||
|
|
ccf440a65e | ||
|
|
551a0e4b9e | ||
|
|
4afe95ae26 | ||
|
|
c6151b58e2 | ||
|
|
6f91ad5881 | ||
|
|
09d9af492f | ||
|
|
bd37f8e22d | ||
|
|
c5485fbf55 | ||
|
|
f02272976a | ||
|
|
0b9429d1bd | ||
|
|
43e606f08e | ||
|
|
8fd2cb8f68 | ||
|
|
a19103c896 | ||
|
|
06660a9f46 | ||
|
|
aa1c2df26c | ||
|
|
03d696a8fa | ||
|
|
240b342870 | ||
|
|
ef9e6c798b | ||
|
|
a29c59f8d2 | ||
|
|
aa2e62d2b5 | ||
|
|
19f125dcc6 | ||
|
|
0f3ccb8045 | ||
|
|
2134c66124 | ||
|
|
5806b48bae | ||
|
|
507b0a9ace | ||
|
|
679dbe69b8 | ||
|
|
4f766d8617 | ||
|
|
90e74e5133 | ||
|
|
1c9b93d6ab | ||
|
|
5eafaa401a | ||
|
|
e0ba49a03c | ||
|
|
2725f6da58 | ||
|
|
8985579159 | ||
|
|
c03160c3fd | ||
|
|
9193dfcabb | ||
|
|
c4df4131df | ||
|
|
374d3d3627 | ||
|
|
fe65f8945c | ||
|
|
db4c46cf20 | ||
|
|
c00e52a9e2 | ||
|
|
c65ac42d64 | ||
|
|
95d041bf5e | ||
|
|
89d2d0b981 | ||
|
|
0417060c1b | ||
|
|
e7ea4c4b72 | ||
|
|
bbab248209 | ||
|
|
4401fb8773 | ||
|
|
3bbfeae228 | ||
|
|
4bb2098fe1 | ||
|
|
ee1258b177 | ||
|
|
341866b8bb | ||
|
|
dae6dd5390 | ||
|
|
03fd38aaa7 | ||
|
|
f99d18f6ae | ||
|
|
a47268830b | ||
|
|
838f69944e | ||
|
|
c6d6c3fd40 | ||
|
|
bf946ead54 | ||
|
|
2a2d6a777b | ||
|
|
5c90258546 | ||
|
|
018c4a1557 | ||
|
|
0bd49da8f4 | ||
|
|
1926dfa686 | ||
|
|
1c337b0cdc | ||
|
|
54b19ba659 | ||
|
|
336b978fd3 | ||
|
|
90c609d06d | ||
|
|
22e018e138 | ||
|
|
a676a44fea | ||
|
|
cd7785ce06 | ||
|
|
fb3513c6f6 | ||
|
|
0cf7813bea | ||
|
|
39f68e1acc | ||
|
|
be124fff75 | ||
|
|
db9e030b53 | ||
|
|
b1a7aac481 | ||
|
|
e03a438169 | ||
|
|
f934a3fa38 | ||
|
|
8f72e8e666 | ||
|
|
da9d64c56f | ||
|
|
e5f7c7d1cc | ||
|
|
08b4d062e9 | ||
|
|
a8bfa1b4cd | ||
|
|
312ea44922 | ||
|
|
6accc7e366 | ||
|
|
f16d626f0d | ||
|
|
636d39bd2d | ||
|
|
6730ddc7bc | ||
|
|
b66d676254 | ||
|
|
a6eb176ec3 | ||
|
|
8816e96ba3 | ||
|
|
5aaf134ba8 | ||
|
|
66391f69c4 | ||
|
|
b40a2559f6 | ||
|
|
741f4eaf14 | ||
|
|
be7e532ead | ||
|
|
72954be880 | ||
|
|
a16953c8a0 | ||
|
|
b2c0fb58da | ||
|
|
828c0dcb41 | ||
|
|
cd0f1617cb | ||
|
|
2607fc8551 | ||
|
|
1de2fb6811 | ||
|
|
c84a2173c8 | ||
|
|
c38ede1bd1 | ||
|
|
0f609662bb | ||
|
|
512655b448 | ||
|
|
4fea98467d | ||
|
|
29dad6bd8d | ||
|
|
e04f53c071 | ||
|
|
4b580ef5ad | ||
|
|
5232d5e97f | ||
|
|
011d817321 | ||
|
|
60c7a386f0 | ||
|
|
3ee06b6c62 | ||
|
|
57b407c894 | ||
|
|
9999eb62e4 | ||
|
|
930aee06dc | ||
|
|
e6ca1cd502 | ||
|
|
c875454b40 | ||
|
|
388962a5e7 | ||
|
|
9986f2ee5f | ||
|
|
529821ab9f | ||
|
|
d72d09f95d | ||
|
|
d810c213f6 | ||
|
|
2bdef97edf | ||
|
|
ce66ec6f5d | ||
|
|
df5076e90f | ||
|
|
faaa59f58b | ||
|
|
78ece8c2a2 | ||
|
|
8dff73d5f5 | ||
|
|
4bdb1d6939 | ||
|
|
59510383e6 | ||
|
|
f0f16a3a69 | ||
|
|
09c6a73e80 | ||
|
|
3108021007 | ||
|
|
fa3a0f9aa4 | ||
|
|
f45e8afb37 | ||
|
|
739f116895 | ||
|
|
f281103ca1 | ||
|
|
b7d14dcf2a | ||
|
|
5659a1e13c | ||
|
|
fb48c4d85d | ||
|
|
ce3ca419e8 | ||
|
|
c3b9e1f6c8 | ||
|
|
9ba0db1ab9 | ||
|
|
70d9aded42 | ||
|
|
a99f58b62f | ||
|
|
fcb1ad05fd | ||
|
|
50f8c7ec10 | ||
|
|
4094631f30 | ||
|
|
1cae1135b9 | ||
|
|
f78ca49ec0 | ||
|
|
e9c7607a4b | ||
|
|
6d49e266dd | ||
|
|
78cdb01ef1 | ||
|
|
1ed434c858 | ||
|
|
f4acbaacdc | ||
|
|
e777f3ccc4 | ||
|
|
9e61c9e4d2 | ||
|
|
3fb730ceba | ||
|
|
811ac871a3 | ||
|
|
54ed0299c0 | ||
|
|
09fcd72e43 | ||
|
|
0371836dc8 | ||
|
|
74e423e9f8 | ||
|
|
9868937c08 | ||
|
|
5c500859a3 | ||
|
|
1274a8deca | ||
|
|
4bbd82b715 | ||
|
|
827e610b8c | ||
|
|
10f3a25c54 | ||
|
|
e650d4afbc | ||
|
|
d738a804e6 | ||
|
|
1f7c5b28f8 | ||
|
|
a9d533e447 | ||
|
|
a9f91c8a9e | ||
|
|
04f1ac813e | ||
|
|
2b2672b9fd | ||
|
|
d0bba08f3a | ||
|
|
3f222b75d8 | ||
|
|
560245e005 | ||
|
|
cbd680a6ac | ||
|
|
f6b301a836 | ||
|
|
d1a1ebd016 | ||
|
|
9ffe37c21a | ||
|
|
30aa99ff0b | ||
|
|
3ee0075f1d | ||
|
|
05da8e2270 | ||
|
|
68ac692314 | ||
|
|
a4176510b9 | ||
|
|
55e890bdc1 | ||
|
|
98d3358fd5 | ||
|
|
68edb442d3 | ||
|
|
20e8c63d5c | ||
|
|
5d8e4bc040 | ||
|
|
71cf1e39f3 | ||
|
|
21be7a4c73 | ||
|
|
e7df4b26f0 | ||
|
|
11788fa37c | ||
|
|
e29ad28a06 | ||
|
|
9d30c2aed7 | ||
|
|
c62df67db2 | ||
|
|
c9e997c794 | ||
|
|
8a6d7d0d8d | ||
|
|
6cea4397f2 | ||
|
|
f0fffa71d4 | ||
|
|
49c117d5d7 | ||
|
|
19913cb665 | ||
|
|
810488e20c | ||
|
|
a91bc4c5b5 | ||
|
|
45e28f96dc | ||
|
|
b521f1c86f | ||
|
|
1d4082bdd0 | ||
|
|
df6cee3e11 | ||
|
|
15e1868fc2 | ||
|
|
113115b6df | ||
|
|
2445d076a1 | ||
|
|
8fc8549a6c | ||
|
|
bb3aac25c5 | ||
|
|
09fa95d4a0 | ||
|
|
acd87e351b | ||
|
|
8d53e8ff0f | ||
|
|
b900e918b4 | ||
|
|
067a744cda | ||
|
|
3e4c128347 | ||
|
|
acbe509c05 | ||
|
|
1bb0c6eb6f | ||
|
|
8889494848 | ||
|
|
8a780d6f0b | ||
|
|
0a2b508290 | ||
|
|
33e3aeb16e | ||
|
|
4526fa68df | ||
|
|
acfd499cfb | ||
|
|
b12c753179 | ||
|
|
7d623bb99d | ||
|
|
21684a6ea3 | ||
|
|
5306ec6809 | ||
|
|
fe2f8cf160 | ||
|
|
36999b0307 | ||
|
|
f4d01e48fa | ||
|
|
0816390509 | ||
|
|
9ce3a1a26c | ||
|
|
2797bdb4a5 | ||
|
|
ce7b221a11 | ||
|
|
2776546ab7 |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -51,3 +51,7 @@ log.txt
|
|||||||
G3DTest.suo
|
G3DTest.suo
|
||||||
G3DTest.suo
|
G3DTest.suo
|
||||||
stderr.txt
|
stderr.txt
|
||||||
|
desktop.ini
|
||||||
|
main.cpp
|
||||||
|
*.db
|
||||||
|
G3DTest.sln
|
||||||
|
|||||||
953
Application.cpp
Normal file
953
Application.cpp
Normal file
@@ -0,0 +1,953 @@
|
|||||||
|
#include <G3DAll.h>
|
||||||
|
#include <initguid.h>
|
||||||
|
#include <iomanip>
|
||||||
|
#include "Instance.h"
|
||||||
|
#include "resource.h"
|
||||||
|
#include "PartInstance.h"
|
||||||
|
#include "TextButtonInstance.h"
|
||||||
|
#include "ImageButtonInstance.h"
|
||||||
|
#include "DataModelInstance.h"
|
||||||
|
#include "CameraController.h"
|
||||||
|
#include "AudioPlayer.h"
|
||||||
|
#include "Globals.h"
|
||||||
|
#include "Application.h"
|
||||||
|
#include "win32Defines.h"
|
||||||
|
#include "WindowFunctions.h"
|
||||||
|
#include <limits.h>
|
||||||
|
#include <mshtml.h>
|
||||||
|
#include <exdisp.h>
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
#include "ax.h"
|
||||||
|
#include <cguid.h>
|
||||||
|
#include "IEBrowser.h"
|
||||||
|
#include "PropertyWindow.h"
|
||||||
|
#include <commctrl.h>
|
||||||
|
#include "StringFunctions.h"
|
||||||
|
#include "GuiRoot.h"
|
||||||
|
|
||||||
|
#include "GUDButtonListener.h"
|
||||||
|
#include "ModeSelectionListener.h"
|
||||||
|
#include "DeleteListener.h"
|
||||||
|
#include "CameraButtonListener.h"
|
||||||
|
#include "RotateButtonListener.h"
|
||||||
|
|
||||||
|
Ray testRay;
|
||||||
|
static int cursorid = 0;
|
||||||
|
static int cursorOvrid = 0;
|
||||||
|
static int currentcursorid = 0;
|
||||||
|
static G3D::TextureRef cursor = NULL;
|
||||||
|
static G3D::TextureRef cursorOvr = NULL;
|
||||||
|
static bool mouseMovedBeginMotion = false;
|
||||||
|
static POINT oldGlobalMouse;
|
||||||
|
Vector2 oldMouse = Vector2(0,0);
|
||||||
|
float moveRate = 0.5;
|
||||||
|
|
||||||
|
void Application::clearInstances()
|
||||||
|
{
|
||||||
|
delete _dataModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
PartInstance* Application::makePart()
|
||||||
|
{
|
||||||
|
PartInstance* part = new PartInstance();
|
||||||
|
return part;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Application::setFocus(bool focus)
|
||||||
|
{
|
||||||
|
if(_propWindow != NULL)
|
||||||
|
if(focus)
|
||||||
|
{
|
||||||
|
ShowWindow(_propWindow->_hwndProp, SW_SHOW);
|
||||||
|
SetWindowPos(_propWindow->_hwndProp, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetWindowPos(_propWindow->_hwndProp, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Application::Application(HWND parentWindow) : _propWindow(NULL) { //: GApp(settings,window) {
|
||||||
|
|
||||||
|
|
||||||
|
std::string tempPath = ((std::string)getenv("temp")) + "/"+g_PlaceholderName;
|
||||||
|
CreateDirectory(tempPath.c_str(), NULL);
|
||||||
|
|
||||||
|
_hWndMain = parentWindow;
|
||||||
|
|
||||||
|
HMODULE hThisInstance = GetModuleHandle(NULL);
|
||||||
|
|
||||||
|
_hwndToolbox = CreateWindowEx(
|
||||||
|
WS_EX_ACCEPTFILES,
|
||||||
|
"AX",
|
||||||
|
"{8856F961-340A-11D0-A96B-00C04FD705A2}",
|
||||||
|
WS_CHILD | WS_VISIBLE,
|
||||||
|
0,
|
||||||
|
560,
|
||||||
|
800,
|
||||||
|
60,
|
||||||
|
_hWndMain, // parent
|
||||||
|
NULL, // menu
|
||||||
|
hThisInstance,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
_hwndRenderer = CreateWindowEx(
|
||||||
|
WS_EX_ACCEPTFILES,
|
||||||
|
"G3DWindow",
|
||||||
|
"3D",
|
||||||
|
WS_CHILD,
|
||||||
|
CW_USEDEFAULT,
|
||||||
|
CW_USEDEFAULT,
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
_hWndMain, // parent
|
||||||
|
NULL, // menu
|
||||||
|
hThisInstance,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
_settings.window.resizable = true;
|
||||||
|
_settings.writeLicenseFile = false;
|
||||||
|
_settings.logFilename = tempPath + "/g3dlog.txt";
|
||||||
|
_settings.window.center = true;
|
||||||
|
Win32Window* window = Win32Window::create(_settings.window,_hwndRenderer);
|
||||||
|
ShowWindow(_hwndRenderer, SW_SHOW);
|
||||||
|
ShowWindow(_hWndMain, SW_SHOW);
|
||||||
|
|
||||||
|
quit=false;
|
||||||
|
rightButtonHolding=false;
|
||||||
|
mouseOnScreen=false;
|
||||||
|
// GApp replacement
|
||||||
|
renderDevice = new RenderDevice();
|
||||||
|
if (window != NULL) {
|
||||||
|
renderDevice->init(window, NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox(NULL,"Window not found!","Error",MB_OK | MB_ICONSTOP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_window = renderDevice->window();
|
||||||
|
_window->makeCurrent();
|
||||||
|
|
||||||
|
SetWindowLongPtr(_hWndMain,GWL_USERDATA,(LONG)this);
|
||||||
|
SetWindowLongPtr(_hwndRenderer,GWL_USERDATA,(LONG)this);
|
||||||
|
_propWindow = new PropertyWindow(0, 0, 200, 640, hThisInstance);
|
||||||
|
IEBrowser* webBrowser = new IEBrowser(_hwndToolbox);
|
||||||
|
webBrowser->navigateSyncURL(L"http://androdome.com/g3d/toolbox/");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Application::deleteInstance()
|
||||||
|
{
|
||||||
|
if(g_selectedInstances.size() > 0)
|
||||||
|
{
|
||||||
|
size_t undeletable = 0;
|
||||||
|
while(g_selectedInstances.size() > undeletable)
|
||||||
|
{
|
||||||
|
if(g_selectedInstances.at(0)->canDelete)
|
||||||
|
{
|
||||||
|
AudioPlayer::playSound(GetFileInPath("/content/sounds/pageturn.wav"));
|
||||||
|
Instance* selectedInstance = g_selectedInstances.at(0);
|
||||||
|
if(selectedInstance->getParent() != NULL)
|
||||||
|
selectedInstance->getParent()->removeChild(selectedInstance);
|
||||||
|
delete selectedInstance;
|
||||||
|
selectedInstance = NULL;
|
||||||
|
g_selectedInstances.erase(g_selectedInstances.begin());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
undeletable++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(g_selectedInstances.size() == 0)
|
||||||
|
g_usableApp->_propWindow->ClearProperties();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Application::onInit() {
|
||||||
|
|
||||||
|
// Called before Application::run() beings
|
||||||
|
cameraController.setFrame(Vector3(0,2,10));
|
||||||
|
_dataModel = new DataModelInstance();
|
||||||
|
_dataModel->setParent(NULL);
|
||||||
|
_dataModel->name = "undefined";
|
||||||
|
_dataModel->font = g_fntdominant;
|
||||||
|
g_dataModel = _dataModel;
|
||||||
|
|
||||||
|
//initGUI();
|
||||||
|
|
||||||
|
#ifdef LEGACY_LOAD_G3DFUN_LEVEL
|
||||||
|
PartInstance* test = makePart();
|
||||||
|
test->setParent(_dataModel->getWorkspace());
|
||||||
|
test->color = Color3(0.2F,0.3F,1);
|
||||||
|
test->setSize(Vector3(24,1,24));
|
||||||
|
test->setPosition(Vector3(0,0,0));
|
||||||
|
test->setCFrame(test->getCFrame() * Matrix3::fromEulerAnglesXYZ(0,toRadians(0),toRadians(0)));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
test = makePart();
|
||||||
|
test->setParent(_dataModel->getWorkspace());
|
||||||
|
test->color = Color3(.5F,1,.5F);
|
||||||
|
test->setSize(Vector3(4,1,2));
|
||||||
|
test->setPosition(Vector3(-10,1,0));
|
||||||
|
test = makePart();
|
||||||
|
test->setParent(_dataModel->getWorkspace());
|
||||||
|
test->color = Color3(.5F,1,.5F);
|
||||||
|
test->setSize(Vector3(4,1,2));
|
||||||
|
test->setPosition(Vector3(10,1,0));
|
||||||
|
|
||||||
|
test = makePart();
|
||||||
|
test->setParent(_dataModel->getWorkspace());
|
||||||
|
test->color = Color3::gray();
|
||||||
|
test->setSize(Vector3(4,1,2));
|
||||||
|
test->setPosition(Vector3(7,2,0));
|
||||||
|
|
||||||
|
test = makePart();
|
||||||
|
test->setParent(_dataModel->getWorkspace());
|
||||||
|
test->color = Color3::gray();
|
||||||
|
test->setSize(Vector3(4,1,2));
|
||||||
|
test->setPosition(Vector3(-7,2,0));
|
||||||
|
|
||||||
|
test = makePart();
|
||||||
|
test->setParent(_dataModel->getWorkspace());
|
||||||
|
test->color = Color3::gray();
|
||||||
|
test->setSize(Vector3(4,1,2));
|
||||||
|
test->setPosition(Vector3(4,3,0));
|
||||||
|
|
||||||
|
test = makePart();
|
||||||
|
test->setParent(_dataModel->getWorkspace());
|
||||||
|
test->color = Color3::gray();
|
||||||
|
test->setSize(Vector3(4,1,2));
|
||||||
|
test->setPosition(Vector3(-5,3,0));
|
||||||
|
|
||||||
|
test = makePart();
|
||||||
|
test->setParent(_dataModel->getWorkspace());
|
||||||
|
test->color = Color3::gray();
|
||||||
|
test->setSize(Vector3(4,1,2));
|
||||||
|
test->setPosition(Vector3(1,4,0));
|
||||||
|
|
||||||
|
test = makePart();
|
||||||
|
test->setParent(_dataModel->getWorkspace());
|
||||||
|
test->color = Color3::gray();
|
||||||
|
test->setSize(Vector3(4,1,2));
|
||||||
|
test->setPosition(Vector3(-3,4,0));
|
||||||
|
|
||||||
|
test = makePart();
|
||||||
|
test->setParent(_dataModel->getWorkspace());
|
||||||
|
test->color = Color3::gray();
|
||||||
|
test->setSize(Vector3(4,1,2));
|
||||||
|
test->setPosition(Vector3(-2,5,0));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
test = makePart();
|
||||||
|
test->setParent(_dataModel->getWorkspace());
|
||||||
|
test->color = Color3::gray();
|
||||||
|
test->setSize(Vector3(4,1,2));
|
||||||
|
test->setPosition(Vector3(0,6,0));
|
||||||
|
|
||||||
|
test = makePart();
|
||||||
|
test->setParent(_dataModel->getWorkspace());
|
||||||
|
test->color = Color3::gray();
|
||||||
|
test->setSize(Vector3(4,1,2));
|
||||||
|
test->setPosition(Vector3(2,7,0));
|
||||||
|
#else
|
||||||
|
_dataModel->debugGetOpen();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//setDesiredFrameRate(60);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//GApplet::onInit();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void Application::onCleanup() {
|
||||||
|
clearInstances();
|
||||||
|
sky->~Sky();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void Application::onLogic() {
|
||||||
|
// Add non-simulation game logic and AI code here
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Application::onNetwork() {
|
||||||
|
// Poll net messages here
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//double getVectorDistance(Vector3 vector1, Vector3 vector2)
|
||||||
|
//{
|
||||||
|
// return pow(pow((double)vector1.x - (double)vector2.x, 2) + pow((double)vector1.y - (double)vector2.y, 2) + pow((double)vector1.z - (double)vector2.z, 2), 0.5);
|
||||||
|
//}
|
||||||
|
|
||||||
|
std::vector<Instance*> Application::getSelection()
|
||||||
|
{
|
||||||
|
return g_selectedInstances;
|
||||||
|
}
|
||||||
|
void Application::onSimulation(RealTime rdt, SimTime sdt, SimTime idt) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_dataModel->getGuiRoot()->update();
|
||||||
|
|
||||||
|
if(_dataModel->name != _title)
|
||||||
|
{
|
||||||
|
_title = _dataModel->name;
|
||||||
|
std::string text = "Game \"" + _title + "\"";
|
||||||
|
SetWindowText(_hWndMain, text.c_str());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
cameraController.update(this);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*double getOSVersion() {
|
||||||
|
OSVERSIONINFO osvi;
|
||||||
|
|
||||||
|
ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
|
||||||
|
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
||||||
|
|
||||||
|
GetVersionEx(&osvi);
|
||||||
|
std::string version = Convert(osvi.dwMajorVersion) + "." + Convert(osvi.dwMinorVersion);
|
||||||
|
return ::atof(version.c_str());
|
||||||
|
}*/
|
||||||
|
/*
|
||||||
|
bool IsHolding(int button)
|
||||||
|
{
|
||||||
|
return (GetKeyState(button) >> 1)>0;
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
void Application::onUserInput(UserInput* ui) {
|
||||||
|
|
||||||
|
/*
|
||||||
|
if(GetHoldKeyState(VK_LCONTROL))
|
||||||
|
{
|
||||||
|
if(GetHoldKeyState('D'))
|
||||||
|
{
|
||||||
|
_messageTime = System::time();
|
||||||
|
if(debugMode())
|
||||||
|
_message = "Debug Mode Disabled";
|
||||||
|
else
|
||||||
|
_message = "Debug Mode Enabled";
|
||||||
|
setDebugMode(!debugMode());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
if(GetHoldKeyState(VK_F8))
|
||||||
|
{
|
||||||
|
_dataModel->getGuiRoot()->setDebugMessage("FOV Set to 10", System::time());
|
||||||
|
}
|
||||||
|
//}
|
||||||
|
|
||||||
|
//_dataModel->mousex = ui->getMouseX();
|
||||||
|
//_dataModel->mousey = ui->getMouseY();
|
||||||
|
_dataModel->mouseButton1Down = (GetKeyState(VK_LBUTTON) & 0x100) != 0;
|
||||||
|
|
||||||
|
if (GetHoldKeyState(VK_LBUTTON)) {
|
||||||
|
if (_dragging) {
|
||||||
|
PartInstance* part = NULL;
|
||||||
|
if(g_selectedInstances.size() > 0)
|
||||||
|
part = (PartInstance*) g_selectedInstances.at(0);
|
||||||
|
Ray dragRay = cameraController.getCamera()->worldRay(_dataModel->mousex, _dataModel->mousey, renderDevice->getViewport());
|
||||||
|
std::vector<Instance*> instances = _dataModel->getWorkspace()->getAllChildren();
|
||||||
|
for(size_t i = 0; i < instances.size(); i++)
|
||||||
|
{
|
||||||
|
if(PartInstance* moveTo = dynamic_cast<PartInstance*>(instances.at(i)))
|
||||||
|
{
|
||||||
|
float __time = testRay.intersectionTime(moveTo->getBox());
|
||||||
|
float __nearest=std::numeric_limits<float>::infinity();
|
||||||
|
if (__time != inf())
|
||||||
|
{
|
||||||
|
if (__nearest>__time)
|
||||||
|
{
|
||||||
|
// BROKEN
|
||||||
|
//Vector3 closest = (dragRay.closestPoint(moveTo->getPosition()) * 2);
|
||||||
|
//part->setPosition(closest);
|
||||||
|
//part->setPosition(Vector3(floor(closest.x),part->getPosition().y,floor(closest.z)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Sleep(10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Camera KB Handling {
|
||||||
|
if (GetKPBool(VK_OEM_COMMA)) //Left
|
||||||
|
g_usableApp->cameraController.panLeft();
|
||||||
|
else if (GetKPBool(VK_OEM_PERIOD)) // Right
|
||||||
|
g_usableApp->cameraController.panRight();
|
||||||
|
else if (GetKPBool(0x49)) // Zoom In (I)
|
||||||
|
g_usableApp->cameraController.Zoom(1);
|
||||||
|
else if (GetKPBool(0x4F)) // Zoom Out (O)
|
||||||
|
g_usableApp->cameraController.Zoom(-1);
|
||||||
|
// }
|
||||||
|
|
||||||
|
//readMouseGUIInput();
|
||||||
|
// Add other key handling here
|
||||||
|
}
|
||||||
|
|
||||||
|
void Application::makeFlag(Vector3 &vec, RenderDevice* &rd)
|
||||||
|
{
|
||||||
|
|
||||||
|
Vector3 up = Vector3(vec.x, vec.y+3, vec.z);
|
||||||
|
rd->setColor(Color3::blue());
|
||||||
|
rd->beforePrimitive();
|
||||||
|
|
||||||
|
glBegin(GL_LINES);
|
||||||
|
glVertex3f(vec.x, vec.y, vec.z);
|
||||||
|
glVertex3f(up.x, up.y, up.z);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
glBegin( GL_TRIANGLES );
|
||||||
|
glVertex3f(up.x, up.y-1, up.z);
|
||||||
|
glVertex3f(up.x, up.y-0.5, up.z-1);
|
||||||
|
glVertex3f(up.x, up.y, up.z);
|
||||||
|
|
||||||
|
glVertex3f(up.x, up.y, up.z);
|
||||||
|
glVertex3f(up.x, up.y-0.5, up.z-1);
|
||||||
|
glVertex3f(up.x, up.y-1, up.z);
|
||||||
|
|
||||||
|
glEnd();
|
||||||
|
rd->afterPrimitive();
|
||||||
|
rd->setColor(Color3::white());
|
||||||
|
//I know how i will approach this now
|
||||||
|
}
|
||||||
|
|
||||||
|
void Application::setMode(int mode)
|
||||||
|
{
|
||||||
|
_mode = mode;
|
||||||
|
}
|
||||||
|
int Application::getMode()
|
||||||
|
{
|
||||||
|
return _mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Application::drawOutline(Vector3 from, Vector3 to, RenderDevice* rd, LightingParameters lighting, Vector3 size, Vector3 pos, CoordinateFrame c)
|
||||||
|
{
|
||||||
|
|
||||||
|
Color3 outline = Color3::cyan();//Color3(0.098F,0.6F,1.0F);
|
||||||
|
float offsetSize = 0.05F;
|
||||||
|
//X
|
||||||
|
Draw::box(c.toWorldSpace(Box(Vector3(from.x - offsetSize, from.y + offsetSize, from.z + offsetSize), Vector3(to.x + offsetSize, from.y - offsetSize, from.z - offsetSize))), rd, outline, Color4::clear());
|
||||||
|
Draw::box(c.toWorldSpace(Box(Vector3(from.x - offsetSize, to.y + offsetSize, from.z + offsetSize), Vector3(to.x + offsetSize, to.y - offsetSize, from.z - offsetSize))), rd, outline, Color4::clear());
|
||||||
|
Draw::box(c.toWorldSpace(Box(Vector3(from.x - offsetSize, to.y + offsetSize, to.z + offsetSize), Vector3(to.x + offsetSize, to.y - offsetSize, to.z - offsetSize))), rd, outline, Color4::clear());
|
||||||
|
Draw::box(c.toWorldSpace(Box(Vector3(from.x - offsetSize, from.y + offsetSize, to.z + offsetSize), Vector3(to.x + offsetSize, from.y - offsetSize, to.z - offsetSize))), rd, outline, Color4::clear());
|
||||||
|
//Y
|
||||||
|
Draw::box(c.toWorldSpace(Box(Vector3(from.x + offsetSize, from.y - offsetSize + 0.1, from.z + offsetSize), Vector3(from.x - offsetSize, to.y + offsetSize - 0.1, from.z - offsetSize))), rd, outline, Color4::clear());
|
||||||
|
Draw::box(c.toWorldSpace(Box(Vector3(to.x + offsetSize, from.y - offsetSize + 0.1, from.z + offsetSize), Vector3(to.x - offsetSize, to.y + offsetSize - 0.1, from.z - offsetSize))), rd, outline, Color4::clear());
|
||||||
|
Draw::box(c.toWorldSpace(Box(Vector3(to.x + offsetSize, from.y - offsetSize + 0.1, to.z + offsetSize), Vector3(to.x - offsetSize, to.y + offsetSize-0.1, to.z - offsetSize))), rd, outline, Color4::clear());
|
||||||
|
Draw::box(c.toWorldSpace(Box(Vector3(from.x + offsetSize, from.y - offsetSize + 0.1, to.z + offsetSize), Vector3(from.x - offsetSize, to.y + offsetSize - 0.1, to.z - offsetSize))), rd, outline, Color4::clear());
|
||||||
|
|
||||||
|
//Z
|
||||||
|
Draw::box(c.toWorldSpace(Box(Vector3(from.x + offsetSize, from.y + offsetSize, from.z - offsetSize), Vector3(from.x - offsetSize, from.y - offsetSize, to.z + offsetSize))), rd, outline, Color4::clear());
|
||||||
|
Draw::box(c.toWorldSpace(Box(Vector3(from.x + offsetSize, to.y + offsetSize, from.z - offsetSize), Vector3(from.x - offsetSize, to.y - offsetSize, to.z + offsetSize))), rd, outline, Color4::clear());
|
||||||
|
Draw::box(c.toWorldSpace(Box(Vector3(to.x + offsetSize, from.y + offsetSize, from.z - offsetSize), Vector3(to.x - offsetSize, from.y - offsetSize, to.z + offsetSize))), rd, outline, Color4::clear());
|
||||||
|
Draw::box(c.toWorldSpace(Box(Vector3(to.x + offsetSize, to.y + offsetSize, from.z - offsetSize), Vector3(to.x - offsetSize, to.y - offsetSize, to.z + offsetSize))), rd, outline, Color4::clear());
|
||||||
|
|
||||||
|
if(_mode == ARROWS)
|
||||||
|
{
|
||||||
|
rd->setLight(0, NULL);
|
||||||
|
rd->setAmbientLightColor(Color3(1,1,1));
|
||||||
|
|
||||||
|
AABox box;
|
||||||
|
c.toWorldSpace(Box(from, to)).getBounds(box);
|
||||||
|
float max = box.high().y - pos.y;
|
||||||
|
|
||||||
|
Draw::arrow(pos, Vector3(0, 1.5+max, 0), rd);
|
||||||
|
Draw::arrow(pos, Vector3(0, (-1.5)-max, 0), rd);
|
||||||
|
|
||||||
|
max = box.high().x - pos.x;
|
||||||
|
|
||||||
|
Draw::arrow(pos, Vector3(1.5+max, 0, 0), rd);
|
||||||
|
Draw::arrow(pos, Vector3((-1.5)-max, 0, 0), rd);
|
||||||
|
|
||||||
|
max = box.high().z - pos.z;
|
||||||
|
|
||||||
|
Draw::arrow(pos, Vector3(0, 0, 1.5+max), rd);
|
||||||
|
Draw::arrow(pos, Vector3(0, 0, (-1.5)-max), rd);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
rd->setAmbientLightColor(lighting.ambient);
|
||||||
|
rd->setLight(0, GLight::directional(lighting.lightDirection, lighting.lightColor));
|
||||||
|
}
|
||||||
|
else if(_mode == RESIZE)
|
||||||
|
{
|
||||||
|
Color3 sphereColor = outline;
|
||||||
|
rd->setLight(0, NULL);
|
||||||
|
rd->setAmbientLightColor(Color3(1,1,1));
|
||||||
|
Vector3 gamepoint = pos;
|
||||||
|
Vector3 camerapoint = rd->getCameraToWorldMatrix().translation;
|
||||||
|
float distance = pow(pow((double)gamepoint.x - (double)camerapoint.x, 2) + pow((double)gamepoint.y - (double)camerapoint.y, 2) + pow((double)gamepoint.z - (double)camerapoint.z, 2), 0.5);
|
||||||
|
if(distance < 200)
|
||||||
|
{
|
||||||
|
|
||||||
|
float multiplier = distance * 0.025F/2;
|
||||||
|
if(multiplier < 0.25F)
|
||||||
|
multiplier = 0.25F;
|
||||||
|
Vector3 position = pos + (c.lookVector()*((size.z/2)+1));
|
||||||
|
Draw::sphere(Sphere(position, multiplier), rd, sphereColor, Color4::clear());
|
||||||
|
position = pos - (c.lookVector()*((size.z/2)+1));
|
||||||
|
Draw::sphere(Sphere(position, multiplier), rd, sphereColor, Color4::clear());
|
||||||
|
|
||||||
|
position = pos + (c.rightVector()*((size.x/2)+1));
|
||||||
|
Draw::sphere(Sphere(position, multiplier), rd, sphereColor, Color4::clear());
|
||||||
|
position = pos - (c.rightVector()*((size.x/2)+1));
|
||||||
|
Draw::sphere(Sphere(position, multiplier), rd, sphereColor, Color4::clear());
|
||||||
|
|
||||||
|
position = pos + (c.upVector()*((size.y/2)+1));
|
||||||
|
Draw::sphere(Sphere(position, multiplier), rd, sphereColor, Color4::clear());
|
||||||
|
position = pos - (c.upVector()*((size.y/2)+1));
|
||||||
|
Draw::sphere(Sphere(position, multiplier), rd, sphereColor, Color4::clear());
|
||||||
|
}
|
||||||
|
rd->setAmbientLightColor(lighting.ambient);
|
||||||
|
rd->setLight(0, GLight::directional(lighting.lightDirection, lighting.lightColor));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Application::exitApplication()
|
||||||
|
{
|
||||||
|
//endApplet = true;
|
||||||
|
//endProgram = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Application::onGraphics(RenderDevice* rd) {
|
||||||
|
|
||||||
|
G3D::uint8 num = 0;
|
||||||
|
POINT mousepos;
|
||||||
|
mouseOnScreen = true;
|
||||||
|
if (GetCursorPos(&mousepos))
|
||||||
|
{
|
||||||
|
POINT pointm = mousepos;
|
||||||
|
if (ScreenToClient(_hWndMain, &mousepos))
|
||||||
|
{
|
||||||
|
//mouseOnScreen = true;
|
||||||
|
//POINT pointm;
|
||||||
|
///GetCursorPos(&pointm);
|
||||||
|
if(_hwndRenderer != WindowFromPoint(pointm)) //OLD: mousepos.x < 1 || mousepos.y < 1 || mousepos.x >= rd->getViewport().width()-1 || mousepos.y >= rd->getViewport().height()-1
|
||||||
|
{
|
||||||
|
mouseOnScreen = false;
|
||||||
|
//ShowCursor(true);
|
||||||
|
_window->setMouseVisible(true);
|
||||||
|
//rd->window()->setInputCaptureCount(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mouseOnScreen = true;
|
||||||
|
//SetCursor(NULL);
|
||||||
|
_window->setMouseVisible(false);
|
||||||
|
//rd->window()->setInputCaptureCount(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(Globals::useMousePoint)
|
||||||
|
{
|
||||||
|
mousepos = Globals::mousepoint;
|
||||||
|
ScreenToClient(_hWndMain, &mousepos);
|
||||||
|
}
|
||||||
|
|
||||||
|
LightingParameters lighting(G3D::toSeconds(11, 00, 00, AM));
|
||||||
|
renderDevice->setProjectionAndCameraMatrix(*cameraController.getCamera());
|
||||||
|
|
||||||
|
// Cyan background
|
||||||
|
//renderDevice->setColorClearValue(Color3(0.0f, 0.5f, 1.0f));
|
||||||
|
|
||||||
|
renderDevice->clear(sky.isNull(), true, true);
|
||||||
|
if (sky.notNull()) {
|
||||||
|
sky->render(renderDevice, lighting);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setup lighting
|
||||||
|
renderDevice->enableLighting();
|
||||||
|
|
||||||
|
renderDevice->setShadeMode(RenderDevice::SHADE_SMOOTH);
|
||||||
|
renderDevice->setAmbientLightColor(Color3(1,1,1));
|
||||||
|
|
||||||
|
renderDevice->setLight(0, GLight::directional(lighting.lightDirection, lighting.lightColor));
|
||||||
|
renderDevice->setAmbientLightColor(lighting.ambient);
|
||||||
|
|
||||||
|
rd->beforePrimitive();
|
||||||
|
CoordinateFrame forDraw = rd->getObjectToWorldMatrix();
|
||||||
|
glEnableClientState(GL_VERTEX_ARRAY);
|
||||||
|
glEnableClientState(GL_COLOR_ARRAY);
|
||||||
|
glEnableClientState(GL_NORMAL_ARRAY);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < _dataModel->getWorkspace()->__pvVector.size(); i++)
|
||||||
|
{
|
||||||
|
_dataModel->getWorkspace()->__pvVector[i]->render(rd);
|
||||||
|
}
|
||||||
|
//_dataModel->getWorkspace()->render(rd);
|
||||||
|
glDisableClientState(GL_VERTEX_ARRAY);
|
||||||
|
glDisableClientState(GL_COLOR_ARRAY);
|
||||||
|
glDisableClientState(GL_NORMAL_ARRAY);
|
||||||
|
rd->setObjectToWorldMatrix(forDraw);
|
||||||
|
rd->afterPrimitive();
|
||||||
|
|
||||||
|
if(g_selectedInstances.size() > 0)
|
||||||
|
{
|
||||||
|
for(size_t i = 0; i < g_selectedInstances.size(); i++)
|
||||||
|
{
|
||||||
|
if(PartInstance* part = dynamic_cast<PartInstance*>(g_selectedInstances.at(i)))
|
||||||
|
{
|
||||||
|
Vector3 size = part->getSize();
|
||||||
|
Vector3 pos = part->getPosition();
|
||||||
|
drawOutline(Vector3(0+size.x/2, 0+size.y/2, 0+size.z/2) ,Vector3(0-size.x/2,0-size.y/2,0-size.z/2), rd, lighting, Vector3(size.x/2, size.y/2, size.z/2), Vector3(pos.x, pos.y, pos.z), part->getCFrameRenderBased());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Vector3 gamepoint = Vector3(0, 5, 0);
|
||||||
|
//Vector3 camerapoint = rd->getCameraToWorldMatrix().translation;
|
||||||
|
//float distance = pow(pow((double)gamepoint.x - (double)camerapoint.x, 2) + pow((double)gamepoint.y - (double)camerapoint.y, 2) + pow((double)gamepoint.z - (double)camerapoint.z, 2), 0.5);
|
||||||
|
//if(distance < 50 && distance > -50)
|
||||||
|
|
||||||
|
//{
|
||||||
|
// if(distance < 0)
|
||||||
|
// distance = distance*-1;
|
||||||
|
// fntdominant->draw3D(rd, "Testing", CoordinateFrame(rd->getCameraToWorldMatrix().rotation, gamepoint), 0.04*distance, Color3::yellow(), Color3::black(), G3D::GFont::XALIGN_CENTER, G3D::GFont::YALIGN_CENTER);
|
||||||
|
//}
|
||||||
|
|
||||||
|
renderDevice->disableLighting();
|
||||||
|
|
||||||
|
if (sky.notNull()) {
|
||||||
|
sky->renderLensFlare(renderDevice, lighting);
|
||||||
|
}
|
||||||
|
renderDevice->push2D();
|
||||||
|
_dataModel->getGuiRoot()->renderGUI(renderDevice, m_graphicsWatch.FPS());
|
||||||
|
rd->pushState();
|
||||||
|
rd->beforePrimitive();
|
||||||
|
|
||||||
|
if(Globals::showMouse && mouseOnScreen)
|
||||||
|
{
|
||||||
|
glEnable( GL_TEXTURE_2D );
|
||||||
|
glEnable(GL_BLEND);// you enable blending function
|
||||||
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
|
std::vector<Instance*> instances = _dataModel->getWorkspace()->getAllChildren();
|
||||||
|
currentcursorid = cursorid;
|
||||||
|
for(size_t i = 0; i < instances.size(); i++)
|
||||||
|
{
|
||||||
|
if(PartInstance* test = dynamic_cast<PartInstance*>(instances.at(i)))
|
||||||
|
{
|
||||||
|
float time = cameraController.getCamera()->worldRay(_dataModel->mousex, _dataModel->mousey, renderDevice->getViewport()).intersectionTime(test->getBox());
|
||||||
|
//float time = testRay.intersectionTime(test->getBox());
|
||||||
|
if (time != inf())
|
||||||
|
{
|
||||||
|
currentcursorid = cursorOvrid;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
glBindTexture( GL_TEXTURE_2D, currentcursorid);
|
||||||
|
|
||||||
|
|
||||||
|
glBegin( GL_QUADS );
|
||||||
|
glTexCoord2d(0.0,0.0);
|
||||||
|
glVertex2f(mousepos.x-64, mousepos.y-64);
|
||||||
|
glTexCoord2d( 1.0,0.0 );
|
||||||
|
glVertex2f(mousepos.x+64, mousepos.y-64);
|
||||||
|
glTexCoord2d(1.0,1.0 );
|
||||||
|
glVertex2f(mousepos.x+64, mousepos.y+64 );
|
||||||
|
glTexCoord2d( 0.0,1.0 );
|
||||||
|
glVertex2f( mousepos.x-64, mousepos.y+64 );
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
glDisable( GL_TEXTURE_2D );
|
||||||
|
}
|
||||||
|
|
||||||
|
rd->afterPrimitive();
|
||||||
|
rd->popState();
|
||||||
|
renderDevice->pop2D();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Application::onKeyPressed(int key)
|
||||||
|
{
|
||||||
|
if(key==VK_DELETE)
|
||||||
|
{
|
||||||
|
deleteInstance();
|
||||||
|
}
|
||||||
|
if (GetHoldKeyState(VK_RCONTROL))
|
||||||
|
{
|
||||||
|
if (key=='O')
|
||||||
|
{
|
||||||
|
_dataModel->getOpen();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void Application::onKeyUp(int key)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Application::onMouseLeftPressed(HWND hwnd,int x,int y)
|
||||||
|
{
|
||||||
|
//Removed set focus
|
||||||
|
|
||||||
|
|
||||||
|
std::cout << "Click: " << x << "," << y << std::endl;
|
||||||
|
|
||||||
|
bool onGUI = _dataModel->getGuiRoot()->mouseInGUI(renderDevice, x, y);
|
||||||
|
|
||||||
|
|
||||||
|
if(!onGUI)
|
||||||
|
{
|
||||||
|
testRay = cameraController.getCamera()->worldRay(_dataModel->mousex, _dataModel->mousey, renderDevice->getViewport());
|
||||||
|
float nearest=std::numeric_limits<float>::infinity();
|
||||||
|
Vector3 camPos = cameraController.getCamera()->getCoordinateFrame().translation;
|
||||||
|
std::vector<Instance*> instances = _dataModel->getWorkspace()->getAllChildren();
|
||||||
|
bool objFound = false;
|
||||||
|
for(size_t i = 0; i < instances.size(); i++)
|
||||||
|
{
|
||||||
|
if(PartInstance* test = dynamic_cast<PartInstance*>(instances.at(i)))
|
||||||
|
{
|
||||||
|
float time = testRay.intersectionTime(test->getBox());
|
||||||
|
|
||||||
|
if (time != inf())
|
||||||
|
{
|
||||||
|
objFound = true;
|
||||||
|
if (nearest>time)
|
||||||
|
{
|
||||||
|
nearest=time;
|
||||||
|
bool found = false;
|
||||||
|
for(size_t i = 0; i < g_selectedInstances.size(); i++)
|
||||||
|
{
|
||||||
|
if(g_selectedInstances.at(i) == test)
|
||||||
|
{
|
||||||
|
found = true;
|
||||||
|
//ShowWindow(_propWindow->_hwndProp, SW_SHOW);
|
||||||
|
//SetActiveWindow(_propWindow->_hwndProp);
|
||||||
|
//SetForegroundWindow(_propWindow->_hwndProp);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!found)
|
||||||
|
{
|
||||||
|
g_selectedInstances.clear();
|
||||||
|
g_selectedInstances.push_back(test);
|
||||||
|
}
|
||||||
|
selectInstance(test, _propWindow);
|
||||||
|
//_message = "Dragging = true.";
|
||||||
|
//_messageTime = System::time();
|
||||||
|
//_dragging = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!objFound)
|
||||||
|
selectInstance(_dataModel,_propWindow);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Application::selectInstance(Instance* selectedInstance, PropertyWindow* propWindow)
|
||||||
|
{
|
||||||
|
g_selectedInstances.clear();
|
||||||
|
g_selectedInstances.push_back(selectedInstance);
|
||||||
|
propWindow->UpdateSelected(selectedInstance);
|
||||||
|
|
||||||
|
}
|
||||||
|
G3D::RenderDevice* Application::getRenderDevice()
|
||||||
|
{
|
||||||
|
return renderDevice;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Application::onMouseLeftUp(G3D::RenderDevice* renderDevice, int x, int y)
|
||||||
|
{
|
||||||
|
//std::cout << "Release: " << x << "," << y << std::endl;
|
||||||
|
_dataModel->getGuiRoot()->onMouseLeftUp(renderDevice, x, y);
|
||||||
|
_dragging = false;
|
||||||
|
//_message = "Dragging = false.";
|
||||||
|
//_messageTime = System::time();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Application::onMouseRightPressed(int x,int y)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void Application::onMouseRightUp(int x,int y)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void Application::onMouseMoved(int x,int y)
|
||||||
|
{
|
||||||
|
oldMouse = _dataModel->getMousePos();
|
||||||
|
_dataModel->mousex = x;
|
||||||
|
_dataModel->mousey = y;
|
||||||
|
|
||||||
|
}
|
||||||
|
void Application::onMouseWheel(int x,int y,short delta)
|
||||||
|
{
|
||||||
|
if (mouseOnScreen==true)
|
||||||
|
if (cameraController.onMouseWheel(x, y, delta))
|
||||||
|
{
|
||||||
|
AudioPlayer::playSound(cameraSound);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Application::run() {
|
||||||
|
g_usableApp = this;
|
||||||
|
//setDebugMode(false);
|
||||||
|
//debugController.setActive(false);
|
||||||
|
/*
|
||||||
|
if (!createWindowClass("ToolWindowClass",ToolProc,GetModuleHandle(0)))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
HWND propertyHWnd = CreateWindowEx(
|
||||||
|
WS_EX_TOOLWINDOW,"ToolWindowClass", "ToolWindow",
|
||||||
|
WS_SYSMENU | WS_VISIBLE | WS_CHILD,
|
||||||
|
0, 0, 800, 64,
|
||||||
|
hWndMain, NULL, GetModuleHandle(0), NULL);
|
||||||
|
|
||||||
|
ShowWindow(propertyHWnd,SW_SHOW);
|
||||||
|
*/
|
||||||
|
UpdateWindow(_hWndMain);
|
||||||
|
|
||||||
|
// Load objects here=
|
||||||
|
cursor = Texture::fromFile(GetFileInPath("/content/images/ArrowCursor.png"));
|
||||||
|
cursorOvr = Texture::fromFile(GetFileInPath("/content/images/DragCursor.png"));
|
||||||
|
Globals::surface = Texture::fromFile(GetFileInPath("/content/images/surfacebr.png"));
|
||||||
|
Globals::surfaceId = Globals::surface->getOpenGLID();
|
||||||
|
cameraSound = GetFileInPath("/content/sounds/SWITCH3.wav");
|
||||||
|
clickSound = GetFileInPath("/content/sounds/switch.wav");
|
||||||
|
dingSound = GetFileInPath("/content/sounds/electronicpingshort.wav");
|
||||||
|
sky = Sky::create(NULL, ExePath() + "/content/sky/");
|
||||||
|
cursorid = cursor->openGLID();
|
||||||
|
currentcursorid = cursorid;
|
||||||
|
cursorOvrid = cursorOvr->openGLID();
|
||||||
|
RealTime now=0, lastTime=0;
|
||||||
|
double simTimeRate = 1.0f;
|
||||||
|
float fps=3000.0f;
|
||||||
|
|
||||||
|
RealTime desiredFrameDuration=1.0/fps;
|
||||||
|
onInit();
|
||||||
|
RealTime lastWaitTime=0;
|
||||||
|
|
||||||
|
MSG messages;
|
||||||
|
//RECT cRect;
|
||||||
|
//GetClientRect(_hWndMain,&cRect);
|
||||||
|
//renderDevice->notifyResize(cRect.right,cRect.bottom);
|
||||||
|
//Rect2D viewportRect = Rect2D::xywh(0,0,cRect.right,cRect.bottom);
|
||||||
|
//renderDevice->setViewport(viewportRect);
|
||||||
|
//window()->setInputCaptureCount(1);
|
||||||
|
resizeWithParent(_hWndMain);
|
||||||
|
|
||||||
|
while (!quit)
|
||||||
|
{
|
||||||
|
|
||||||
|
lastTime = now;
|
||||||
|
now = System::getTick();
|
||||||
|
RealTime timeStep = now - lastTime;
|
||||||
|
|
||||||
|
m_userInputWatch.tick();
|
||||||
|
onUserInput(userInput);
|
||||||
|
//m_moduleManager->onUserInput(_userInput);
|
||||||
|
m_userInputWatch.tock();
|
||||||
|
|
||||||
|
m_simulationWatch.tick();
|
||||||
|
//debugController.doSimulation(clamp(timeStep, 0.0, 0.1));
|
||||||
|
//g3dCamera.setCoordinateFrame
|
||||||
|
//(debugController.getCoordinateFrame());
|
||||||
|
|
||||||
|
double rate = simTimeRate;
|
||||||
|
RealTime rdt = timeStep;
|
||||||
|
SimTime sdt = timeStep * rate;
|
||||||
|
SimTime idt = desiredFrameDuration * rate;
|
||||||
|
|
||||||
|
onSimulation(rdt,sdt,idt);
|
||||||
|
m_simulationWatch.tock();
|
||||||
|
|
||||||
|
m_waitWatch.tick();
|
||||||
|
{
|
||||||
|
RealTime now = System::time();
|
||||||
|
// Compute accumulated time
|
||||||
|
System::sleep(max(0.0, desiredFrameDuration - (now - lastWaitTime)));
|
||||||
|
lastWaitTime = System::time();
|
||||||
|
}
|
||||||
|
m_waitWatch.tock();
|
||||||
|
|
||||||
|
m_graphicsWatch.tick();
|
||||||
|
renderDevice->beginFrame();
|
||||||
|
renderDevice->pushState();
|
||||||
|
onGraphics(renderDevice);
|
||||||
|
renderDevice->popState();
|
||||||
|
//renderDebugInfo();
|
||||||
|
renderDevice->endFrame();
|
||||||
|
//debugText.clear();
|
||||||
|
m_graphicsWatch.tock();
|
||||||
|
|
||||||
|
while (PeekMessage (&messages, NULL, 0, 0,PM_REMOVE))
|
||||||
|
{
|
||||||
|
if (IsDialogMessage(_hWndMain, &messages) == 0)
|
||||||
|
{
|
||||||
|
TranslateMessage(&messages);
|
||||||
|
DispatchMessage(&messages);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onCleanup();
|
||||||
|
}
|
||||||
|
void Application::resizeWithParent(HWND parentWindow)
|
||||||
|
{
|
||||||
|
RECT rect;
|
||||||
|
GetClientRect(parentWindow,&rect);
|
||||||
|
SetWindowPos(_hwndRenderer,NULL,0,0,rect.right,rect.bottom-60,SWP_NOMOVE);
|
||||||
|
SetWindowPos(_hwndToolbox,NULL,0,rect.bottom-60,rect.right,60,SWP_NOACTIVATE | SWP_SHOWWINDOW);
|
||||||
|
GetClientRect(_hwndRenderer,&rect);
|
||||||
|
int viewWidth=rect.right;
|
||||||
|
int viewHeight=rect.bottom;
|
||||||
|
renderDevice->notifyResize(viewWidth,viewHeight);
|
||||||
|
Rect2D viewportRect = Rect2D::xywh(0,0,viewWidth,viewHeight);
|
||||||
|
renderDevice->setViewport(viewportRect);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Application::QuitApp()
|
||||||
|
{
|
||||||
|
PostQuitMessage(0);
|
||||||
|
quit=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Application::onCreate(HWND parentWindow)
|
||||||
|
{
|
||||||
|
//SetWindowLongPtr(hwndRenderer,GWL_USERDATA,(LONG)this);
|
||||||
|
//SetWindowLongPtr(hwndToolbox,GWL_USERDATA,(LONG)this);
|
||||||
|
//SetWindowLongPtr(hwndMain,GWL_USERDATA,(LONG)&app);
|
||||||
|
}
|
||||||
82
Application.h
Normal file
82
Application.h
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <G3DAll.h>
|
||||||
|
#include "PropertyWindow.h"
|
||||||
|
#include "TextButtonInstance.h"
|
||||||
|
#include "ImageButtonInstance.h"
|
||||||
|
#include "CameraController.h"
|
||||||
|
//#include "GuiRoot.h"
|
||||||
|
|
||||||
|
class TextButtonInstance;
|
||||||
|
class ImageButtonInstance;
|
||||||
|
class PartInstance;
|
||||||
|
class CameraController;
|
||||||
|
|
||||||
|
class Application { // : public GApp {
|
||||||
|
public:
|
||||||
|
Application(HWND parentWindow);
|
||||||
|
void Boop();
|
||||||
|
virtual ~Application() {}
|
||||||
|
virtual void exitApplication();
|
||||||
|
virtual void onInit();
|
||||||
|
virtual void onLogic();
|
||||||
|
virtual void onNetwork();
|
||||||
|
virtual void onSimulation(RealTime rdt, SimTime sdt, SimTime idt);
|
||||||
|
virtual void onGraphics(RenderDevice* rd);
|
||||||
|
virtual void onUserInput(UserInput* ui);
|
||||||
|
virtual void onCleanup();
|
||||||
|
void clearInstances();
|
||||||
|
PartInstance* makePart();
|
||||||
|
void drawButtons(RenderDevice* rd);
|
||||||
|
void drawOutline(Vector3 from, Vector3 to, RenderDevice* rd, LightingParameters lighting, Vector3 size, Vector3 pos, CoordinateFrame c);
|
||||||
|
void makeFlag(Vector3 &vec, RenderDevice* &rd);
|
||||||
|
std::vector<Instance*> getSelection();
|
||||||
|
void deleteInstance();
|
||||||
|
void run();
|
||||||
|
void QuitApp();
|
||||||
|
void resizeWithParent(HWND parentWindow);
|
||||||
|
void onCreate(HWND parentWindow);
|
||||||
|
void onKeyPressed(int key);
|
||||||
|
void onKeyUp(int key);
|
||||||
|
void onMouseLeftPressed(HWND hwnd,int x, int y);
|
||||||
|
void onMouseLeftUp(RenderDevice* renderDevice, int x, int y);
|
||||||
|
void onMouseRightPressed(int x, int y);
|
||||||
|
void onMouseRightUp(int x, int y);
|
||||||
|
void onMouseMoved(int x, int y);
|
||||||
|
void onMouseWheel(int x, int y, short delta);
|
||||||
|
void setFocus(bool isFocused);
|
||||||
|
int getMode();
|
||||||
|
CameraController cameraController;
|
||||||
|
UserInput* userInput;
|
||||||
|
PropertyWindow* _propWindow;
|
||||||
|
void generateShadowMap(const CoordinateFrame& lightViewMatrix) const;
|
||||||
|
RenderDevice* getRenderDevice();
|
||||||
|
void selectInstance(Instance* selectedInstance,PropertyWindow* propWindow);
|
||||||
|
void setMode(int mode);
|
||||||
|
private:
|
||||||
|
RenderDevice* renderDevice;
|
||||||
|
//void initGUI();
|
||||||
|
HWND _hWndMain;
|
||||||
|
SkyRef sky;
|
||||||
|
bool quit;
|
||||||
|
bool mouseOnScreen;
|
||||||
|
bool rightButtonHolding;
|
||||||
|
void main();
|
||||||
|
GWindow* _window;
|
||||||
|
HWND _hwndToolbox;
|
||||||
|
HWND _buttonTest;
|
||||||
|
HWND _hwndRenderer;
|
||||||
|
DataModelInstance* _dataModel;
|
||||||
|
G3D::TextureRef shadowMap;
|
||||||
|
std::string _title;
|
||||||
|
bool _dragging;
|
||||||
|
int _mode;
|
||||||
|
GAppSettings _settings;
|
||||||
|
double lightProjX, lightProjY, lightProjNear, lightProjFar;
|
||||||
|
protected:
|
||||||
|
Stopwatch m_graphicsWatch;
|
||||||
|
Stopwatch m_logicWatch;
|
||||||
|
Stopwatch m_networkWatch;
|
||||||
|
Stopwatch m_userInputWatch;
|
||||||
|
Stopwatch m_simulationWatch;
|
||||||
|
Stopwatch m_waitWatch;
|
||||||
|
};
|
||||||
112
AudioPlayer.cpp
Normal file
112
AudioPlayer.cpp
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
#include "AudioPlayer.h"
|
||||||
|
#include "SDL.h"
|
||||||
|
#include "SDL_audio.h"
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <malloc.h>
|
||||||
|
#include <string.h>
|
||||||
|
#define NUM_SOUNDS 10
|
||||||
|
static SDL_AudioSpec fmt;
|
||||||
|
static bool initiated = false;
|
||||||
|
|
||||||
|
AudioPlayer::AudioPlayer(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
AudioPlayer::~AudioPlayer(void)
|
||||||
|
{
|
||||||
|
SDL_CloseAudio();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AudioPlayer::init()
|
||||||
|
{
|
||||||
|
initiated = true;
|
||||||
|
extern void mixaudio(void *unused, Uint8 *stream, int len);
|
||||||
|
fmt.freq = 22050;
|
||||||
|
fmt.format = AUDIO_S16;
|
||||||
|
fmt.channels = 2;
|
||||||
|
fmt.samples = 1024; /* A good value for games */
|
||||||
|
fmt.callback = mixaudio;
|
||||||
|
fmt.userdata = NULL;
|
||||||
|
|
||||||
|
/* Open the audio device and start playing sound! */
|
||||||
|
if ( SDL_OpenAudio(&fmt, NULL) < 0 ) {
|
||||||
|
fprintf(stderr, "Unable to open audio: %s\n", SDL_GetError());
|
||||||
|
}
|
||||||
|
SDL_PauseAudio(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct sample {
|
||||||
|
Uint8 *data;
|
||||||
|
Uint32 dpos;
|
||||||
|
Uint32 dlen;
|
||||||
|
} sounds[NUM_SOUNDS];
|
||||||
|
|
||||||
|
void mixaudio(void *unused, Uint8 *stream, int len)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
Uint32 amount;
|
||||||
|
|
||||||
|
for ( i=0; i<NUM_SOUNDS; ++i ) {
|
||||||
|
amount = (sounds[i].dlen-sounds[i].dpos);
|
||||||
|
if ( amount > (Uint32)len ) {
|
||||||
|
amount = len;
|
||||||
|
}
|
||||||
|
SDL_MixAudio(stream, &sounds[i].data[sounds[i].dpos], amount, SDL_MIX_MAXVOLUME);
|
||||||
|
sounds[i].dpos += amount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AudioPlayer::playSound(std::string fileString)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(initiated)
|
||||||
|
{
|
||||||
|
char *file = new char[fileString.length() + 1];
|
||||||
|
strcpy(file, fileString.c_str());
|
||||||
|
|
||||||
|
|
||||||
|
int index;
|
||||||
|
SDL_AudioSpec wave;
|
||||||
|
Uint8 *data;
|
||||||
|
Uint32 dlen;
|
||||||
|
SDL_AudioCVT cvt;
|
||||||
|
|
||||||
|
/* Look for an empty (or finished) sound slot */
|
||||||
|
for ( index=0; index<NUM_SOUNDS; ++index ) {
|
||||||
|
if ( sounds[index].dpos == sounds[index].dlen ) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( index == NUM_SOUNDS )
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* Load the sound file and convert it to 16-bit stereo at 22kHz */
|
||||||
|
if ( SDL_LoadWAV(file, &wave, &data, &dlen) == NULL ) {
|
||||||
|
fprintf(stderr, "Couldn't load %s: %s\n", file, SDL_GetError());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
SDL_BuildAudioCVT(&cvt, wave.format, wave.channels, wave.freq,
|
||||||
|
AUDIO_S16, 2, fmt.freq);
|
||||||
|
cvt.buf = (Uint8*)malloc(dlen*cvt.len_mult);
|
||||||
|
memcpy(cvt.buf, data, dlen);
|
||||||
|
cvt.len = dlen;
|
||||||
|
SDL_ConvertAudio(&cvt);
|
||||||
|
SDL_FreeWAV(data);
|
||||||
|
|
||||||
|
/* Put the sound data in the slot (it starts playing immediately) */
|
||||||
|
if ( sounds[index].data ) {
|
||||||
|
free(sounds[index].data);
|
||||||
|
}
|
||||||
|
SDL_LockAudio();
|
||||||
|
sounds[index].data = cvt.buf;
|
||||||
|
sounds[index].dlen = cvt.len_cvt;
|
||||||
|
sounds[index].dpos = 0;
|
||||||
|
SDL_UnlockAudio();
|
||||||
|
delete [] file;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
OutputDebugString("Audio player not initialized, sound will not play\r\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
11
AudioPlayer.h
Normal file
11
AudioPlayer.h
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#include <G3DAll.h>
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
class AudioPlayer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AudioPlayer(void);
|
||||||
|
~AudioPlayer(void);
|
||||||
|
static void playSound(std::string);
|
||||||
|
static void init();
|
||||||
|
};
|
||||||
57
BaseButtonInstance.cpp
Normal file
57
BaseButtonInstance.cpp
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
#include "BaseButtonInstance.h"
|
||||||
|
#include "Globals.h"
|
||||||
|
|
||||||
|
|
||||||
|
ButtonListener* listener = NULL;
|
||||||
|
|
||||||
|
BaseButtonInstance::BaseButtonInstance(void)
|
||||||
|
{
|
||||||
|
Instance::Instance();
|
||||||
|
listener = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseButtonInstance::render(RenderDevice* rd)
|
||||||
|
{
|
||||||
|
DataModelInstance* dataModel = g_dataModel;
|
||||||
|
Vector2 pos = Vector2(dataModel->mousex,dataModel->mousey);
|
||||||
|
drawObj(rd, pos, dataModel->mouseButton1Down);
|
||||||
|
Instance::render(rd);
|
||||||
|
}
|
||||||
|
|
||||||
|
BaseButtonInstance::~BaseButtonInstance(void)
|
||||||
|
{
|
||||||
|
delete listener;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseButtonInstance::setButtonListener(ButtonListener* buttonListener)
|
||||||
|
{
|
||||||
|
listener = buttonListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseButtonInstance::drawObj(RenderDevice* rd, Vector2 mousePos, bool mouseDown){}
|
||||||
|
|
||||||
|
bool BaseButtonInstance::mouseInButton(float mousex, float mousey, RenderDevice* rd){return false;}
|
||||||
|
|
||||||
|
void BaseButtonInstance::onMouseClick()
|
||||||
|
{
|
||||||
|
if(listener != NULL)
|
||||||
|
{
|
||||||
|
listener->onButton1MouseClick(this);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool BaseButtonInstance::mouseInArea(float point1x, float point1y, float point2x, float point2y, float mousex, float mousey)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
if(mousex >= point1x && mousey >= point1y)
|
||||||
|
{
|
||||||
|
if(mousex < point2x && mousey < point2y)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
26
BaseButtonInstance.h
Normal file
26
BaseButtonInstance.h
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "instance.h"
|
||||||
|
#include "ButtonListener.h"
|
||||||
|
|
||||||
|
class ButtonListener;
|
||||||
|
class Instance;
|
||||||
|
|
||||||
|
class BaseButtonInstance : public Instance
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BaseButtonInstance(void);
|
||||||
|
virtual ~BaseButtonInstance(void);
|
||||||
|
virtual void render(RenderDevice* rd);
|
||||||
|
virtual void drawObj(RenderDevice* rd, Vector2 mousePos, bool mouseDown);
|
||||||
|
virtual bool mouseInButton(float, float, RenderDevice* rd);
|
||||||
|
virtual void onMouseClick();
|
||||||
|
void setButtonListener(ButtonListener*);
|
||||||
|
bool floatBottom;
|
||||||
|
bool floatRight;
|
||||||
|
bool floatCenter;
|
||||||
|
volatile bool disabled;
|
||||||
|
bool selected;
|
||||||
|
protected:
|
||||||
|
bool mouseInArea(float, float, float, float, float, float);
|
||||||
|
class ButtonListener* listener;
|
||||||
|
};
|
||||||
9
BrowserCallHandler.cpp
Normal file
9
BrowserCallHandler.cpp
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#include "BrowserCallHandler.h"
|
||||||
|
|
||||||
|
BrowserCallHandler::BrowserCallHandler(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
BrowserCallHandler::~BrowserCallHandler(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
8
BrowserCallHandler.h
Normal file
8
BrowserCallHandler.h
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <Mshtmhst.h>
|
||||||
|
class BrowserCallHandler : IDocHostUIHandler
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BrowserCallHandler(void);
|
||||||
|
~BrowserCallHandler(void);
|
||||||
|
};
|
||||||
16
ButtonListener.cpp
Normal file
16
ButtonListener.cpp
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#include "BaseButtonInstance.h"
|
||||||
|
#include "ButtonListener.h"
|
||||||
|
|
||||||
|
|
||||||
|
ButtonListener::ButtonListener()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
ButtonListener::~ButtonListener(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void ButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
21
ButtonListener.h
Normal file
21
ButtonListener.h
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
#pragma once
|
||||||
|
//#include "Application.h"
|
||||||
|
//#include "BaseButtonInstance.h"
|
||||||
|
|
||||||
|
class BaseButtonInstance;
|
||||||
|
|
||||||
|
class ButtonListener
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ButtonListener();
|
||||||
|
~ButtonListener(void);
|
||||||
|
virtual void onButton1MouseClick(BaseButtonInstance*);
|
||||||
|
//virtual void onMouseOver(); //TODO
|
||||||
|
//virtual void onMouseOut(); //TODO
|
||||||
|
//virtual void onButton1MouseDown(); //TODO
|
||||||
|
//virtual void onButton1MouseUp(); //TODO
|
||||||
|
//virtual void onButton2MouseClick(); //TODO
|
||||||
|
//virtual void onButton2MouseDown(); //TODO
|
||||||
|
//virtual void onButton2MouseUp(); //TODO
|
||||||
|
//What to do now...
|
||||||
|
};
|
||||||
24
CameraButtonListener.cpp
Normal file
24
CameraButtonListener.cpp
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#include "CameraButtonListener.h"
|
||||||
|
#include "Globals.h"
|
||||||
|
#include "AudioPlayer.h"
|
||||||
|
#include "Application.h"
|
||||||
|
|
||||||
|
void CameraButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
||||||
|
{
|
||||||
|
AudioPlayer::playSound(cameraSound);
|
||||||
|
CoordinateFrame frame = g_usableApp->cameraController.getCamera()->getCoordinateFrame();
|
||||||
|
if(button->name == "CenterCam" && g_selectedInstances.size() > 0)
|
||||||
|
g_usableApp->cameraController.centerCamera(g_selectedInstances.at(0));
|
||||||
|
else if(button->name == "ZoomIn")
|
||||||
|
g_usableApp->cameraController.Zoom(1);
|
||||||
|
else if(button->name == "ZoomOut")
|
||||||
|
g_usableApp->cameraController.Zoom(-1);
|
||||||
|
else if(button->name == "PanRight")
|
||||||
|
g_usableApp->cameraController.panRight();
|
||||||
|
else if(button->name == "PanLeft")
|
||||||
|
g_usableApp->cameraController.panLeft();
|
||||||
|
else if(button->name == "TiltUp")
|
||||||
|
g_usableApp->cameraController.tiltUp();
|
||||||
|
else if(button->name == "TiltDown")
|
||||||
|
g_usableApp->cameraController.tiltDown();
|
||||||
|
}
|
||||||
7
CameraButtonListener.h
Normal file
7
CameraButtonListener.h
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "ButtonListener.h"
|
||||||
|
|
||||||
|
class CameraButtonListener : public ButtonListener {
|
||||||
|
public:
|
||||||
|
void onButton1MouseClick(BaseButtonInstance*);
|
||||||
|
};
|
||||||
235
CameraController.cpp
Normal file
235
CameraController.cpp
Normal file
@@ -0,0 +1,235 @@
|
|||||||
|
#include "CameraController.h"
|
||||||
|
#include "win32Defines.h"
|
||||||
|
#include <iostream>
|
||||||
|
#include "PartInstance.h"
|
||||||
|
#include "Application.h"
|
||||||
|
#include "AudioPlayer.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CameraController::CameraController() :
|
||||||
|
yaw(0),
|
||||||
|
pitch(0),
|
||||||
|
moveRate(1.0f),
|
||||||
|
forwards(false),
|
||||||
|
backwards(false),
|
||||||
|
left(false),
|
||||||
|
right(false),
|
||||||
|
zoom(14.f),
|
||||||
|
rightButtonHolding(false),
|
||||||
|
focusPosition(Vector3(0,0,0)) {}
|
||||||
|
|
||||||
|
GCamera* CameraController::getCamera()
|
||||||
|
{
|
||||||
|
return &g3dCamera;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CameraController::lookAt(const Vector3& position) {
|
||||||
|
const Vector3 look = (position - g3dCamera.getCoordinateFrame().translation);
|
||||||
|
yaw = aTan2(look.x, -look.z);
|
||||||
|
|
||||||
|
pitch = -aTan2(look.y, distance(look.x, look.z));
|
||||||
|
CoordinateFrame frame = g3dCamera.getCoordinateFrame().translation;
|
||||||
|
frame.rotation = Matrix3::fromEulerAnglesZYX(0, -yaw, -pitch);
|
||||||
|
g3dCamera.setCoordinateFrame(frame);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CameraController::setFrame(const CoordinateFrame& cf) {
|
||||||
|
Vector3 look = cf.getLookVector();
|
||||||
|
g3dCamera.setCoordinateFrame(cf);
|
||||||
|
lookAt(cf.translation + look);
|
||||||
|
focusPosition=cf.translation+cf.lookVector()*zoom;
|
||||||
|
}
|
||||||
|
|
||||||
|
CoordinateFrame CameraController::getCoordinateFrame() {
|
||||||
|
CoordinateFrame cf;
|
||||||
|
cf.translation=translation;
|
||||||
|
cf.rotation = Matrix3::fromEulerAnglesZYX(0, -yaw, -pitch);
|
||||||
|
return cf;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CameraController::refreshZoom(const CoordinateFrame& frame)
|
||||||
|
{
|
||||||
|
CoordinateFrame zoomFrame = focusPosition-frame.lookVector()*zoom;
|
||||||
|
zoomFrame.lookAt(focusPosition);
|
||||||
|
setFrame(zoomFrame);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CameraController::pan(CoordinateFrame* frame,float spdX, float spdY)
|
||||||
|
{
|
||||||
|
yaw+=spdX;
|
||||||
|
pitch+=spdY;
|
||||||
|
|
||||||
|
if (pitch>1.4f) pitch=1.4f;
|
||||||
|
if (pitch<-1.4f) pitch=-1.4f;
|
||||||
|
frame->translation = Vector3(sin(-yaw)*zoom*cos(pitch),sin(pitch)*zoom,cos(-yaw)*zoom*cos(pitch))+focusPosition;
|
||||||
|
frame->lookAt(focusPosition);
|
||||||
|
}
|
||||||
|
bool CameraController::onMouseWheel(int x, int y, short delta)
|
||||||
|
{
|
||||||
|
Zoom(delta);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
void CameraController::Zoom(short delta)
|
||||||
|
{
|
||||||
|
CoordinateFrame frame = g3dCamera.getCoordinateFrame();
|
||||||
|
|
||||||
|
if (delta>0) { // Mouse wheel up
|
||||||
|
CoordinateFrame zoomFrame = frame+frame.lookVector()*(zoom/5);
|
||||||
|
zoom=(zoomFrame.translation-focusPosition).magnitude();
|
||||||
|
if (zoom>CAM_ZOOM_MIN)
|
||||||
|
{
|
||||||
|
setFrame(zoomFrame);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
zoom=CAM_ZOOM_MIN;
|
||||||
|
refreshZoom(frame);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
CoordinateFrame zoomFrame = frame-frame.lookVector()*(zoom/5);
|
||||||
|
zoom=(zoomFrame.translation-focusPosition).magnitude();
|
||||||
|
if (zoom<CAM_ZOOM_MAX)
|
||||||
|
{
|
||||||
|
setFrame(zoomFrame);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
zoom=CAM_ZOOM_MAX;
|
||||||
|
refreshZoom(frame);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CameraController::panLeft()
|
||||||
|
{
|
||||||
|
CoordinateFrame frame = g3dCamera.getCoordinateFrame();
|
||||||
|
pan(&frame,toRadians(-45),0);
|
||||||
|
setFrame(frame);
|
||||||
|
|
||||||
|
}
|
||||||
|
void CameraController::panRight()
|
||||||
|
{
|
||||||
|
CoordinateFrame frame = g3dCamera.getCoordinateFrame();
|
||||||
|
pan(&frame,toRadians(45),0);
|
||||||
|
setFrame(frame);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CameraController::tiltUp()
|
||||||
|
{
|
||||||
|
|
||||||
|
CoordinateFrame frame = CoordinateFrame(g3dCamera.getCoordinateFrame().rotation, g3dCamera.getCoordinateFrame().translation);
|
||||||
|
pan(&frame,0,toRadians(25));
|
||||||
|
setFrame(frame);
|
||||||
|
}
|
||||||
|
void CameraController::tiltDown()
|
||||||
|
{
|
||||||
|
CoordinateFrame frame = CoordinateFrame(g3dCamera.getCoordinateFrame().rotation, g3dCamera.getCoordinateFrame().translation);
|
||||||
|
pan(&frame,0,toRadians(-25));
|
||||||
|
setFrame(frame);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CameraController::centerCamera(Instance* selection)
|
||||||
|
{
|
||||||
|
CoordinateFrame frame = CoordinateFrame(g3dCamera.getCoordinateFrame().translation);
|
||||||
|
if(selection == NULL)
|
||||||
|
{
|
||||||
|
lookAt(Vector3(0,0,0));
|
||||||
|
focusPosition=Vector3(0,0,0);
|
||||||
|
}
|
||||||
|
else if(PartInstance* part = dynamic_cast<PartInstance*>(selection))
|
||||||
|
{
|
||||||
|
Vector3 partPos = (part)->getPosition();
|
||||||
|
lookAt(partPos);
|
||||||
|
focusPosition=partPos;
|
||||||
|
zoom=((partPos-frame.translation).magnitude());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lookAt(Vector3(0,0,0));
|
||||||
|
focusPosition=Vector3(0,0,0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CameraController::update(Application* app)
|
||||||
|
{
|
||||||
|
float offsetSize = 0.05F;
|
||||||
|
|
||||||
|
Vector3 cameraPos = g3dCamera.getCoordinateFrame().translation;
|
||||||
|
CoordinateFrame frame = g3dCamera.getCoordinateFrame();
|
||||||
|
bool moving=false;
|
||||||
|
if(GetHoldKeyState('U')) {
|
||||||
|
forwards = true;
|
||||||
|
moving=true;
|
||||||
|
}
|
||||||
|
if(GetHoldKeyState('J')) {
|
||||||
|
backwards = true;
|
||||||
|
moving=true;
|
||||||
|
}
|
||||||
|
if(GetHoldKeyState('H')) {
|
||||||
|
left = true;
|
||||||
|
moving=true;
|
||||||
|
}
|
||||||
|
if(GetHoldKeyState('K')) {
|
||||||
|
right = true;
|
||||||
|
moving=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(forwards) {
|
||||||
|
forwards = false;
|
||||||
|
frame.translation += frame.lookVector()*moveRate;
|
||||||
|
}
|
||||||
|
else if(backwards) {
|
||||||
|
backwards = false;
|
||||||
|
frame.translation -= frame.lookVector()*moveRate;
|
||||||
|
}
|
||||||
|
if(left) {
|
||||||
|
left = false;
|
||||||
|
frame.translation += frame.leftVector()*moveRate;
|
||||||
|
}
|
||||||
|
else if(right) {
|
||||||
|
right = false;
|
||||||
|
frame.translation += frame.rightVector()*moveRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (moving)
|
||||||
|
{
|
||||||
|
zoom=7;
|
||||||
|
focusPosition=frame.translation+frame.lookVector()*zoom;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(rightButtonHolding) {
|
||||||
|
Globals::useMousePoint = true;
|
||||||
|
Globals::mousepoint = oldDesktopMouse;
|
||||||
|
POINT mouse;
|
||||||
|
GetCursorPos(&mouse);
|
||||||
|
pan(&frame,(mouse.x-oldDesktopMouse.x)/100.f,(mouse.y-oldDesktopMouse.y)/100.f);
|
||||||
|
SetCursorPos(oldDesktopMouse.x,oldDesktopMouse.y);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Globals::useMousePoint = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(GetHoldKeyState(VK_RSHIFT) || GetHoldKeyState(VK_LSHIFT)) {
|
||||||
|
moveRate = 2;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
moveRate = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(GetHoldKeyState(VK_RBUTTON))
|
||||||
|
{
|
||||||
|
if (rightButtonHolding==false)
|
||||||
|
{
|
||||||
|
GetCursorPos(&oldDesktopMouse);
|
||||||
|
rightButtonHolding = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rightButtonHolding = false;
|
||||||
|
}
|
||||||
|
g3dCamera.setCoordinateFrame(frame);
|
||||||
|
}
|
||||||
46
CameraController.h
Normal file
46
CameraController.h
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <G3DAll.h>
|
||||||
|
#include "Instance.h"
|
||||||
|
#include "Globals.h"
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#define CAM_ZOOM_MIN 0.1f
|
||||||
|
#define CAM_ZOOM_MAX 100.f
|
||||||
|
|
||||||
|
class Application;
|
||||||
|
|
||||||
|
class CameraController {
|
||||||
|
public:
|
||||||
|
CameraController();
|
||||||
|
G3D::CoordinateFrame getCoordinateFrame();
|
||||||
|
|
||||||
|
void setFrame(const CoordinateFrame& cf);
|
||||||
|
void lookAt(const Vector3& position);
|
||||||
|
void refreshZoom(const CoordinateFrame& frame);
|
||||||
|
void pan(CoordinateFrame* frame,float spdX,float spdY);
|
||||||
|
void update(Application* app);
|
||||||
|
void centerCamera(Instance* selection);
|
||||||
|
void panLeft();
|
||||||
|
void panRight();
|
||||||
|
void tiltUp();
|
||||||
|
void tiltDown();
|
||||||
|
void Zoom(short delta);
|
||||||
|
bool onMouseWheel(int x, int y, short delta);
|
||||||
|
GCamera* getCamera();
|
||||||
|
private:
|
||||||
|
Vector3 translation;
|
||||||
|
Vector3 focusPosition;
|
||||||
|
float yaw;
|
||||||
|
float pitch;
|
||||||
|
float moveRate;
|
||||||
|
float zoom;
|
||||||
|
bool forwards;
|
||||||
|
bool backwards;
|
||||||
|
bool left;
|
||||||
|
bool right;
|
||||||
|
bool rightButtonHolding;
|
||||||
|
POINT oldDesktopMouse;
|
||||||
|
GCamera g3dCamera;
|
||||||
|
std::string cameraSound;
|
||||||
|
};
|
||||||
576
DataModelInstance.cpp
Normal file
576
DataModelInstance.cpp
Normal file
@@ -0,0 +1,576 @@
|
|||||||
|
#include <string>
|
||||||
|
#include "GuiRoot.h"
|
||||||
|
#include "DataModelInstance.h"
|
||||||
|
#include <fstream>
|
||||||
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
#include <commdlg.h>
|
||||||
|
#include "ErrorFunctions.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
using namespace rapidxml;
|
||||||
|
|
||||||
|
|
||||||
|
DataModelInstance::DataModelInstance(void)
|
||||||
|
{
|
||||||
|
Instance::Instance();
|
||||||
|
workspace = new WorkspaceInstance();
|
||||||
|
guiRoot = new GuiRoot();
|
||||||
|
level = new LevelInstance();
|
||||||
|
//children.push_back(workspace);
|
||||||
|
//children.push_back(level);
|
||||||
|
className = "dataModel";
|
||||||
|
mousex = 0;
|
||||||
|
mousey = 0;
|
||||||
|
mouseButton1Down = false;
|
||||||
|
showMessage = false;
|
||||||
|
canDelete = false;
|
||||||
|
_modY=0;
|
||||||
|
workspace->setParent(this);
|
||||||
|
level->setParent(this);
|
||||||
|
_loadedFileName="..//skooter.rbxm";
|
||||||
|
listicon = 5;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
DataModelInstance::~DataModelInstance(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
void DataModelInstance::modXMLLevel(float modY)
|
||||||
|
{
|
||||||
|
_modY += modY;
|
||||||
|
clearLevel();
|
||||||
|
debugGetOpen();
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void DataModelInstance::clearLevel()
|
||||||
|
{
|
||||||
|
workspace->clearChildren();
|
||||||
|
}
|
||||||
|
PartInstance* DataModelInstance::makePart()
|
||||||
|
{
|
||||||
|
PartInstance* part = new PartInstance();
|
||||||
|
return part;
|
||||||
|
}
|
||||||
|
|
||||||
|
rapidxml::xml_node<>* DataModelInstance::getNode(xml_node<> * node,const char* name)
|
||||||
|
{
|
||||||
|
xml_node<> * tempNode = node->first_node(name);
|
||||||
|
if (!tempNode)
|
||||||
|
{
|
||||||
|
_errMsg = "Expected <";
|
||||||
|
_errMsg += name;
|
||||||
|
_errMsg+="> tag.";
|
||||||
|
_successfulLoad=false;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return tempNode;
|
||||||
|
}
|
||||||
|
float DataModelInstance::getFloatValue(xml_node<> * node,const char* name)
|
||||||
|
{
|
||||||
|
xml_node<> * tempNode = node->first_node(name);
|
||||||
|
if (!tempNode)
|
||||||
|
{
|
||||||
|
_errMsg = "Expected <";
|
||||||
|
_errMsg += name;
|
||||||
|
_errMsg+="> tag.";
|
||||||
|
_successfulLoad=false;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
float newFloat;
|
||||||
|
stringstream converter;
|
||||||
|
converter << tempNode->value();
|
||||||
|
converter >> newFloat;
|
||||||
|
return newFloat;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Color3 bcToRGB(short bc)
|
||||||
|
{
|
||||||
|
switch(bc)
|
||||||
|
{
|
||||||
|
case 1: return Color3(0.94901967048645F,0.95294123888016F,0.95294123888016F);
|
||||||
|
case 2: return Color3(0.63137257099152F,0.64705884456635F,0.63529413938522F);
|
||||||
|
case 3: return Color3(0.9764706492424F,0.91372555494308F,0.60000002384186F);
|
||||||
|
case 5: return Color3(0.84313732385635F,0.77254909276962F,0.60392159223557F);
|
||||||
|
case 6: return Color3(0.7607843875885F,0.85490202903748F,0.72156864404678F);
|
||||||
|
case 9: return Color3(0.90980398654938F,0.7294117808342F,0.78431379795074F);
|
||||||
|
case 11: return Color3(0.50196081399918F,0.73333334922791F,0.85882359743118F);
|
||||||
|
case 12: return Color3(0.79607850313187F,0.51764708757401F,0.258823543787F);
|
||||||
|
case 18: return Color3(0.80000007152557F,0.55686277151108F,0.41176474094391F);
|
||||||
|
case 21: return Color3(0.76862752437592F,0.15686275064945F,0.10980392992496F);
|
||||||
|
case 22: return Color3(0.76862752437592F,0.43921571969986F,0.62745100259781F);
|
||||||
|
case 23: return Color3(0.050980396568775F,0.41176474094391F,0.6745098233223F);
|
||||||
|
case 24: return Color3(0.96078437566757F,0.80392163991928F,0.18823531270027F);
|
||||||
|
case 25: return Color3(0.38431376218796F,0.27843138575554F,0.19607844948769F);
|
||||||
|
case 26: return Color3(0.10588236153126F,0.16470588743687F,0.20784315466881F);
|
||||||
|
case 27: return Color3(0.42745101451874F,0.43137258291245F,0.42352944612503F);
|
||||||
|
case 28: return Color3(0.15686275064945F,0.49803924560547F,0.27843138575554F);
|
||||||
|
case 29: return Color3(0.63137257099152F,0.76862752437592F,0.54901963472366F);
|
||||||
|
case 36: return Color3(0.95294123888016F,0.8117647767067F,0.60784316062927F);
|
||||||
|
case 37: return Color3(0.29411765933037F,0.59215688705444F,0.29411765933037F);
|
||||||
|
case 38: return Color3(0.62745100259781F,0.37254902720451F,0.20784315466881F);
|
||||||
|
case 39: return Color3(0.75686281919479F,0.79215693473816F,0.8705883026123F);
|
||||||
|
case 40: return Color3(0.92549026012421F,0.92549026012421F,0.92549026012421F);
|
||||||
|
case 41: return Color3(0.80392163991928F,0.32941177487373F,0.29411765933037F);
|
||||||
|
case 42: return Color3(0.75686281919479F,0.87450987100601F,0.94117653369904F);
|
||||||
|
case 43: return Color3(0.48235297203064F,0.71372550725937F,0.90980398654938F);
|
||||||
|
case 44: return Color3(0.96862751245499F,0.94509810209274F,0.55294120311737F);
|
||||||
|
case 45: return Color3(0.70588237047195F,0.82352948188782F,0.89411771297455F);
|
||||||
|
case 47: return Color3(0.85098046064377F,0.52156865596771F,0.42352944612503F);
|
||||||
|
case 48: return Color3(0.51764708757401F,0.71372550725937F,0.55294120311737F);
|
||||||
|
case 49: return Color3(0.97254908084869F,0.94509810209274F,0.51764708757401F);
|
||||||
|
case 50: return Color3(0.92549026012421F,0.90980398654938F,0.8705883026123F);
|
||||||
|
case 100: return Color3(0.93333339691162F,0.76862752437592F,0.71372550725937F);
|
||||||
|
case 101: return Color3(0.85490202903748F,0.52549022436142F,0.47843140363693F);
|
||||||
|
case 102: return Color3(0.43137258291245F,0.60000002384186F,0.79215693473816F);
|
||||||
|
case 103: return Color3(0.78039222955704F,0.75686281919479F,0.71764707565308F);
|
||||||
|
case 104: return Color3(0.41960787773132F,0.19607844948769F,0.48627454042435F);
|
||||||
|
case 105: return Color3(0.88627457618713F,0.60784316062927F,0.25098040699959F);
|
||||||
|
case 106: return Color3(0.85490202903748F,0.52156865596771F,0.2549019753933F);
|
||||||
|
case 107: return Color3(0,0.56078433990479F,0.61176472902298F);
|
||||||
|
case 108: return Color3(0.4078431725502F,0.36078432202339F,0.26274511218071F);
|
||||||
|
case 110: return Color3(0.26274511218071F,0.32941177487373F,0.57647061347961F);
|
||||||
|
case 111: return Color3(0.74901962280273F,0.71764707565308F,0.69411766529083F);
|
||||||
|
case 112: return Color3(0.4078431725502F,0.45490199327469F,0.6745098233223F);
|
||||||
|
case 113: return Color3(0.89411771297455F,0.678431391716F,0.78431379795074F);
|
||||||
|
case 115: return Color3(0.78039222955704F,0.82352948188782F,0.23529413342476F);
|
||||||
|
case 116: return Color3(0.33333334326744F,0.64705884456635F,0.68627452850342F);
|
||||||
|
case 118: return Color3(0.71764707565308F,0.84313732385635F,0.83529418706894F);
|
||||||
|
case 119: return Color3(0.64313727617264F,0.74117648601532F,0.27843138575554F);
|
||||||
|
case 120: return Color3(0.85098046064377F,0.89411771297455F,0.65490198135376F);
|
||||||
|
case 121: return Color3(0.90588241815567F,0.6745098233223F,0.34509804844856F);
|
||||||
|
case 123: return Color3(0.82745105028152F,0.43529415130615F,0.29803922772408F);
|
||||||
|
case 124: return Color3(0.57254904508591F,0.22352942824364F,0.47058826684952F);
|
||||||
|
case 125: return Color3(0.91764712333679F,0.72156864404678F,0.57254904508591F);
|
||||||
|
case 126: return Color3(0.64705884456635F,0.64705884456635F,0.79607850313187F);
|
||||||
|
case 127: return Color3(0.86274516582489F,0.73725491762161F,0.50588238239288F);
|
||||||
|
case 128: return Color3(0.68235296010971F,0.47843140363693F,0.34901961684227F);
|
||||||
|
case 131: return Color3(0.61176472902298F,0.63921570777893F,0.65882354974747F);
|
||||||
|
case 133: return Color3(0.83529418706894F,0.45098042488098F,0.23921570181847F);
|
||||||
|
case 134: return Color3(0.84705889225006F,0.8666667342186F,0.33725491166115F);
|
||||||
|
case 135: return Color3(0.45490199327469F,0.52549022436142F,0.61568629741669F);
|
||||||
|
case 136: return Color3(0.52941179275513F,0.48627454042435F,0.56470590829849F);
|
||||||
|
case 137: return Color3(0.87843143939972F,0.59607845544815F,0.39215689897537F);
|
||||||
|
case 138: return Color3(0.58431375026703F,0.54117649793625F,0.45098042488098F);
|
||||||
|
case 140: return Color3(0.12549020349979F,0.22745099663734F,0.33725491166115F);
|
||||||
|
case 141: return Color3(0.15294118225574F,0.27450981736183F,0.17647059261799F);
|
||||||
|
case 143: return Color3(0.8117647767067F,0.88627457618713F,0.96862751245499F);
|
||||||
|
case 145: return Color3(0.47450983524323F,0.53333336114883F,0.63137257099152F);
|
||||||
|
case 146: return Color3(0.58431375026703F,0.55686277151108F,0.63921570777893F);
|
||||||
|
case 147: return Color3(0.57647061347961F,0.52941179275513F,0.40392160415649F);
|
||||||
|
case 148: return Color3(0.34117648005486F,0.34509804844856F,0.34117648005486F);
|
||||||
|
case 149: return Color3(0.086274512112141F,0.11372549831867F,0.19607844948769F);
|
||||||
|
case 150: return Color3(0.67058825492859F,0.678431391716F,0.6745098233223F);
|
||||||
|
case 151: return Color3(0.47058826684952F,0.56470590829849F,0.50980395078659F);
|
||||||
|
case 153: return Color3(0.58431375026703F,0.47450983524323F,0.46666669845581F);
|
||||||
|
case 154: return Color3(0.48235297203064F,0.1803921610117F,0.1843137294054F);
|
||||||
|
case 157: return Color3(1,0.96470594406128F,0.48235297203064F);
|
||||||
|
case 158: return Color3(0.88235300779343F,0.64313727617264F,0.7607843875885F);
|
||||||
|
case 168: return Color3(0.4588235616684F,0.42352944612503F,0.38431376218796F);
|
||||||
|
case 176: return Color3(0.59215688705444F,0.41176474094391F,0.35686275362968F);
|
||||||
|
case 178: return Color3(0.70588237047195F,0.51764708757401F,0.33333334326744F);
|
||||||
|
case 179: return Color3(0.53725492954254F,0.52941179275513F,0.53333336114883F);
|
||||||
|
case 180: return Color3(0.84313732385635F,0.66274511814117F,0.29411765933037F);
|
||||||
|
case 190: return Color3(0.9764706492424F,0.83921575546265F,0.1803921610117F);
|
||||||
|
case 191: return Color3(0.90980398654938F,0.67058825492859F,0.17647059261799F);
|
||||||
|
case 192: return Color3(0.41176474094391F,0.25098040699959F,0.15686275064945F);
|
||||||
|
case 193: return Color3(0.8117647767067F,0.37647062540054F,0.14117647707462F);
|
||||||
|
case 195: return Color3(0.27450981736183F,0.40392160415649F,0.64313727617264F);
|
||||||
|
case 196: return Color3(0.13725490868092F,0.27843138575554F,0.54509806632996F);
|
||||||
|
case 198: return Color3(0.55686277151108F,0.258823543787F,0.52156865596771F);
|
||||||
|
case 199: return Color3(0.38823533058167F,0.37254902720451F,0.38431376218796F);
|
||||||
|
case 200: return Color3(0.50980395078659F,0.54117649793625F,0.3647058904171F);
|
||||||
|
case 208: return Color3(0.89803928136826F,0.89411771297455F,0.87450987100601F);
|
||||||
|
case 209: return Color3(0.69019609689713F,0.55686277151108F,0.26666668057442F);
|
||||||
|
case 210: return Color3(0.43921571969986F,0.58431375026703F,0.47058826684952F);
|
||||||
|
case 211: return Color3(0.47450983524323F,0.70980393886566F,0.70980393886566F);
|
||||||
|
case 212: return Color3(0.6235294342041F,0.76470595598221F,0.91372555494308F);
|
||||||
|
case 213: return Color3(0.42352944612503F,0.50588238239288F,0.71764707565308F);
|
||||||
|
case 216: return Color3(0.56078433990479F,0.29803922772408F,0.16470588743687F);
|
||||||
|
case 217: return Color3(0.48627454042435F,0.36078432202339F,0.27450981736183F);
|
||||||
|
case 218: return Color3(0.58823531866074F,0.43921571969986F,0.6235294342041F);
|
||||||
|
case 219: return Color3(0.41960787773132F,0.38431376218796F,0.60784316062927F);
|
||||||
|
case 220: return Color3(0.65490198135376F,0.66274511814117F,0.80784320831299F);
|
||||||
|
case 221: return Color3(0.80392163991928F,0.38431376218796F,0.59607845544815F);
|
||||||
|
case 222: return Color3(0.89411771297455F,0.678431391716F,0.78431379795074F);
|
||||||
|
case 223: return Color3(0.86274516582489F,0.56470590829849F,0.58431375026703F);
|
||||||
|
case 224: return Color3(0.94117653369904F,0.83529418706894F,0.62745100259781F);
|
||||||
|
case 225: return Color3(0.9215686917305F,0.72156864404678F,0.49803924560547F);
|
||||||
|
case 226: return Color3(0.99215692281723F,0.91764712333679F,0.55294120311737F);
|
||||||
|
case 232: return Color3(0.49019610881805F,0.73333334922791F,0.8666667342186F);
|
||||||
|
case 268: return Color3(0.2039215862751F,0.16862745583057F,0.4588235616684F);
|
||||||
|
case 1001: return Color3(0.97254908084869F,0.97254908084869F,0.97254908084869F);
|
||||||
|
case 1002: return Color3(0.80392163991928F,0.80392163991928F,0.80392163991928F);
|
||||||
|
case 1003: return Color3(0.066666670143604F,0.066666670143604F,0.066666670143604F);
|
||||||
|
case 1004: return Color3(1,0,0);
|
||||||
|
case 1005: return Color3(1,0.68627452850342F,0);
|
||||||
|
case 1006: return Color3(0.70588237047195F,0.50196081399918F,1);
|
||||||
|
case 1007: return Color3(0.63921570777893F,0.29411765933037F,0.29411765933037F);
|
||||||
|
case 1008: return Color3(0.75686281919479F,0.74509805440903F,0.258823543787F);
|
||||||
|
case 1009: return Color3(1,1,0);
|
||||||
|
case 1010: return Color3(0,0,1);
|
||||||
|
case 1011: return Color3(0,0.12549020349979F,0.37647062540054F);
|
||||||
|
case 1012: return Color3(0.1294117718935F,0.32941177487373F,0.72549021244049F);
|
||||||
|
case 1013: return Color3(0.015686275437474F,0.68627452850342F,0.92549026012421F);
|
||||||
|
case 1014: return Color3(0.66666668653488F,0.33333334326744F,0);
|
||||||
|
case 1015: return Color3(0.66666668653488F,0,0.66666668653488F);
|
||||||
|
case 1016: return Color3(1,0.40000003576279F,0.80000007152557F);
|
||||||
|
case 1017: return Color3(1,0.68627452850342F,0);
|
||||||
|
case 1018: return Color3(0.070588238537312F,0.93333339691162F,0.83137261867523F);
|
||||||
|
case 1019: return Color3(0,1,1);
|
||||||
|
case 1020: return Color3(0,1,0);
|
||||||
|
case 1021: return Color3(0.22745099663734F,0.49019610881805F,0.082352943718433F);
|
||||||
|
case 1022: return Color3(0.49803924560547F,0.55686277151108F,0.39215689897537F);
|
||||||
|
case 1023: return Color3(0.54901963472366F,0.35686275362968F,0.6235294342041F);
|
||||||
|
case 1024: return Color3(0.68627452850342F,0.8666667342186F,1);
|
||||||
|
case 1025: return Color3(1,0.78823536634445F,0.78823536634445F);
|
||||||
|
case 1026: return Color3(0.69411766529083F,0.65490198135376F,1);
|
||||||
|
case 1027: return Color3(0.6235294342041F,0.95294123888016F,0.91372555494308F);
|
||||||
|
case 1028: return Color3(0.80000007152557F,1,0.80000007152557F);
|
||||||
|
case 1029: return Color3(1,1,0.80000007152557F);
|
||||||
|
case 1030: return Color3(1,0.80000007152557F,0.60000002384186F);
|
||||||
|
case 1031: return Color3(0.38431376218796F,0.14509804546833F,0.81960791349411F);
|
||||||
|
case 1032: return Color3(1,0,0.74901962280273F);
|
||||||
|
default: return Color3::gray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool DataModelInstance::scanXMLObject(xml_node<> * scanNode)
|
||||||
|
{
|
||||||
|
xml_node<> * watchFirstNode = scanNode->first_node();
|
||||||
|
|
||||||
|
for (xml_node<> *node = scanNode->first_node();node; node = node->next_sibling())
|
||||||
|
{
|
||||||
|
|
||||||
|
if (strncmp(node->name(),"Item",4)==0)
|
||||||
|
{
|
||||||
|
xml_attribute<> *classAttr = node->first_attribute("class");
|
||||||
|
std::string className = classAttr->value();
|
||||||
|
if (className=="Part") {
|
||||||
|
xml_node<> *propNode = node->first_node();
|
||||||
|
xml_node<> *cFrameNode=0;
|
||||||
|
xml_node<> *sizeNode=0;
|
||||||
|
xml_node<> *colorNode=0;
|
||||||
|
xml_node<> *brickColorNode=0;
|
||||||
|
xml_node<> *nameNode=0;
|
||||||
|
|
||||||
|
for (xml_node<> *partPropNode = propNode->first_node();partPropNode; partPropNode = partPropNode->next_sibling())
|
||||||
|
{
|
||||||
|
for (xml_attribute<> *attr = partPropNode->first_attribute();attr; attr = attr->next_attribute())
|
||||||
|
{
|
||||||
|
std::string xmlName = attr->name();
|
||||||
|
std::string xmlValue = attr->value();
|
||||||
|
|
||||||
|
if (xmlValue=="CFrame" | xmlValue=="CoordinateFrame")
|
||||||
|
{
|
||||||
|
cFrameNode = partPropNode;
|
||||||
|
}
|
||||||
|
if (xmlValue=="Name")
|
||||||
|
{
|
||||||
|
nameNode = partPropNode;
|
||||||
|
}
|
||||||
|
if (xmlValue=="Color")
|
||||||
|
{
|
||||||
|
colorNode=partPropNode;
|
||||||
|
}
|
||||||
|
if (xmlValue=="BrickColor")
|
||||||
|
{
|
||||||
|
brickColorNode=partPropNode;
|
||||||
|
}
|
||||||
|
if (xmlValue=="size")
|
||||||
|
{
|
||||||
|
sizeNode = partPropNode;
|
||||||
|
_legacyLoad=false;
|
||||||
|
}
|
||||||
|
if (xmlValue=="Part")
|
||||||
|
{
|
||||||
|
for (xml_node<> *featureNode = partPropNode->first_node();featureNode; featureNode = featureNode->next_sibling())
|
||||||
|
{
|
||||||
|
for (xml_attribute<> *attr = featureNode->first_attribute();attr; attr = attr->next_attribute())
|
||||||
|
{
|
||||||
|
std::string xmlName = attr->name();
|
||||||
|
std::string xmlValue = attr->value();
|
||||||
|
if (xmlValue=="size")
|
||||||
|
{
|
||||||
|
sizeNode=featureNode;
|
||||||
|
_legacyLoad=true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!cFrameNode) {
|
||||||
|
_errMsg="CFrame is missing in Part";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!sizeNode) {
|
||||||
|
_errMsg="Size is missing in Part";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
float R=1;
|
||||||
|
float G=1;
|
||||||
|
float B=1;
|
||||||
|
|
||||||
|
if (colorNode)
|
||||||
|
{
|
||||||
|
R = getFloatValue(colorNode,"R");
|
||||||
|
G = getFloatValue(colorNode,"G");
|
||||||
|
B = getFloatValue(colorNode,"B");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::string newName = nameNode->value();
|
||||||
|
float X = getFloatValue(cFrameNode,"X");
|
||||||
|
float Y = getFloatValue(cFrameNode,"Y");
|
||||||
|
float Z = getFloatValue(cFrameNode,"Z");
|
||||||
|
float R00 = getFloatValue(cFrameNode,"R00");
|
||||||
|
float R01 = getFloatValue(cFrameNode,"R01");
|
||||||
|
float R02 = getFloatValue(cFrameNode,"R02");
|
||||||
|
float R10 = getFloatValue(cFrameNode,"R10");
|
||||||
|
float R11 = getFloatValue(cFrameNode,"R11");
|
||||||
|
float R12 = getFloatValue(cFrameNode,"R12");
|
||||||
|
float R20 = getFloatValue(cFrameNode,"R20");
|
||||||
|
float R21 = getFloatValue(cFrameNode,"R21");
|
||||||
|
float R22 = getFloatValue(cFrameNode,"R22");
|
||||||
|
|
||||||
|
float sizeX = getFloatValue(sizeNode,"X");
|
||||||
|
float sizeY = getFloatValue(sizeNode,"Y");
|
||||||
|
float sizeZ = getFloatValue(sizeNode,"Z");
|
||||||
|
//sizeX=1;
|
||||||
|
//sizeY=1;
|
||||||
|
//sizeZ=1;
|
||||||
|
if (_successfulLoad) {
|
||||||
|
PartInstance* test = makePart();
|
||||||
|
test->setParent(getWorkspace());
|
||||||
|
test->color = Color3(R,G,B);
|
||||||
|
if(brickColorNode)
|
||||||
|
{
|
||||||
|
test->color = bcToRGB(atoi(brickColorNode->value()));
|
||||||
|
}
|
||||||
|
test->setSize(Vector3(sizeX,sizeY+_modY,sizeZ));
|
||||||
|
test->setName(newName);
|
||||||
|
CoordinateFrame cf;
|
||||||
|
|
||||||
|
if (_legacyLoad)
|
||||||
|
{
|
||||||
|
|
||||||
|
cf = CoordinateFrame(Vector3(-X,Y,Z))*CoordinateFrame(Vector3(-sizeX/2,(sizeY+_modY)/2,sizeZ/2)*Matrix3(R00,R01,R02,R10,R11,R12,R20,R21,R22));
|
||||||
|
cf.rotation = Matrix3(R00,R01,R02,R10,R11,R12,R20,R21,R22);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cf.translation = Vector3(X,Y,Z);
|
||||||
|
cf.rotation = Matrix3(R00,R01,R02,R10,R11,R12,R20,R21,R22);
|
||||||
|
}
|
||||||
|
|
||||||
|
test->setCFrame(cf);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
for (xml_attribute<> *attr = node->first_attribute();attr; attr = attr->next_attribute())
|
||||||
|
{
|
||||||
|
std::string xmlName = attr->name();
|
||||||
|
std::string xmlValue = attr->value();
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
scanXMLObject(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DataModelInstance::load(const char* filename, bool clearObjects)
|
||||||
|
{
|
||||||
|
ifstream levelFile(filename,ios::binary);
|
||||||
|
if (levelFile)
|
||||||
|
{
|
||||||
|
if (clearObjects)
|
||||||
|
clearLevel();
|
||||||
|
readXMLFileStream(&levelFile);
|
||||||
|
std::string sfilename = std::string(filename);
|
||||||
|
std::size_t begin = sfilename.rfind('\\') + 1;
|
||||||
|
std::size_t end = sfilename.find(".rbx");
|
||||||
|
std::string hname = sfilename.substr(begin);
|
||||||
|
std::string tname = hname.substr(0, hname.length() - 5);
|
||||||
|
name = tname;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::stringstream msg;
|
||||||
|
msg << "Failed to load file:" << std::endl << filename << std::endl << strerror(errno);
|
||||||
|
MessageBoxStr(msg.str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DataModelInstance::readXMLFileStream(std::ifstream* file)
|
||||||
|
{
|
||||||
|
file->seekg(0,file->end);
|
||||||
|
int length = file->tellg();
|
||||||
|
if (length<0)
|
||||||
|
{
|
||||||
|
MessageBoxStr("File is empty");
|
||||||
|
file->close();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
file->seekg(0,file->beg);
|
||||||
|
char * buffer = new char[length+1];
|
||||||
|
buffer[length]=0;
|
||||||
|
|
||||||
|
file->read(buffer,length);
|
||||||
|
file->close();
|
||||||
|
|
||||||
|
if (!file)
|
||||||
|
{
|
||||||
|
stringstream msg;
|
||||||
|
msg << "Something went wrong." << endl << strerror(errno);
|
||||||
|
MessageBoxStr(msg.str());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
_successfulLoad = true;
|
||||||
|
xml_document<> doc;
|
||||||
|
doc.parse<0>(buffer);
|
||||||
|
xml_node<> *mainNode = doc.first_node();
|
||||||
|
_legacyLoad=false;
|
||||||
|
//std::string xmlName = mainNode->name();
|
||||||
|
//node = node->first_node();
|
||||||
|
//xmlName = node->name();
|
||||||
|
scanXMLObject(mainNode);
|
||||||
|
delete[] buffer;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DataModelInstance::debugGetOpen()
|
||||||
|
{
|
||||||
|
ifstream levelFile(_loadedFileName.c_str(),ios::binary);
|
||||||
|
if (levelFile)
|
||||||
|
readXMLFileStream(&levelFile);
|
||||||
|
else
|
||||||
|
getOpen();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DataModelInstance::getOpen()
|
||||||
|
{
|
||||||
|
_modY=0;
|
||||||
|
OPENFILENAME of;
|
||||||
|
ZeroMemory( &of , sizeof( of));
|
||||||
|
of.lStructSize = sizeof(OPENFILENAME);
|
||||||
|
of.lpstrFilter = "Roblox Files\0*.rbxm;*.rbxl\0\0";
|
||||||
|
char szFile[512];
|
||||||
|
of.lpstrFile = szFile ;
|
||||||
|
of.lpstrFile[0]='\0';
|
||||||
|
of.nMaxFile=500;
|
||||||
|
of.lpstrTitle="Hello";
|
||||||
|
of.Flags = OFN_FILEMUSTEXIST;
|
||||||
|
ShowCursor(TRUE);
|
||||||
|
BOOL file = GetOpenFileName(&of);
|
||||||
|
if (file)
|
||||||
|
{
|
||||||
|
_loadedFileName = of.lpstrFile;
|
||||||
|
load(of.lpstrFile,true);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
void DataModelInstance::setMessage(std::string msg)
|
||||||
|
{
|
||||||
|
message = msg;
|
||||||
|
isBrickCount = false;
|
||||||
|
showMessage = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DataModelInstance::clearMessage()
|
||||||
|
{
|
||||||
|
showMessage = false;
|
||||||
|
isBrickCount = false;
|
||||||
|
message = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
void DataModelInstance::setMessageBrickCount()
|
||||||
|
{
|
||||||
|
isBrickCount = true;
|
||||||
|
showMessage = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DataModelInstance::drawMessage(RenderDevice* rd)
|
||||||
|
{
|
||||||
|
if(isBrickCount)
|
||||||
|
{
|
||||||
|
int brickCount = 0;
|
||||||
|
int instCount = 0;
|
||||||
|
std::vector<Instance*> inst = getAllChildren();
|
||||||
|
for(size_t i = 0; i < inst.size(); i++)
|
||||||
|
{
|
||||||
|
if(PartInstance* moveTo = dynamic_cast<PartInstance*>(inst.at(i)))
|
||||||
|
{
|
||||||
|
brickCount++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
instCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
char brkc[12];
|
||||||
|
sprintf_s(brkc, "%d", brickCount);
|
||||||
|
char instc[12];
|
||||||
|
sprintf_s(instc, "%d", instCount);
|
||||||
|
message = "Bricks: ";
|
||||||
|
message += brkc;
|
||||||
|
message += " Snaps: ";
|
||||||
|
message += instc;
|
||||||
|
}
|
||||||
|
if(showMessage && !font.isNull())
|
||||||
|
{
|
||||||
|
int x = rd->getWidth()/2;
|
||||||
|
int y = rd->getHeight()/2;
|
||||||
|
int width = rd->getWidth()/2 + 100;
|
||||||
|
int height = width / 3;
|
||||||
|
Draw::box(Box(Vector3(x-(width/2), y-(height/2), 0), Vector3(x+(width/2), y+(height/2), 0)), rd, Color4::fromARGB(0x55B2B2B2), Color3::fromARGB(0xB2B2B2));
|
||||||
|
font->draw2D(rd, message, Vector2(x,y), height/8, Color3::white(), Color4::clear(), GFont::XALIGN_CENTER, GFont::YALIGN_CENTER);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
WorkspaceInstance* DataModelInstance::getWorkspace()
|
||||||
|
{
|
||||||
|
return workspace;
|
||||||
|
}
|
||||||
|
Vector2 DataModelInstance::getMousePos()
|
||||||
|
{
|
||||||
|
return Vector2(mousex,mousey);
|
||||||
|
}
|
||||||
|
void DataModelInstance::setMousePos(int x,int y)
|
||||||
|
{
|
||||||
|
mousex=x;
|
||||||
|
mousey=y;
|
||||||
|
}
|
||||||
|
void DataModelInstance::setMousePos(Vector2 pos)
|
||||||
|
{
|
||||||
|
mousex=pos.x;
|
||||||
|
mousey=pos.y;
|
||||||
|
}
|
||||||
|
GuiRoot* DataModelInstance::getGuiRoot()
|
||||||
|
{
|
||||||
|
return guiRoot;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LevelInstance* DataModelInstance::getLevel()
|
||||||
|
{
|
||||||
|
return level;
|
||||||
|
}
|
||||||
54
DataModelInstance.h
Normal file
54
DataModelInstance.h
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "WorkspaceInstance.h"
|
||||||
|
#include "LevelInstance.h"
|
||||||
|
#include "PartInstance.h"
|
||||||
|
#include "rapidxml/rapidxml.hpp"
|
||||||
|
#include "GuiRoot.h"
|
||||||
|
|
||||||
|
class GuiRoot;
|
||||||
|
|
||||||
|
class DataModelInstance :
|
||||||
|
public Instance
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DataModelInstance(void);
|
||||||
|
~DataModelInstance(void);
|
||||||
|
void setMessage(std::string);
|
||||||
|
void setMessageBrickCount();
|
||||||
|
void clearMessage();
|
||||||
|
bool debugGetOpen();
|
||||||
|
bool getOpen();
|
||||||
|
bool load(const char* filename,bool clearObjects);
|
||||||
|
bool readXMLFileStream(std::ifstream* file);
|
||||||
|
void drawMessage(RenderDevice*);
|
||||||
|
WorkspaceInstance* getWorkspace();
|
||||||
|
WorkspaceInstance* workspace;
|
||||||
|
LevelInstance * level;
|
||||||
|
LevelInstance * getLevel();
|
||||||
|
GuiRoot* guiRoot;
|
||||||
|
std::string message;
|
||||||
|
std::string _loadedFileName;
|
||||||
|
bool showMessage;
|
||||||
|
G3D::GFontRef font;
|
||||||
|
GuiRoot* getGuiRoot();
|
||||||
|
float mousex;
|
||||||
|
float mousey;
|
||||||
|
Vector2 getMousePos();
|
||||||
|
void setMousePos(int x,int y);
|
||||||
|
void setMousePos(Vector2 pos);
|
||||||
|
bool mouseButton1Down;
|
||||||
|
PartInstance* makePart();
|
||||||
|
void clearLevel();
|
||||||
|
#if _DEBUG
|
||||||
|
void modXMLLevel(float modY);
|
||||||
|
#endif
|
||||||
|
private:
|
||||||
|
bool isBrickCount;
|
||||||
|
bool scanXMLObject(rapidxml::xml_node<>* node);
|
||||||
|
rapidxml::xml_node<>* getNode(rapidxml::xml_node<> * node,const char* name );
|
||||||
|
float getFloatValue(rapidxml::xml_node<> * node,const char* name);
|
||||||
|
bool _successfulLoad;
|
||||||
|
std::string _errMsg;
|
||||||
|
bool _legacyLoad;
|
||||||
|
float _modY;
|
||||||
|
};
|
||||||
8
DeleteListener.cpp
Normal file
8
DeleteListener.cpp
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#include "DeleteListener.h"
|
||||||
|
#include "Globals.h"
|
||||||
|
#include "Application.h"
|
||||||
|
|
||||||
|
void DeleteListener::onButton1MouseClick(BaseButtonInstance* button)
|
||||||
|
{
|
||||||
|
g_usableApp->deleteInstance();
|
||||||
|
}
|
||||||
6
DeleteListener.h
Normal file
6
DeleteListener.h
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#include "ButtonListener.h"
|
||||||
|
|
||||||
|
class DeleteListener : public ButtonListener {
|
||||||
|
public:
|
||||||
|
void onButton1MouseClick(BaseButtonInstance*);
|
||||||
|
};
|
||||||
BIN
Dialogs.aps
BIN
Dialogs.aps
Binary file not shown.
128
Dialogs.rc
128
Dialogs.rc
@@ -1,109 +1,43 @@
|
|||||||
// Microsoft Visual C++ generated resource script.
|
// Generated by ResEdit 1.6.6
|
||||||
//
|
// Copyright (C) 2006-2015
|
||||||
|
// http://www.resedit.net
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
#include <commctrl.h>
|
||||||
|
#include <richedit.h>
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
#define APSTUDIO_READONLY_SYMBOLS
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Generated from the TEXTINCLUDE 2 resource.
|
// Bitmap resources
|
||||||
//
|
//
|
||||||
#include "afxres.h"
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
#undef APSTUDIO_READONLY_SYMBOLS
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
// English (U.S.) resources
|
|
||||||
|
|
||||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
|
||||||
#ifdef _WIN32
|
|
||||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
|
||||||
#pragma code_page(1252)
|
|
||||||
#endif //_WIN32
|
|
||||||
|
|
||||||
#ifdef APSTUDIO_INVOKED
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// TEXTINCLUDE
|
|
||||||
//
|
|
||||||
|
|
||||||
1 TEXTINCLUDE
|
|
||||||
BEGIN
|
|
||||||
"resource.h\0"
|
|
||||||
END
|
|
||||||
|
|
||||||
2 TEXTINCLUDE
|
|
||||||
BEGIN
|
|
||||||
"#include ""afxres.h""\r\n"
|
|
||||||
"\0"
|
|
||||||
END
|
|
||||||
|
|
||||||
3 TEXTINCLUDE
|
|
||||||
BEGIN
|
|
||||||
"\r\n"
|
|
||||||
"\0"
|
|
||||||
END
|
|
||||||
|
|
||||||
#endif // APSTUDIO_INVOKED
|
|
||||||
|
|
||||||
#endif // English (U.S.) resources
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
// English (Canada) resources
|
|
||||||
|
|
||||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENC)
|
|
||||||
#ifdef _WIN32
|
|
||||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_CAN
|
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_CAN
|
||||||
#pragma code_page(1252)
|
IDB_BITMAP1 BITMAP "Parts.bmp"
|
||||||
#endif //_WIN32
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
//
|
||||||
// Dialog
|
// Dialog resources
|
||||||
//
|
//
|
||||||
|
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
||||||
IDD_ABOUT_DIALOG DIALOGEX 0, 0, 226, 151
|
IDD_DIALOG1 DIALOG 0, 0, 295, 43
|
||||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SETFOREGROUND | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU
|
||||||
CAPTION "About"
|
EXSTYLE WS_EX_WINDOWEDGE
|
||||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
CAPTION "Insert Object"
|
||||||
BEGIN
|
FONT 8, "Ms Shell Dlg"
|
||||||
DEFPUSHBUTTON "OK",IDOK,169,130,50,14
|
{
|
||||||
PUSHBUTTON "Cancel",IDCANCEL,112,130,50,14
|
EDITTEXT IDE_EDIT, 35, 6, 195, 14, ES_AUTOHSCROLL, WS_EX_LEFT
|
||||||
END
|
LTEXT "Class:", 0, 10, 9, 20, 9, SS_LEFT, WS_EX_LEFT
|
||||||
|
PUSHBUTTON "Cancel", IDCANCEL, 237, 24, 50, 14, 0, WS_EX_LEFT
|
||||||
|
DEFPUSHBUTTON "OK", IDOK, 237, 6, 50, 14, 0, WS_EX_LEFT
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
//
|
||||||
// DESIGNINFO
|
// Icon resources
|
||||||
//
|
//
|
||||||
|
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_CAN
|
||||||
#ifdef APSTUDIO_INVOKED
|
IDI_ICON1 ICON "icon1.ico"
|
||||||
GUIDELINES DESIGNINFO
|
|
||||||
BEGIN
|
|
||||||
IDD_ABOUT_DIALOG, DIALOG
|
|
||||||
BEGIN
|
|
||||||
LEFTMARGIN, 7
|
|
||||||
RIGHTMARGIN, 219
|
|
||||||
TOPMARGIN, 7
|
|
||||||
BOTTOMMARGIN, 144
|
|
||||||
END
|
|
||||||
END
|
|
||||||
#endif // APSTUDIO_INVOKED
|
|
||||||
|
|
||||||
#endif // English (Canada) resources
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef APSTUDIO_INVOKED
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// Generated from the TEXTINCLUDE 3 resource.
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
#endif // not APSTUDIO_INVOKED
|
|
||||||
|
|
||||||
|
|||||||
13
Documentation/index.html
Normal file
13
Documentation/index.html
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title> RBX05R Documentation </title>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="content" style="text-align:center;">
|
||||||
|
<h1> ROBLOX 2005 Recreation documentation </h1>
|
||||||
|
<br>
|
||||||
|
<h4> Current for: r360 </h4>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
17
Enum.h
Normal file
17
Enum.h
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace Enum
|
||||||
|
{
|
||||||
|
namespace SurfaceType
|
||||||
|
{
|
||||||
|
enum Value {
|
||||||
|
Smooth, Snaps, Inlets, Glue, Weld, Spawn, Hinge, Motor, Bumps
|
||||||
|
};
|
||||||
|
}
|
||||||
|
namespace Shape
|
||||||
|
{
|
||||||
|
enum Value {
|
||||||
|
Ball = 0, Block = 1, Cylinder = 2
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
16
Enums.h
Normal file
16
Enums.h
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#ifdef UENUMS
|
||||||
|
#ifndef ENUM_H
|
||||||
|
#define ENUM_H
|
||||||
|
static enum BinType {GameTool, Grab, Clone, Hammer};
|
||||||
|
static enum ControllerType {None, KeyboardRight, KeyboardLeft, Joypad1, Joypad2, Chase, Flee};
|
||||||
|
//static enum JointType {UNK0, WeldJoint, SnapJoint, UNK3, Rotate, RotateP, RotateV, GlueJoint, UNK8, UNK9, None};
|
||||||
|
static enum ActionType {Nothing, Pause, Lose, Draw, Win};
|
||||||
|
static enum AffectType {NoChange, Increase, Decrease};
|
||||||
|
static enum InputType {NoInput, LeftTread, RightTread, Steer, Throtle, UpDown, Action1, Action2, Action3, Action4, Action5, Constant, Sin};
|
||||||
|
//static enum SurfaceConstraint {None, Hinge, SteppingMotor, Motor};
|
||||||
|
static enum SurfaceType{Smooth, Snaps, Inlets, Glue, Weld, Spawn, Hinge, Motor, Bumps};
|
||||||
|
static enum SoundType {NoSound, Boing, Bomb, Break, Click, Clock, Slingshot, Page, Ping, Snap, Splat, Step, StepOn, Swoosh, Victory};
|
||||||
|
static enum PartType {Ball, Block, Cylinder};
|
||||||
|
static enum KeywordFilterType {Include, Exclude};
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
29
ErrorFunctions.cpp
Normal file
29
ErrorFunctions.cpp
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
#include <sstream>
|
||||||
|
#include "ErrorFunctions.h"
|
||||||
|
#include "Globals.h"
|
||||||
|
|
||||||
|
|
||||||
|
void OnError(int err, std::string msg)
|
||||||
|
{
|
||||||
|
//g_usableApp->window()->setInputCaptureCount(0);
|
||||||
|
//g_usableApp->window()->setMouseVisible(true);
|
||||||
|
std::string emsg = "An unexpected error has occured and "+g_PlaceholderName+" has to quit. We're sorry!" + msg;
|
||||||
|
std::string title = g_PlaceholderName+"Crash";
|
||||||
|
//clearInstances();
|
||||||
|
MessageBox(NULL, emsg.c_str(), title.c_str(), MB_OK);
|
||||||
|
exit(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MessageBoxStr(std::string msg)
|
||||||
|
{
|
||||||
|
std::string title = g_PlaceholderName;
|
||||||
|
MessageBox(NULL, msg.c_str(), title.c_str(), MB_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MessageBoxStream(std::stringstream msg)
|
||||||
|
{
|
||||||
|
std::string strMsg = msg.str();
|
||||||
|
std::string title = g_PlaceholderName;
|
||||||
|
MessageBox(NULL, strMsg.c_str(), title.c_str(), MB_OK);
|
||||||
|
}
|
||||||
6
ErrorFunctions.h
Normal file
6
ErrorFunctions.h
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
void OnError(int err, std::string msg = "");
|
||||||
|
void MessageBoxStr(std::string msg);
|
||||||
|
void MessageBoxStream(std::stringstream msg);
|
||||||
BIN
G3DTest.aps
Normal file
BIN
G3DTest.aps
Normal file
Binary file not shown.
210
G3DTest.dsp
210
G3DTest.dsp
@@ -1,105 +1,105 @@
|
|||||||
# Microsoft Developer Studio Project File - Name="G3DTest" - Package Owner=<4>
|
# Microsoft Developer Studio Project File - Name="G3DTest" - Package Owner=<4>
|
||||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||||
# ** DO NOT EDIT **
|
# ** DO NOT EDIT **
|
||||||
|
|
||||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||||
|
|
||||||
CFG=G3DTest - Win32 Debug
|
CFG=G3DTest - Win32 Debug
|
||||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||||
!MESSAGE use the Export Makefile command and run
|
!MESSAGE use the Export Makefile command and run
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
!MESSAGE NMAKE /f "G3DTest.mak".
|
!MESSAGE NMAKE /f "G3DTest.mak".
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
!MESSAGE You can specify a configuration when running NMAKE
|
!MESSAGE You can specify a configuration when running NMAKE
|
||||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
!MESSAGE NMAKE /f "G3DTest.mak" CFG="G3DTest - Win32 Debug"
|
!MESSAGE NMAKE /f "G3DTest.mak" CFG="G3DTest - Win32 Debug"
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
!MESSAGE Possible choices for configuration are:
|
!MESSAGE Possible choices for configuration are:
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
!MESSAGE "G3DTest - Win32 Release" (based on "Win32 (x86) Application")
|
!MESSAGE "G3DTest - Win32 Release" (based on "Win32 (x86) Application")
|
||||||
!MESSAGE "G3DTest - Win32 Debug" (based on "Win32 (x86) Application")
|
!MESSAGE "G3DTest - Win32 Debug" (based on "Win32 (x86) Application")
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
|
|
||||||
# Begin Project
|
# Begin Project
|
||||||
# PROP AllowPerConfigDependencies 0
|
# PROP AllowPerConfigDependencies 0
|
||||||
# PROP Scc_ProjName ""
|
# PROP Scc_ProjName ""
|
||||||
# PROP Scc_LocalPath ""
|
# PROP Scc_LocalPath ""
|
||||||
CPP=cl.exe
|
CPP=cl.exe
|
||||||
MTL=midl.exe
|
MTL=midl.exe
|
||||||
RSC=rc.exe
|
RSC=rc.exe
|
||||||
|
|
||||||
!IF "$(CFG)" == "G3DTest - Win32 Release"
|
!IF "$(CFG)" == "G3DTest - Win32 Release"
|
||||||
|
|
||||||
# PROP BASE Use_MFC 0
|
# PROP BASE Use_MFC 0
|
||||||
# PROP BASE Use_Debug_Libraries 0
|
# PROP BASE Use_Debug_Libraries 0
|
||||||
# PROP BASE Output_Dir "Release"
|
# PROP BASE Output_Dir "Release"
|
||||||
# PROP BASE Intermediate_Dir "Release"
|
# PROP BASE Intermediate_Dir "Release"
|
||||||
# PROP BASE Target_Dir ""
|
# PROP BASE Target_Dir ""
|
||||||
# PROP Use_MFC 0
|
# PROP Use_MFC 0
|
||||||
# PROP Use_Debug_Libraries 0
|
# PROP Use_Debug_Libraries 0
|
||||||
# PROP Output_Dir "Release"
|
# PROP Output_Dir "Release"
|
||||||
# PROP Intermediate_Dir "Release"
|
# PROP Intermediate_Dir "Release"
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
|
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
|
||||||
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
|
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
|
||||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||||
# ADD BASE RSC /l 0x1009 /d "NDEBUG"
|
# ADD BASE RSC /l 0x1009 /d "NDEBUG"
|
||||||
# ADD RSC /l 0x1009 /d "NDEBUG"
|
# ADD RSC /l 0x1009 /d "NDEBUG"
|
||||||
BSC32=bscmake.exe
|
BSC32=bscmake.exe
|
||||||
# ADD BASE BSC32 /nologo
|
# ADD BASE BSC32 /nologo
|
||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
|
||||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "G3DTest - Win32 Debug"
|
!ELSEIF "$(CFG)" == "G3DTest - Win32 Debug"
|
||||||
|
|
||||||
# PROP BASE Use_MFC 0
|
# PROP BASE Use_MFC 0
|
||||||
# PROP BASE Use_Debug_Libraries 1
|
# PROP BASE Use_Debug_Libraries 1
|
||||||
# PROP BASE Output_Dir "Debug"
|
# PROP BASE Output_Dir "Debug"
|
||||||
# PROP BASE Intermediate_Dir "Debug"
|
# PROP BASE Intermediate_Dir "Debug"
|
||||||
# PROP BASE Target_Dir ""
|
# PROP BASE Target_Dir ""
|
||||||
# PROP Use_MFC 0
|
# PROP Use_MFC 0
|
||||||
# PROP Use_Debug_Libraries 1
|
# PROP Use_Debug_Libraries 1
|
||||||
# PROP Output_Dir "Debug"
|
# PROP Output_Dir "Debug"
|
||||||
# PROP Intermediate_Dir "Debug"
|
# PROP Intermediate_Dir "Debug"
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
|
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
|
||||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
|
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
|
||||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||||
# ADD BASE RSC /l 0x1009 /d "_DEBUG"
|
# ADD BASE RSC /l 0x1009 /d "_DEBUG"
|
||||||
# ADD RSC /l 0x1009 /d "_DEBUG"
|
# ADD RSC /l 0x1009 /d "_DEBUG"
|
||||||
BSC32=bscmake.exe
|
BSC32=bscmake.exe
|
||||||
# ADD BASE BSC32 /nologo
|
# ADD BASE BSC32 /nologo
|
||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||||
|
|
||||||
!ENDIF
|
!ENDIF
|
||||||
|
|
||||||
# Begin Target
|
# Begin Target
|
||||||
|
|
||||||
# Name "G3DTest - Win32 Release"
|
# Name "G3DTest - Win32 Release"
|
||||||
# Name "G3DTest - Win32 Debug"
|
# Name "G3DTest - Win32 Debug"
|
||||||
# Begin Group "Source Files"
|
# Begin Group "Source Files"
|
||||||
|
|
||||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\main.cpp
|
SOURCE=.\main.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# End Group
|
# End Group
|
||||||
# Begin Group "Header Files"
|
# Begin Group "Header Files"
|
||||||
|
|
||||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||||
# End Group
|
# End Group
|
||||||
# Begin Group "Resource Files"
|
# Begin Group "Resource Files"
|
||||||
|
|
||||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||||
# End Group
|
# End Group
|
||||||
# End Target
|
# End Target
|
||||||
# End Project
|
# End Project
|
||||||
|
|||||||
58
G3DTest.dsw
58
G3DTest.dsw
@@ -1,29 +1,29 @@
|
|||||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
Project: "G3DTest"=.\G3DTest.dsp - Package Owner=<4>
|
Project: "G3DTest"=.\G3DTest.dsp - Package Owner=<4>
|
||||||
|
|
||||||
Package=<5>
|
Package=<5>
|
||||||
{{{
|
{{{
|
||||||
}}}
|
}}}
|
||||||
|
|
||||||
Package=<4>
|
Package=<4>
|
||||||
{{{
|
{{{
|
||||||
}}}
|
}}}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
Global:
|
Global:
|
||||||
|
|
||||||
Package=<5>
|
Package=<5>
|
||||||
{{{
|
{{{
|
||||||
}}}
|
}}}
|
||||||
|
|
||||||
Package=<3>
|
Package=<3>
|
||||||
{{{
|
{{{
|
||||||
}}}
|
}}}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
|||||||
64
G3DTest.plg
64
G3DTest.plg
@@ -1,32 +1,32 @@
|
|||||||
<html>
|
<html>
|
||||||
<body>
|
<body>
|
||||||
<pre>
|
<pre>
|
||||||
<h1>Build Log</h1>
|
<h1>Build Log</h1>
|
||||||
<h3>
|
<h3>
|
||||||
--------------------Configuration: G3DTest - Win32 Debug--------------------
|
--------------------Configuration: G3DTest - Win32 Debug--------------------
|
||||||
</h3>
|
</h3>
|
||||||
<h3>Command Lines</h3>
|
<h3>Command Lines</h3>
|
||||||
Creating temporary file "C:\Users\Andreja\AppData\Local\Temp\RSPFD70.tmp" with contents
|
Creating temporary file "C:\Users\Andreja\AppData\Local\Temp\RSPFD70.tmp" with contents
|
||||||
[
|
[
|
||||||
/nologo /MLd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Fp"Debug/G3DTest.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c
|
/nologo /MLd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Fp"Debug/G3DTest.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c
|
||||||
"C:\USERS\ANDREJA\G3D\G3DTest\main.cpp"
|
"C:\USERS\ANDREJA\G3D\G3DTest\main.cpp"
|
||||||
]
|
]
|
||||||
Creating command line "cl.exe @C:\Users\Andreja\AppData\Local\Temp\RSPFD70.tmp"
|
Creating command line "cl.exe @C:\Users\Andreja\AppData\Local\Temp\RSPFD70.tmp"
|
||||||
Creating temporary file "C:\Users\Andreja\AppData\Local\Temp\RSPFD71.tmp" with contents
|
Creating temporary file "C:\Users\Andreja\AppData\Local\Temp\RSPFD71.tmp" with contents
|
||||||
[
|
[
|
||||||
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /incremental:yes /pdb:"Debug/G3DTest.pdb" /debug /machine:I386 /out:"Debug/G3DTest.exe" /pdbtype:sept
|
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /incremental:yes /pdb:"Debug/G3DTest.pdb" /debug /machine:I386 /out:"Debug/G3DTest.exe" /pdbtype:sept
|
||||||
.\Debug\main.obj
|
.\Debug\main.obj
|
||||||
]
|
]
|
||||||
Creating command line "link.exe @C:\Users\Andreja\AppData\Local\Temp\RSPFD71.tmp"
|
Creating command line "link.exe @C:\Users\Andreja\AppData\Local\Temp\RSPFD71.tmp"
|
||||||
<h3>Output Window</h3>
|
<h3>Output Window</h3>
|
||||||
Compiling...
|
Compiling...
|
||||||
main.cpp
|
main.cpp
|
||||||
Linking...
|
Linking...
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<h3>Results</h3>
|
<h3>Results</h3>
|
||||||
G3DTest.exe - 0 error(s), 0 warning(s)
|
G3DTest.exe - 0 error(s), 0 warning(s)
|
||||||
</pre>
|
</pre>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
40
G3DTest.sln
40
G3DTest.sln
@@ -1,20 +1,20 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||||
# Visual Studio 2005
|
# Visual C++ Express 2005
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "G3DTest", "G3DTest.vcproj", "{6C4D6EEF-B1D1-456A-B850-92CAB17124BE}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "G3DTest", "G3DTest.vcproj", "{6C4D6EEF-B1D1-456A-B850-92CAB17124BE}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Win32 = Debug|Win32
|
Debug|Win32 = Debug|Win32
|
||||||
Release|Win32 = Release|Win32
|
Release|Win32 = Release|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{6C4D6EEF-B1D1-456A-B850-92CAB17124BE}.Debug|Win32.ActiveCfg = Debug|Win32
|
{6C4D6EEF-B1D1-456A-B850-92CAB17124BE}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
{6C4D6EEF-B1D1-456A-B850-92CAB17124BE}.Debug|Win32.Build.0 = Debug|Win32
|
{6C4D6EEF-B1D1-456A-B850-92CAB17124BE}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{6C4D6EEF-B1D1-456A-B850-92CAB17124BE}.Release|Win32.ActiveCfg = Release|Win32
|
{6C4D6EEF-B1D1-456A-B850-92CAB17124BE}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
{6C4D6EEF-B1D1-456A-B850-92CAB17124BE}.Release|Win32.Build.0 = Release|Win32
|
{6C4D6EEF-B1D1-456A-B850-92CAB17124BE}.Release|Win32.Build.0 = Release|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|||||||
BIN
G3DTest.suo
BIN
G3DTest.suo
Binary file not shown.
870
G3DTest.vcproj
870
G3DTest.vcproj
@@ -1,291 +1,579 @@
|
|||||||
<?xml version="1.0" encoding="Windows-1252"?>
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
<VisualStudioProject
|
<VisualStudioProject
|
||||||
ProjectType="Visual C++"
|
ProjectType="Visual C++"
|
||||||
Version="8.00"
|
Version="8.00"
|
||||||
Name="G3DTest"
|
Name="G3DTest"
|
||||||
ProjectGUID="{6C4D6EEF-B1D1-456A-B850-92CAB17124BE}"
|
ProjectGUID="{6C4D6EEF-B1D1-456A-B850-92CAB17124BE}"
|
||||||
RootNamespace="G3DTest"
|
RootNamespace="G3DTest"
|
||||||
>
|
>
|
||||||
<Platforms>
|
<Platforms>
|
||||||
<Platform
|
<Platform
|
||||||
Name="Win32"
|
Name="Win32"
|
||||||
/>
|
/>
|
||||||
</Platforms>
|
</Platforms>
|
||||||
<ToolFiles>
|
<ToolFiles>
|
||||||
</ToolFiles>
|
</ToolFiles>
|
||||||
<Configurations>
|
<Configurations>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Release|Win32"
|
Name="Release|Win32"
|
||||||
OutputDirectory=".\Release"
|
OutputDirectory=".\Release"
|
||||||
IntermediateDirectory=".\Release"
|
IntermediateDirectory=".\Release"
|
||||||
ConfigurationType="1"
|
ConfigurationType="1"
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||||
UseOfMFC="0"
|
UseOfMFC="0"
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
UseOfATL="0"
|
||||||
CharacterSet="2"
|
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||||
>
|
CharacterSet="2"
|
||||||
<Tool
|
>
|
||||||
Name="VCPreBuildEventTool"
|
<Tool
|
||||||
/>
|
Name="VCPreBuildEventTool"
|
||||||
<Tool
|
/>
|
||||||
Name="VCCustomBuildTool"
|
<Tool
|
||||||
/>
|
Name="VCCustomBuildTool"
|
||||||
<Tool
|
/>
|
||||||
Name="VCXMLDataGeneratorTool"
|
<Tool
|
||||||
/>
|
Name="VCXMLDataGeneratorTool"
|
||||||
<Tool
|
/>
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
<Tool
|
||||||
/>
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
<Tool
|
/>
|
||||||
Name="VCMIDLTool"
|
<Tool
|
||||||
PreprocessorDefinitions="NDEBUG"
|
Name="VCMIDLTool"
|
||||||
MkTypLibCompatible="true"
|
PreprocessorDefinitions="NDEBUG"
|
||||||
SuppressStartupBanner="true"
|
MkTypLibCompatible="true"
|
||||||
TargetEnvironment="1"
|
SuppressStartupBanner="true"
|
||||||
TypeLibraryName=".\Release/G3DTest.tlb"
|
TargetEnvironment="1"
|
||||||
HeaderFileName=""
|
TypeLibraryName=".\Release/G3DTest.tlb"
|
||||||
/>
|
HeaderFileName=""
|
||||||
<Tool
|
/>
|
||||||
Name="VCCLCompilerTool"
|
<Tool
|
||||||
Optimization="2"
|
Name="VCCLCompilerTool"
|
||||||
InlineFunctionExpansion="1"
|
Optimization="2"
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
|
InlineFunctionExpansion="1"
|
||||||
StringPooling="true"
|
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
|
||||||
RuntimeLibrary="0"
|
StringPooling="true"
|
||||||
EnableFunctionLevelLinking="true"
|
RuntimeLibrary="2"
|
||||||
PrecompiledHeaderFile=".\Release/G3DTest.pch"
|
EnableFunctionLevelLinking="true"
|
||||||
AssemblerListingLocation=".\Release/"
|
PrecompiledHeaderFile=".\Release/G3DTest.pch"
|
||||||
ObjectFile=".\Release/"
|
AssemblerListingLocation=".\Release/"
|
||||||
ProgramDataBaseFileName=".\Release/"
|
ObjectFile=".\Release/"
|
||||||
WarningLevel="3"
|
ProgramDataBaseFileName=".\Release/"
|
||||||
SuppressStartupBanner="true"
|
WarningLevel="3"
|
||||||
/>
|
SuppressStartupBanner="true"
|
||||||
<Tool
|
/>
|
||||||
Name="VCManagedResourceCompilerTool"
|
<Tool
|
||||||
/>
|
Name="VCManagedResourceCompilerTool"
|
||||||
<Tool
|
/>
|
||||||
Name="VCResourceCompilerTool"
|
<Tool
|
||||||
PreprocessorDefinitions="NDEBUG"
|
Name="VCResourceCompilerTool"
|
||||||
Culture="4105"
|
PreprocessorDefinitions="NDEBUG"
|
||||||
/>
|
Culture="4105"
|
||||||
<Tool
|
/>
|
||||||
Name="VCPreLinkEventTool"
|
<Tool
|
||||||
/>
|
Name="VCPreLinkEventTool"
|
||||||
<Tool
|
/>
|
||||||
Name="VCLinkerTool"
|
<Tool
|
||||||
OutputFile=".\Release/G3DTest.exe"
|
Name="VCLinkerTool"
|
||||||
LinkIncremental="1"
|
AdditionalDependencies="Advapi32.lib UxTheme.lib Comctl32.lib Comdlg32.lib Shell32.lib"
|
||||||
SuppressStartupBanner="true"
|
OutputFile="./G3DTest.exe"
|
||||||
ProgramDatabaseFile=".\Release/G3DTest.pdb"
|
LinkIncremental="1"
|
||||||
SubSystem="2"
|
SuppressStartupBanner="true"
|
||||||
TargetMachine="1"
|
ProgramDatabaseFile=".\Release/G3DTest.pdb"
|
||||||
/>
|
SubSystem="2"
|
||||||
<Tool
|
TargetMachine="1"
|
||||||
Name="VCALinkTool"
|
/>
|
||||||
/>
|
<Tool
|
||||||
<Tool
|
Name="VCALinkTool"
|
||||||
Name="VCManifestTool"
|
/>
|
||||||
/>
|
<Tool
|
||||||
<Tool
|
Name="VCManifestTool"
|
||||||
Name="VCXDCMakeTool"
|
/>
|
||||||
/>
|
<Tool
|
||||||
<Tool
|
Name="VCXDCMakeTool"
|
||||||
Name="VCBscMakeTool"
|
/>
|
||||||
SuppressStartupBanner="true"
|
<Tool
|
||||||
OutputFile=".\Release/G3DTest.bsc"
|
Name="VCBscMakeTool"
|
||||||
/>
|
SuppressStartupBanner="true"
|
||||||
<Tool
|
OutputFile=".\Release/G3DTest.bsc"
|
||||||
Name="VCFxCopTool"
|
/>
|
||||||
/>
|
<Tool
|
||||||
<Tool
|
Name="VCFxCopTool"
|
||||||
Name="VCAppVerifierTool"
|
/>
|
||||||
/>
|
<Tool
|
||||||
<Tool
|
Name="VCAppVerifierTool"
|
||||||
Name="VCWebDeploymentTool"
|
/>
|
||||||
/>
|
<Tool
|
||||||
<Tool
|
Name="VCWebDeploymentTool"
|
||||||
Name="VCPostBuildEventTool"
|
/>
|
||||||
/>
|
<Tool
|
||||||
</Configuration>
|
Name="VCPostBuildEventTool"
|
||||||
<Configuration
|
/>
|
||||||
Name="Debug|Win32"
|
</Configuration>
|
||||||
OutputDirectory=".\Debug"
|
<Configuration
|
||||||
IntermediateDirectory=".\Debug"
|
Name="Debug|Win32"
|
||||||
ConfigurationType="1"
|
OutputDirectory=".\Debug"
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
IntermediateDirectory=".\Debug"
|
||||||
UseOfMFC="0"
|
ConfigurationType="1"
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||||
CharacterSet="2"
|
UseOfMFC="0"
|
||||||
ManagedExtensions="0"
|
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||||
>
|
CharacterSet="2"
|
||||||
<Tool
|
ManagedExtensions="0"
|
||||||
Name="VCPreBuildEventTool"
|
>
|
||||||
/>
|
<Tool
|
||||||
<Tool
|
Name="VCPreBuildEventTool"
|
||||||
Name="VCCustomBuildTool"
|
/>
|
||||||
/>
|
<Tool
|
||||||
<Tool
|
Name="VCCustomBuildTool"
|
||||||
Name="VCXMLDataGeneratorTool"
|
/>
|
||||||
/>
|
<Tool
|
||||||
<Tool
|
Name="VCXMLDataGeneratorTool"
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
/>
|
||||||
/>
|
<Tool
|
||||||
<Tool
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
Name="VCMIDLTool"
|
/>
|
||||||
PreprocessorDefinitions="_DEBUG"
|
<Tool
|
||||||
MkTypLibCompatible="true"
|
Name="VCMIDLTool"
|
||||||
SuppressStartupBanner="true"
|
PreprocessorDefinitions="_DEBUG"
|
||||||
TargetEnvironment="1"
|
MkTypLibCompatible="true"
|
||||||
TypeLibraryName=".\Debug/G3DTest.tlb"
|
SuppressStartupBanner="true"
|
||||||
HeaderFileName=""
|
TargetEnvironment="1"
|
||||||
/>
|
TypeLibraryName=".\Debug/G3DTest.tlb"
|
||||||
<Tool
|
HeaderFileName=""
|
||||||
Name="VCCLCompilerTool"
|
/>
|
||||||
Optimization="0"
|
<Tool
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
|
Name="VCCLCompilerTool"
|
||||||
MinimalRebuild="false"
|
Optimization="0"
|
||||||
BasicRuntimeChecks="0"
|
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
|
||||||
RuntimeLibrary="2"
|
MinimalRebuild="false"
|
||||||
PrecompiledHeaderFile=".\Debug/G3DTest.pch"
|
BasicRuntimeChecks="0"
|
||||||
AssemblerListingLocation=".\Debug/"
|
RuntimeLibrary="3"
|
||||||
ObjectFile=".\Debug/"
|
EnableFunctionLevelLinking="false"
|
||||||
ProgramDataBaseFileName=".\Debug/"
|
PrecompiledHeaderFile=".\Debug/G3DTest.pch"
|
||||||
WarningLevel="3"
|
AssemblerListingLocation=".\Debug/"
|
||||||
SuppressStartupBanner="true"
|
ObjectFile=".\Debug/"
|
||||||
DebugInformationFormat="3"
|
ProgramDataBaseFileName=".\Debug/"
|
||||||
/>
|
WarningLevel="3"
|
||||||
<Tool
|
SuppressStartupBanner="true"
|
||||||
Name="VCManagedResourceCompilerTool"
|
DebugInformationFormat="3"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCResourceCompilerTool"
|
Name="VCManagedResourceCompilerTool"
|
||||||
PreprocessorDefinitions="_DEBUG"
|
/>
|
||||||
Culture="4105"
|
<Tool
|
||||||
/>
|
Name="VCResourceCompilerTool"
|
||||||
<Tool
|
PreprocessorDefinitions="_DEBUG"
|
||||||
Name="VCPreLinkEventTool"
|
Culture="4105"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCPreLinkEventTool"
|
||||||
OutputFile=".\Debug/G3DTest.exe"
|
/>
|
||||||
LinkIncremental="2"
|
<Tool
|
||||||
SuppressStartupBanner="true"
|
Name="VCLinkerTool"
|
||||||
GenerateDebugInformation="true"
|
AdditionalDependencies="Advapi32.lib UxTheme.lib Comctl32.lib Comdlg32.lib Shell32.lib"
|
||||||
ProgramDatabaseFile=".\Debug/G3DTest.pdb"
|
OutputFile="./G3DTest-Debug.exe"
|
||||||
SubSystem="2"
|
LinkIncremental="2"
|
||||||
TargetMachine="1"
|
SuppressStartupBanner="true"
|
||||||
/>
|
GenerateDebugInformation="true"
|
||||||
<Tool
|
ProgramDatabaseFile=".\Debug/G3DTest.pdb"
|
||||||
Name="VCALinkTool"
|
SubSystem="1"
|
||||||
/>
|
TargetMachine="1"
|
||||||
<Tool
|
/>
|
||||||
Name="VCManifestTool"
|
<Tool
|
||||||
/>
|
Name="VCALinkTool"
|
||||||
<Tool
|
/>
|
||||||
Name="VCXDCMakeTool"
|
<Tool
|
||||||
/>
|
Name="VCManifestTool"
|
||||||
<Tool
|
/>
|
||||||
Name="VCBscMakeTool"
|
<Tool
|
||||||
SuppressStartupBanner="true"
|
Name="VCXDCMakeTool"
|
||||||
OutputFile=".\Debug/G3DTest.bsc"
|
/>
|
||||||
/>
|
<Tool
|
||||||
<Tool
|
Name="VCBscMakeTool"
|
||||||
Name="VCFxCopTool"
|
SuppressStartupBanner="true"
|
||||||
/>
|
OutputFile=".\Debug/G3DTest.bsc"
|
||||||
<Tool
|
/>
|
||||||
Name="VCAppVerifierTool"
|
<Tool
|
||||||
/>
|
Name="VCFxCopTool"
|
||||||
<Tool
|
/>
|
||||||
Name="VCWebDeploymentTool"
|
<Tool
|
||||||
/>
|
Name="VCAppVerifierTool"
|
||||||
<Tool
|
/>
|
||||||
Name="VCPostBuildEventTool"
|
<Tool
|
||||||
/>
|
Name="VCWebDeploymentTool"
|
||||||
</Configuration>
|
/>
|
||||||
</Configurations>
|
<Tool
|
||||||
<References>
|
Name="VCPostBuildEventTool"
|
||||||
<AssemblyReference
|
/>
|
||||||
RelativePath="System.dll"
|
</Configuration>
|
||||||
AssemblyName="System, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"
|
</Configurations>
|
||||||
/>
|
<References>
|
||||||
<AssemblyReference
|
<AssemblyReference
|
||||||
RelativePath="System.Data.dll"
|
RelativePath="System.dll"
|
||||||
AssemblyName="System.Data, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=x86"
|
AssemblyName="System, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"
|
||||||
/>
|
/>
|
||||||
<AssemblyReference
|
<AssemblyReference
|
||||||
RelativePath="System.Drawing.dll"
|
RelativePath="System.Data.dll"
|
||||||
AssemblyName="System.Drawing, Version=2.0.0.0, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
|
AssemblyName="System.Data, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=x86"
|
||||||
/>
|
/>
|
||||||
<AssemblyReference
|
<AssemblyReference
|
||||||
RelativePath="System.Windows.Forms.dll"
|
RelativePath="System.Drawing.dll"
|
||||||
AssemblyName="System.Windows.Forms, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"
|
AssemblyName="System.Drawing, Version=2.0.0.0, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
|
||||||
/>
|
/>
|
||||||
<AssemblyReference
|
<AssemblyReference
|
||||||
RelativePath="System.XML.dll"
|
RelativePath="System.Windows.Forms.dll"
|
||||||
AssemblyName="System.Xml, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"
|
AssemblyName="System.Windows.Forms, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"
|
||||||
/>
|
/>
|
||||||
</References>
|
<AssemblyReference
|
||||||
<Files>
|
RelativePath="System.XML.dll"
|
||||||
<Filter
|
AssemblyName="System.Xml, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"
|
||||||
Name="Source Files"
|
/>
|
||||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
</References>
|
||||||
>
|
<Files>
|
||||||
<File
|
<Filter
|
||||||
RelativePath=".\Dialogs.rc"
|
Name="Source Files"
|
||||||
>
|
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||||
</File>
|
>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\Instance.cpp"
|
RelativePath=".\Application.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="main.cpp"
|
RelativePath=".\AudioPlayer.cpp"
|
||||||
>
|
>
|
||||||
<FileConfiguration
|
</File>
|
||||||
Name="Release|Win32"
|
<File
|
||||||
>
|
RelativePath=".\ax.cpp"
|
||||||
<Tool
|
>
|
||||||
Name="VCCLCompilerTool"
|
</File>
|
||||||
PreprocessorDefinitions=""
|
<File
|
||||||
/>
|
RelativePath=".\BrowserCallHandler.cpp"
|
||||||
</FileConfiguration>
|
>
|
||||||
<FileConfiguration
|
</File>
|
||||||
Name="Debug|Win32"
|
<File
|
||||||
>
|
RelativePath=".\ButtonListener.cpp"
|
||||||
<Tool
|
>
|
||||||
Name="VCCLCompilerTool"
|
</File>
|
||||||
PreprocessorDefinitions=""
|
<File
|
||||||
/>
|
RelativePath=".\CameraController.cpp"
|
||||||
</FileConfiguration>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\PhysicalInstance.cpp"
|
RelativePath=".\ErrorFunctions.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
<File
|
||||||
<Filter
|
RelativePath=".\Globals.cpp"
|
||||||
Name="Header Files"
|
>
|
||||||
Filter="h;hpp;hxx;hm;inl"
|
</File>
|
||||||
>
|
<File
|
||||||
<File
|
RelativePath=".\GroupInstance.cpp"
|
||||||
RelativePath=".\Instance.h"
|
>
|
||||||
>
|
</File>
|
||||||
</File>
|
<File
|
||||||
<File
|
RelativePath=".\GuiRoot.cpp"
|
||||||
RelativePath=".\PhysicalInstance.h"
|
>
|
||||||
>
|
</File>
|
||||||
</File>
|
<File
|
||||||
<File
|
RelativePath=".\IEBrowser.cpp"
|
||||||
RelativePath=".\resource.h"
|
>
|
||||||
>
|
</File>
|
||||||
</File>
|
<File
|
||||||
</Filter>
|
RelativePath=".\IEDispatcher.cpp"
|
||||||
<Filter
|
>
|
||||||
Name="Resource Files"
|
</File>
|
||||||
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
<File
|
||||||
>
|
RelativePath="main.cpp"
|
||||||
</Filter>
|
>
|
||||||
</Files>
|
<FileConfiguration
|
||||||
<Globals>
|
Name="Release|Win32"
|
||||||
</Globals>
|
>
|
||||||
</VisualStudioProject>
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\propertyGrid.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\PropertyWindow.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\StringFunctions.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\WindowFunctions.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<Filter
|
||||||
|
Name="Instance"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath=".\BaseButtonInstance.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\DataModelInstance.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ImageButtonInstance.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Instance.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\LevelInstance.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\PartInstance.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\PVInstance.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\TextButtonInstance.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\WorkspaceInstance.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Listeners"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath=".\CameraButtonListener.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\DeleteListener.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\GUDButtonListener.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ModeSelectionListener.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\RotateButtonListener.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Header Files"
|
||||||
|
Filter="h;hpp;hxx;hm;inl"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Application.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\AudioPlayer.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ax.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\BrowserCallHandler.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\CameraController.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Demo.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Enum.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Enums.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ErrorFunctions.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Globals.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\GuiRoot.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\IEBrowser.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\IEDispatcher.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\LevelInstance.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\propertyGrid.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\PropertyWindow.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\rapidxml\rapidxml.hpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\rapidxml\rapidxml_iterators.hpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\rapidxml\rapidxml_print.hpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\rapidxml\rapidxml_utils.hpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\resource.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\RotateButtonListener.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\StringFunctions.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\win32Defines.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\WindowFunctions.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<Filter
|
||||||
|
Name="Instance"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath=".\BaseButtonInstance.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\DataModelInstance.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\GroupInstance.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ImageButtonInstance.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Instance.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\PartInstance.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\PVInstance.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\TextButtonInstance.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\WorkspaceInstance.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Listeners"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ButtonListener.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\CameraButtonListener.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\DeleteListener.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\GUDButtonListener.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ModeSelectionListener.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Resource Files"
|
||||||
|
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Dialogs.rc"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\icon1.ico"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Parts.bmp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
</Files>
|
||||||
|
<Globals>
|
||||||
|
<Global
|
||||||
|
Name="RESOURCE_FILE"
|
||||||
|
Value="Dialogs.rc"
|
||||||
|
/>
|
||||||
|
</Globals>
|
||||||
|
</VisualStudioProject>
|
||||||
|
|||||||
40
GUDButtonListener.cpp
Normal file
40
GUDButtonListener.cpp
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
#include <G3DAll.h>
|
||||||
|
#include "Application.h"
|
||||||
|
#include "Globals.h"
|
||||||
|
#include "AudioPlayer.h"
|
||||||
|
#include "GUDButtonListener.h"
|
||||||
|
|
||||||
|
void GUDButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
||||||
|
{
|
||||||
|
bool cont = false;
|
||||||
|
for(size_t i = 0; i < g_selectedInstances.size(); i++)
|
||||||
|
if(g_selectedInstances.at(i)->canDelete)
|
||||||
|
{
|
||||||
|
cont = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(cont)
|
||||||
|
{
|
||||||
|
AudioPlayer::playSound(dingSound);
|
||||||
|
if(button->name == "Duplicate")
|
||||||
|
{
|
||||||
|
std::vector<Instance*> newinst;
|
||||||
|
for(size_t i = 0; i < g_selectedInstances.size(); i++)
|
||||||
|
{
|
||||||
|
if(g_selectedInstances.at(i)->canDelete)
|
||||||
|
{
|
||||||
|
Instance* tempinst = g_selectedInstances.at(i);
|
||||||
|
|
||||||
|
Instance* clonedInstance = g_selectedInstances.at(i)->clone();
|
||||||
|
|
||||||
|
newinst.push_back(tempinst);
|
||||||
|
}
|
||||||
|
/*tempinst->setPosition(Vector3(tempPos.x, tempPos.y + tempSize.y, tempPos.z));
|
||||||
|
g_usableApp->cameraController.centerCamera(g_selectedInstances.at(0));*/
|
||||||
|
}
|
||||||
|
g_selectedInstances = newinst;
|
||||||
|
if(g_selectedInstances.size() > 0)
|
||||||
|
g_usableApp->_propWindow->UpdateSelected(newinst.at(0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
7
GUDButtonListener.h
Normal file
7
GUDButtonListener.h
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "ButtonListener.h"
|
||||||
|
|
||||||
|
class GUDButtonListener : public ButtonListener {
|
||||||
|
public:
|
||||||
|
void onButton1MouseClick(BaseButtonInstance*);
|
||||||
|
};
|
||||||
31
Globals.cpp
Normal file
31
Globals.cpp
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
#include "Globals.h"
|
||||||
|
#include "Application.h"
|
||||||
|
|
||||||
|
int const Globals::gen = 0;
|
||||||
|
int const Globals::major = 0;
|
||||||
|
int const Globals::minor = 4;
|
||||||
|
int const Globals::patch = 2;
|
||||||
|
int Globals::surfaceId = 2;
|
||||||
|
bool Globals::showMouse = true;
|
||||||
|
bool Globals::useMousePoint = false;
|
||||||
|
std::vector<Instance*> postRenderStack = std::vector<Instance*>();
|
||||||
|
|
||||||
|
std::vector<Instance*> g_selectedInstances = std::vector<Instance*>();
|
||||||
|
DataModelInstance* g_dataModel = NULL;
|
||||||
|
|
||||||
|
bool running = false;
|
||||||
|
G3D::TextureRef Globals::surface;
|
||||||
|
POINT Globals::mousepoint;
|
||||||
|
|
||||||
|
GFontRef g_fntdominant = NULL;
|
||||||
|
GFontRef g_fntlighttrek = NULL;
|
||||||
|
|
||||||
|
Globals::Globals(void){}
|
||||||
|
|
||||||
|
Globals::~Globals(void){}
|
||||||
|
|
||||||
|
std::string cameraSound="";
|
||||||
|
std::string clickSound="";
|
||||||
|
std::string dingSound="";
|
||||||
|
|
||||||
|
Application *g_usableApp = NULL;
|
||||||
37
Globals.h
Normal file
37
Globals.h
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "DataModelInstance.h"
|
||||||
|
#include <G3DAll.h>
|
||||||
|
|
||||||
|
class Application;
|
||||||
|
|
||||||
|
class Globals
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Globals(void);
|
||||||
|
~Globals(void);
|
||||||
|
static DataModelInstance* dataModel;
|
||||||
|
static bool showMouse;
|
||||||
|
static POINT mousepoint;
|
||||||
|
static bool useMousePoint;
|
||||||
|
static const int gen;
|
||||||
|
static const int major;
|
||||||
|
static const int minor;
|
||||||
|
static const int patch;
|
||||||
|
static G3D::TextureRef surface;
|
||||||
|
static int surfaceId;
|
||||||
|
static const std::string g_PlaceholderName;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern std::vector<Instance*> postRenderStack;
|
||||||
|
extern std::vector<Instance*> g_selectedInstances;
|
||||||
|
extern bool running;
|
||||||
|
extern DataModelInstance* g_dataModel;
|
||||||
|
extern Application* g_usableApp;
|
||||||
|
|
||||||
|
extern GFontRef g_fntdominant;
|
||||||
|
extern GFontRef g_fntlighttrek;
|
||||||
|
|
||||||
|
extern std::string cameraSound;
|
||||||
|
extern std::string clickSound;
|
||||||
|
extern std::string dingSound;
|
||||||
|
const std::string g_PlaceholderName = "HyperCube";
|
||||||
30
GroupInstance.cpp
Normal file
30
GroupInstance.cpp
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
#include "GroupInstance.h"
|
||||||
|
|
||||||
|
GroupInstance::GroupInstance(void)
|
||||||
|
{
|
||||||
|
PVInstance::PVInstance();
|
||||||
|
className = "GroupInstance";
|
||||||
|
listicon = 12;
|
||||||
|
}
|
||||||
|
|
||||||
|
GroupInstance::GroupInstance(const GroupInstance &oinst)
|
||||||
|
{
|
||||||
|
PVInstance::PVInstance(oinst);
|
||||||
|
listicon = 12;
|
||||||
|
}
|
||||||
|
|
||||||
|
GroupInstance::~GroupInstance(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
std::vector<PROPGRIDITEM> GroupInstance::getProperties()
|
||||||
|
{
|
||||||
|
std::vector<PROPGRIDITEM> properties = PVInstance::getProperties();
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
void GroupInstance::PropUpdate(LPPROPGRIDITEM &pItem)
|
||||||
|
{
|
||||||
|
PVInstance::PropUpdate(pItem);
|
||||||
|
}
|
||||||
14
GroupInstance.h
Normal file
14
GroupInstance.h
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "PVInstance.h"
|
||||||
|
|
||||||
|
class GroupInstance :
|
||||||
|
public PVInstance
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GroupInstance(void);
|
||||||
|
~GroupInstance(void);
|
||||||
|
GroupInstance(const GroupInstance &oinst);
|
||||||
|
virtual std::vector<PROPGRIDITEM> getProperties();
|
||||||
|
virtual void PropUpdate(LPPROPGRIDITEM &pItem);
|
||||||
|
|
||||||
|
};
|
||||||
491
GuiRoot.cpp
Normal file
491
GuiRoot.cpp
Normal file
@@ -0,0 +1,491 @@
|
|||||||
|
#include <iomanip>
|
||||||
|
#include <sstream>
|
||||||
|
#include "G3DAll.h"
|
||||||
|
#include "BaseButtonInstance.h"
|
||||||
|
#include "TextButtonInstance.h"
|
||||||
|
#include "ImageButtonInstance.h"
|
||||||
|
#include "GuiRoot.h"
|
||||||
|
#include "Globals.h"
|
||||||
|
#include "StringFunctions.h"
|
||||||
|
|
||||||
|
#include "GUDButtonListener.h"
|
||||||
|
#include "ModeSelectionListener.h"
|
||||||
|
#include "RotateButtonListener.h"
|
||||||
|
#include "CameraButtonListener.h"
|
||||||
|
#include "DeleteListener.h"
|
||||||
|
|
||||||
|
#include "ImageButtonInstance.h"
|
||||||
|
|
||||||
|
ImageButtonInstance* GuiRoot::makeImageButton(G3D::TextureRef newImage = NULL, G3D::TextureRef overImage = NULL, G3D::TextureRef downImage = NULL, G3D::TextureRef disableImage = NULL)
|
||||||
|
{
|
||||||
|
ImageButtonInstance* part = new ImageButtonInstance(newImage,overImage, downImage, disableImage);
|
||||||
|
// instances.push_back(part);
|
||||||
|
// instances_2D.push_back(part);
|
||||||
|
return part;
|
||||||
|
}
|
||||||
|
|
||||||
|
TextButtonInstance* GuiRoot::makeTextButton()
|
||||||
|
{
|
||||||
|
TextButtonInstance* part = new TextButtonInstance();
|
||||||
|
return part;
|
||||||
|
}
|
||||||
|
|
||||||
|
GuiRoot::GuiRoot() : _message(""), _messageTime(0)
|
||||||
|
{
|
||||||
|
g_fntdominant = GFont::fromFile(GetFileInPath("/content/font/dominant.fnt"));
|
||||||
|
g_fntlighttrek = GFont::fromFile(GetFileInPath("/content/font/lighttrek.fnt"));
|
||||||
|
|
||||||
|
TextButtonInstance* button = makeTextButton();
|
||||||
|
button->boxBegin = Vector2(0, -24);
|
||||||
|
button->boxEnd = Vector2(80, 0);
|
||||||
|
button->floatBottom = true;
|
||||||
|
button->setParent(this);
|
||||||
|
button->font = g_fntlighttrek;
|
||||||
|
button->textColor = Color3(0,255,255);
|
||||||
|
button->textOutlineColor = Color4::clear();
|
||||||
|
button->title = "Hopper";
|
||||||
|
button->fontLocationRelativeTo = Vector2(10, 3);
|
||||||
|
button->setAllColorsSame();
|
||||||
|
|
||||||
|
button = makeTextButton();
|
||||||
|
button->boxBegin = Vector2(0, -48);
|
||||||
|
button->boxEnd = Vector2(80, -24);
|
||||||
|
button->floatBottom = true;
|
||||||
|
button->setParent(this);
|
||||||
|
button->font = g_fntlighttrek;
|
||||||
|
button->textColor = Color3(0,255,255);
|
||||||
|
button->textOutlineColor = Color4::clear();
|
||||||
|
button->title = "Controller";
|
||||||
|
button->fontLocationRelativeTo = Vector2(10, 3);
|
||||||
|
button->setAllColorsSame();
|
||||||
|
|
||||||
|
button = makeTextButton();
|
||||||
|
button->boxBegin = Vector2(0, -72);
|
||||||
|
button->boxEnd = Vector2(80, -48);
|
||||||
|
button->floatBottom = true;
|
||||||
|
button->setParent(this);
|
||||||
|
button->font = g_fntlighttrek;
|
||||||
|
button->textColor = Color3(0,255,255);
|
||||||
|
button->textOutlineColor = Color4::clear();
|
||||||
|
button->title = "Color";
|
||||||
|
button->fontLocationRelativeTo = Vector2(10, 3);
|
||||||
|
button->setAllColorsSame();
|
||||||
|
|
||||||
|
button = makeTextButton();
|
||||||
|
button->boxBegin = Vector2(0, -96);
|
||||||
|
button->boxEnd = Vector2(80, -72);
|
||||||
|
button->floatBottom = true;
|
||||||
|
button->setParent(this);
|
||||||
|
button->font = g_fntlighttrek;
|
||||||
|
button->textColor = Color3(0,255,255);
|
||||||
|
button->textOutlineColor = Color4::clear();
|
||||||
|
button->title = "Surface";
|
||||||
|
button->fontLocationRelativeTo = Vector2(10, 3);
|
||||||
|
button->setAllColorsSame();
|
||||||
|
|
||||||
|
button = makeTextButton();
|
||||||
|
button->boxBegin = Vector2(0, -120);
|
||||||
|
button->boxEnd = Vector2(80, -96);
|
||||||
|
button->floatBottom = true;
|
||||||
|
button->setParent(this);
|
||||||
|
button->font = g_fntlighttrek;
|
||||||
|
button->textColor = Color3(0,255,255);
|
||||||
|
button->boxOutlineColor = Color3(0,255,255);
|
||||||
|
button->title = "Model";
|
||||||
|
button->fontLocationRelativeTo = Vector2(10, 3);
|
||||||
|
button->setAllColorsSame();
|
||||||
|
|
||||||
|
button = makeTextButton();
|
||||||
|
button->boxBegin = Vector2(0, 0);
|
||||||
|
button->boxEnd = Vector2(125, 25);
|
||||||
|
button->setParent(this);
|
||||||
|
button->font = g_fntlighttrek;
|
||||||
|
button->textColor = Color3::white();
|
||||||
|
button->boxColor = Color4::clear();
|
||||||
|
button->textOutlineColor = Color4(0.5F,0.5F,0.5F,0.5F);
|
||||||
|
button->title = "File";
|
||||||
|
button->textSize = 16;
|
||||||
|
button->fontLocationRelativeTo = Vector2(10, 0);
|
||||||
|
button->setAllColorsSame();
|
||||||
|
|
||||||
|
button = makeTextButton();
|
||||||
|
button->boxBegin = Vector2(125, 0);
|
||||||
|
button->boxEnd = Vector2(250, 25);
|
||||||
|
button->setParent(this);
|
||||||
|
button->font = g_fntlighttrek;
|
||||||
|
button->textColor = Color3::white();
|
||||||
|
button->boxColor = Color4::clear();
|
||||||
|
button->textOutlineColor = Color4(0.5F,0.5F,0.5F,0.5F);
|
||||||
|
button->title = "Edit";
|
||||||
|
button->textSize = 16;
|
||||||
|
button->fontLocationRelativeTo = Vector2(10, 0);
|
||||||
|
button->setAllColorsSame();
|
||||||
|
|
||||||
|
button = makeTextButton();
|
||||||
|
button->boxBegin = Vector2(250, 0);
|
||||||
|
button->boxEnd = Vector2(375, 25);
|
||||||
|
button->setParent(this);
|
||||||
|
button->font = g_fntlighttrek;
|
||||||
|
button->textColor = Color3::white();
|
||||||
|
button->boxColor = Color4::clear();
|
||||||
|
button->textOutlineColor = Color4(0.5F,0.5F,0.5F,0.5F);
|
||||||
|
button->title = "View";
|
||||||
|
button->textSize = 16;
|
||||||
|
button->fontLocationRelativeTo = Vector2(10, 0);
|
||||||
|
button->setAllColorsSame();
|
||||||
|
|
||||||
|
button = makeTextButton();
|
||||||
|
button->boxBegin = Vector2(375, 0);
|
||||||
|
button->boxEnd = Vector2(500, 25);
|
||||||
|
button->setParent(this);
|
||||||
|
button->font = g_fntlighttrek;
|
||||||
|
button->textColor = Color3::white();
|
||||||
|
button->boxColor = Color4::clear();
|
||||||
|
button->textOutlineColor = Color4(0.5F,0.5F,0.5F,0.5F);
|
||||||
|
button->title = "Insert";
|
||||||
|
button->textSize = 16;
|
||||||
|
button->fontLocationRelativeTo = Vector2(10, 0);
|
||||||
|
button->setAllColorsSame();
|
||||||
|
|
||||||
|
button = makeTextButton();
|
||||||
|
button->boxBegin = Vector2(500, 0);
|
||||||
|
button->boxEnd = Vector2(625, 25);
|
||||||
|
button->setParent(this);
|
||||||
|
button->font = g_fntlighttrek;
|
||||||
|
button->textColor = Color3::white();
|
||||||
|
button->boxColor = Color4::clear();
|
||||||
|
button->textOutlineColor = Color4(0.5F,0.5F,0.5F,0.5F);
|
||||||
|
button->title = "Format";
|
||||||
|
button->textSize = 16;
|
||||||
|
button->fontLocationRelativeTo = Vector2(10, 0);
|
||||||
|
button->setAllColorsSame();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
button = makeTextButton();
|
||||||
|
button->boxBegin = Vector2(0,215);
|
||||||
|
button->boxEnd = Vector2(80,235);
|
||||||
|
button->textOutlineColor = Color4(0.5F,0.5F,0.5F,0.5F);
|
||||||
|
button->textColor = Color3::white();
|
||||||
|
button->boxColor = Color4::clear();
|
||||||
|
button->textSize = 12;
|
||||||
|
button->title = "Group";
|
||||||
|
button->name = "Group";
|
||||||
|
button->setAllColorsSame();
|
||||||
|
button->textColorDis = Color3(0.8F,0.8F,0.8F);
|
||||||
|
button->font = g_fntlighttrek;
|
||||||
|
button->fontLocationRelativeTo = Vector2(10, 0);
|
||||||
|
button->setParent(this);
|
||||||
|
|
||||||
|
|
||||||
|
button = makeTextButton();
|
||||||
|
button->boxBegin = Vector2(0,240);
|
||||||
|
button->boxEnd = Vector2(80,260);
|
||||||
|
button->textOutlineColor = Color4(0.5F,0.5F,0.5F,0.5F);
|
||||||
|
button->textColor = Color3::white();
|
||||||
|
button->boxColor = Color4::clear();
|
||||||
|
button->textSize = 12;
|
||||||
|
button->title = "UnGroup";
|
||||||
|
button->name = "UnGroup";
|
||||||
|
button->setAllColorsSame();
|
||||||
|
button->textColorDis = Color3(0.8F,0.8F,0.8F);
|
||||||
|
button->font = g_fntlighttrek;
|
||||||
|
button->fontLocationRelativeTo = Vector2(10, 0);
|
||||||
|
button->setParent(this);
|
||||||
|
|
||||||
|
button = makeTextButton();
|
||||||
|
button->boxBegin = Vector2(0,265);
|
||||||
|
button->boxEnd = Vector2(80,285);
|
||||||
|
button->textOutlineColor = Color4(0.5F,0.5F,0.5F,0.5F);
|
||||||
|
button->textColor = Color3::white();
|
||||||
|
button->boxColor = Color4::clear();
|
||||||
|
button->textSize = 12;
|
||||||
|
button->title = "Duplicate";
|
||||||
|
button->setAllColorsSame();
|
||||||
|
button->textColorDis = Color3(0.8F,0.8F,0.8F);
|
||||||
|
button->font = g_fntlighttrek;
|
||||||
|
button->fontLocationRelativeTo = Vector2(10, 0);
|
||||||
|
button->setParent(this);
|
||||||
|
button->name = "Duplicate";
|
||||||
|
button->setButtonListener(new GUDButtonListener());
|
||||||
|
|
||||||
|
ImageButtonInstance* instance = makeImageButton(
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/Run.png")),
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/Run_ovr.png")),
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/Run_dn.png")));
|
||||||
|
instance->name = "go";
|
||||||
|
instance->size = Vector2(65,65);
|
||||||
|
instance->position = Vector2(6.5, 25);
|
||||||
|
instance->setParent(this);
|
||||||
|
|
||||||
|
|
||||||
|
instance = makeImageButton(
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/ArrowTool.png")),
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/ArrowTool_ovr.png")),
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/ArrowTool_dn.png")),
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/ArrowTool_ds.png")));
|
||||||
|
instance->size = Vector2(50,50);
|
||||||
|
instance->position = Vector2(15, 90);
|
||||||
|
instance->setParent(this);
|
||||||
|
instance->name = "Cursor";
|
||||||
|
instance->setButtonListener(new ModeSelectionListener());
|
||||||
|
|
||||||
|
instance = makeImageButton(Texture::fromFile(GetFileInPath("/content/images/ScaleTool.png")),Texture::fromFile(GetFileInPath("/content/images/ScaleTool_ovr.png")),Texture::fromFile(GetFileInPath("/content/images/ScaleTool_dn.png")),Texture::fromFile(GetFileInPath("/content/images/ScaleTool_ds.png")));
|
||||||
|
instance->size = Vector2(40,40);
|
||||||
|
instance->position = Vector2(0, 140);
|
||||||
|
instance->setParent(this);
|
||||||
|
instance->name = "Resize";
|
||||||
|
instance->setButtonListener(new ModeSelectionListener());
|
||||||
|
|
||||||
|
|
||||||
|
instance = makeImageButton(
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/MoveTool.png")),
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/MoveTool_ovr.png")),
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/MoveTool_dn.png")),
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/MoveTool_ds.png")));
|
||||||
|
instance->size = Vector2(40,40);
|
||||||
|
instance->position = Vector2(40, 140);
|
||||||
|
instance->setParent(this);
|
||||||
|
instance->name = "Arrows";
|
||||||
|
instance->setButtonListener(new ModeSelectionListener());
|
||||||
|
|
||||||
|
instance = makeImageButton(
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/SelectionRotate.png")),
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/SelectionRotate_ovr.png")),
|
||||||
|
NULL,
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/SelectionRotate_ds.png")));
|
||||||
|
instance->size = Vector2(30,30);
|
||||||
|
instance->position = Vector2(10, 175);
|
||||||
|
instance->setParent(this);
|
||||||
|
instance->name = "Rotate";
|
||||||
|
instance->setButtonListener(new RotateButtonListener());
|
||||||
|
|
||||||
|
instance = makeImageButton(
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/SelectionTilt.png")),
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/SelectionTilt_ovr.png")),
|
||||||
|
NULL,
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/SelectionTilt_ds.png")));
|
||||||
|
instance->size = Vector2(30,30);
|
||||||
|
instance->position = Vector2(40, 175);
|
||||||
|
instance->setParent(this);
|
||||||
|
instance->name = "Tilt";
|
||||||
|
instance->setButtonListener(new RotateButtonListener());
|
||||||
|
|
||||||
|
|
||||||
|
instance = makeImageButton(
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/Delete.png")),
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/Delete_ovr.png")),
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/Delete_dn.png")),
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/Delete_ds.png")));
|
||||||
|
instance->size = Vector2(40,46);
|
||||||
|
instance->position = Vector2(20, 284);
|
||||||
|
instance->setParent(this);
|
||||||
|
instance->name = "Delete";
|
||||||
|
instance->setButtonListener(new DeleteListener());
|
||||||
|
|
||||||
|
instance = makeImageButton(
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/CameraZoomIn.png")),
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/CameraZoomIn_ovr.png")),
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/CameraZoomIn_dn.png")));
|
||||||
|
instance->size = Vector2(34,25);
|
||||||
|
instance->floatBottom = true;
|
||||||
|
instance->floatRight = true;
|
||||||
|
instance->position = Vector2(-77, -90);
|
||||||
|
instance->setParent(this);
|
||||||
|
instance->name = "ZoomIn";
|
||||||
|
instance->setButtonListener(new CameraButtonListener());
|
||||||
|
|
||||||
|
instance = makeImageButton(
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/CameraZoomOut.png")),
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/CameraZoomOut_ovr.png")),
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/CameraZoomOut_dn.png")));
|
||||||
|
instance->size = Vector2(34,26);
|
||||||
|
instance->floatBottom = true;
|
||||||
|
instance->floatRight = true;
|
||||||
|
instance->position = Vector2(-77, -31);
|
||||||
|
instance->setParent(this);
|
||||||
|
instance->name = "ZoomOut";
|
||||||
|
instance->setButtonListener(new CameraButtonListener());
|
||||||
|
|
||||||
|
instance = makeImageButton(
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/CameraPanLeft.png")),
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/CameraPanLeft_ovr.png")),
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/CameraPanLeft_dn.png")));
|
||||||
|
instance->size = Vector2(34,34);
|
||||||
|
instance->floatBottom = true;
|
||||||
|
instance->floatRight = true;
|
||||||
|
instance->position = Vector2(-110, -50);
|
||||||
|
instance->setParent(this);
|
||||||
|
instance->name = "PanLeft";
|
||||||
|
instance->setButtonListener(new CameraButtonListener());
|
||||||
|
|
||||||
|
instance = makeImageButton(
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/CameraPanRight.png")),
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/CameraPanRight_ovr.png")),
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/CameraPanRight_dn.png")));
|
||||||
|
instance->size = Vector2(34,34);
|
||||||
|
instance->floatBottom = true;
|
||||||
|
instance->floatRight = true;
|
||||||
|
instance->position = Vector2(-45, -50);
|
||||||
|
instance->setParent(this);
|
||||||
|
instance->name = "PanRight";
|
||||||
|
instance->setButtonListener(new CameraButtonListener());
|
||||||
|
|
||||||
|
instance = makeImageButton(
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/CameraCenter.png")),
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/CameraCenter_ovr.png")),
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/CameraCenter_dn.png")));
|
||||||
|
instance->size = Vector2(34,20);
|
||||||
|
instance->floatBottom = true;
|
||||||
|
instance->floatRight = true;
|
||||||
|
instance->position = Vector2(-77, -60);
|
||||||
|
instance->setParent(this);
|
||||||
|
instance->name = "CenterCam";
|
||||||
|
instance->setButtonListener(new CameraButtonListener());
|
||||||
|
|
||||||
|
instance = makeImageButton(
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/CameraTiltUp.png")),
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/CameraTiltUp_ovr.png")),
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/CameraTiltUp_dn.png")));
|
||||||
|
instance->size = Vector2(24,24);
|
||||||
|
instance->floatBottom = true;
|
||||||
|
instance->floatRight = true;
|
||||||
|
instance->position = Vector2(-105, -75);
|
||||||
|
instance->setParent(this);
|
||||||
|
instance->name = "TiltUp";
|
||||||
|
instance->setButtonListener(new CameraButtonListener());
|
||||||
|
|
||||||
|
instance = makeImageButton(
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/CameraTiltDown.png")),
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/CameraTiltDown_ovr.png")),
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/CameraTiltDown_dn.png")));
|
||||||
|
instance->size = Vector2(24,24);
|
||||||
|
instance->floatBottom = true;
|
||||||
|
instance->floatRight = true;
|
||||||
|
instance->position = Vector2(-40, -75);
|
||||||
|
instance->setParent(this);
|
||||||
|
instance->name = "TiltDown";
|
||||||
|
instance->setButtonListener(new CameraButtonListener());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiRoot::drawButtons(RenderDevice* rd)
|
||||||
|
{
|
||||||
|
rd->pushState();
|
||||||
|
rd->beforePrimitive();
|
||||||
|
this->render(rd);
|
||||||
|
rd->afterPrimitive();
|
||||||
|
rd->popState();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiRoot::setDebugMessage(std::string msg, G3D::RealTime msgTime)
|
||||||
|
{
|
||||||
|
_messageTime = msgTime;
|
||||||
|
_message = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
//void GuiRoot::render(G3D::RenderDevice* renderDevice) {}
|
||||||
|
|
||||||
|
void GuiRoot::renderGUI(G3D::RenderDevice* rd, double fps)
|
||||||
|
{
|
||||||
|
//TODO--Move these to their own instance
|
||||||
|
|
||||||
|
std::stringstream stream;
|
||||||
|
stream << std::fixed << std::setprecision(1) << g_dataModel->getLevel()->timer;
|
||||||
|
g_fntdominant->draw2D(rd, "Timer: " + stream.str(), Vector2(rd->getWidth() - 120, 25), 20, Color3::fromARGB(0x81C518), Color3::black());
|
||||||
|
g_fntdominant->draw2D(rd, "Score: " + Convert(g_dataModel->getLevel()->score), Vector2(rd->getWidth() - 120, 50), 20, Color3::fromARGB(0x81C518), Color3::black());
|
||||||
|
//FPS
|
||||||
|
#ifdef _DEBUG
|
||||||
|
stream.str("");
|
||||||
|
stream.clear();
|
||||||
|
stream << std::fixed << std::setprecision(3) << fps;
|
||||||
|
g_fntdominant->draw2D(rd, "FPS: " + stream.str(), Vector2(120, 25), 10, Color3::fromARGB(0xFFFF00), Color3::black());
|
||||||
|
#endif
|
||||||
|
//GUI Boxes
|
||||||
|
Draw::box(G3D::Box(Vector3(0,25,0),Vector3(80,355,0)),rd,Color4(0.6F,0.6F,0.6F,0.4F), Color4(0,0,0,0));
|
||||||
|
Draw::box(G3D::Box(Vector3(rd->getWidth() - 120,rd->getHeight() - 120,0),Vector3(rd->getWidth(),rd->getHeight(),0)),rd,Color4(0.6F,0.6F,0.6F,0.4F), Color4(0,0,0,0));
|
||||||
|
|
||||||
|
//Camera menu title
|
||||||
|
g_fntlighttrek->draw2D(rd, "CameraMenu", Vector2(rd->getWidth()-(g_fntlighttrek->get2DStringBounds("CameraMenu", 14).x+1),rd->getHeight() - 120), 14, Color3::white(), Color4(0.5F,0.5F,0.5F,0.5F));
|
||||||
|
|
||||||
|
//Tools menu
|
||||||
|
Draw::box(G3D::Box(Vector3(5, 210,0),Vector3(75, 210,0)),rd,Color4(0.6F,0.6F,0.6F,0.4F), Color4(0.6F,0.6F,0.6F,0.4F));
|
||||||
|
g_fntlighttrek->draw2D(rd,"MENU", Vector2(10,332), 14, Color3::white(), Color4(0.5F,0.5F,0.5F,0.5F));
|
||||||
|
|
||||||
|
|
||||||
|
drawButtons(rd);
|
||||||
|
if(System::time() - 3 < _messageTime)
|
||||||
|
{
|
||||||
|
g_fntdominant->draw2D(rd, _message, Vector2((rd->getWidth()/2)-(g_fntdominant->get2DStringBounds(_message, 20).x/2),(rd->getHeight()/2)-(g_fntdominant->get2DStringBounds(_message, 20).y/2)), 20, Color3::yellow(), Color3::black());
|
||||||
|
}
|
||||||
|
|
||||||
|
g_dataModel->drawMessage(rd);
|
||||||
|
render(rd);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GuiRoot::mouseInGUI(G3D::RenderDevice* renderDevice,int x,int y)
|
||||||
|
{
|
||||||
|
std::vector<Instance*> instances_2D = g_dataModel->getGuiRoot()->getAllChildren();
|
||||||
|
for(size_t i = 0; i < instances_2D.size(); i++)
|
||||||
|
{
|
||||||
|
if(BaseButtonInstance* button = dynamic_cast<BaseButtonInstance*>(instances_2D.at(i)))
|
||||||
|
{
|
||||||
|
if(button->mouseInButton(x,y, renderDevice))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiRoot::update()
|
||||||
|
{
|
||||||
|
Instance * obj6 = this->findFirstChild("Delete");
|
||||||
|
Instance * obj = this->findFirstChild("Duplicate");
|
||||||
|
Instance * obj2 = this->findFirstChild("Group");
|
||||||
|
Instance * obj3 = this->findFirstChild("UnGroup");
|
||||||
|
Instance * obj4 = this->findFirstChild("Rotate");
|
||||||
|
Instance * obj5 = this->findFirstChild("Tilt");
|
||||||
|
if(obj != NULL && obj2 != NULL && obj3 != NULL && obj4 !=NULL && obj5 != NULL && obj6 != NULL)
|
||||||
|
{
|
||||||
|
BaseButtonInstance* button = (BaseButtonInstance*)obj;
|
||||||
|
BaseButtonInstance* button2 = (BaseButtonInstance*)obj2;
|
||||||
|
BaseButtonInstance* button3 = (BaseButtonInstance*)obj3;
|
||||||
|
BaseButtonInstance* button4 = (BaseButtonInstance*)obj4;
|
||||||
|
BaseButtonInstance* button5 = (BaseButtonInstance*)obj5;
|
||||||
|
BaseButtonInstance* button6 = (BaseButtonInstance*)obj6;
|
||||||
|
button->disabled = true;
|
||||||
|
button2->disabled = true;
|
||||||
|
button3->disabled = true;
|
||||||
|
button4->disabled = true;
|
||||||
|
button5->disabled = true;
|
||||||
|
button6->disabled = true;
|
||||||
|
for(size_t i = 0; i < g_selectedInstances.size(); i++)
|
||||||
|
if(g_selectedInstances.at(i)->canDelete)
|
||||||
|
{
|
||||||
|
button->disabled = false;
|
||||||
|
button2->disabled = false;
|
||||||
|
button3->disabled = false;
|
||||||
|
button4->disabled = false;
|
||||||
|
button5->disabled = false;
|
||||||
|
button6->disabled = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiRoot::onMouseLeftUp(G3D::RenderDevice* renderDevice, int x,int y)
|
||||||
|
{
|
||||||
|
std::vector<Instance*> instances_2D = this->getAllChildren();
|
||||||
|
for(size_t i = 0; i < instances_2D.size(); i++)
|
||||||
|
{
|
||||||
|
if(BaseButtonInstance* button = dynamic_cast<BaseButtonInstance*>(instances_2D[i]))
|
||||||
|
{
|
||||||
|
if(button->mouseInButton(x, y, renderDevice))
|
||||||
|
{
|
||||||
|
button->onMouseClick();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
23
GuiRoot.h
Normal file
23
GuiRoot.h
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "Instance.h"
|
||||||
|
|
||||||
|
class ImageButtonInstance;
|
||||||
|
|
||||||
|
class TextButtonInstance;
|
||||||
|
|
||||||
|
class GuiRoot : public Instance
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GuiRoot();
|
||||||
|
TextButtonInstance* makeTextButton();
|
||||||
|
void drawButtons(RenderDevice* rd);
|
||||||
|
ImageButtonInstance* makeImageButton(G3D::TextureRef newImage, G3D::TextureRef overImage, G3D::TextureRef downImage, G3D::TextureRef disableImage);
|
||||||
|
void renderGUI(G3D::RenderDevice* rd, double fps);
|
||||||
|
void setDebugMessage(std::string msg, G3D::RealTime msgTime);
|
||||||
|
void update();
|
||||||
|
bool mouseInGUI(G3D::RenderDevice* renderDevice,int x,int y);
|
||||||
|
void onMouseLeftUp(G3D::RenderDevice* renderDevice, int x,int y);
|
||||||
|
private:
|
||||||
|
std::string _message;
|
||||||
|
G3D::RealTime _messageTime;
|
||||||
|
};
|
||||||
105
IEBrowser.cpp
Normal file
105
IEBrowser.cpp
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
#ifndef WIN32_LEAN_AND_MEAN
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
#include "IEBrowser.h"
|
||||||
|
#include "Globals.h"
|
||||||
|
#include "ax.h"
|
||||||
|
//#include "IEDispatcher.h"
|
||||||
|
|
||||||
|
void IEBrowser::Boop(char* test)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
IEBrowser::IEBrowser(HWND attachHWnd) {
|
||||||
|
MSG messages;
|
||||||
|
while (PeekMessage (&messages, NULL, 0, 0,PM_REMOVE))
|
||||||
|
{
|
||||||
|
if (IsDialogMessage(hwnd, &messages) == 0)
|
||||||
|
{
|
||||||
|
TranslateMessage(&messages);
|
||||||
|
DispatchMessage(&messages);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
hwnd = attachHWnd;
|
||||||
|
spDocument = 0;
|
||||||
|
webBrowser = 0;
|
||||||
|
SendMessage(hwnd,AX_INPLACE,1,0);
|
||||||
|
SendMessage(hwnd,AX_QUERYINTERFACE,(WPARAM)&IID_IWebBrowser2,(LPARAM)&webBrowser);
|
||||||
|
}
|
||||||
|
|
||||||
|
IEBrowser::~IEBrowser(void) {
|
||||||
|
if (webBrowser)
|
||||||
|
{
|
||||||
|
webBrowser->Release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Something goes here
|
||||||
|
int IEBrowser::setExternal(IDispatch** ext)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IEBrowser::navigateSyncURL(wchar_t* url)
|
||||||
|
{
|
||||||
|
MSG messages;
|
||||||
|
if (webBrowser)
|
||||||
|
{
|
||||||
|
webBrowser->Navigate(url,0,0,0,0);
|
||||||
|
for (int i=1;i<1000;i++)
|
||||||
|
{
|
||||||
|
while (PeekMessage (&messages, NULL, 0, 0,PM_REMOVE))
|
||||||
|
{
|
||||||
|
if (IsDialogMessage(hwnd, &messages) == 0)
|
||||||
|
{
|
||||||
|
TranslateMessage(&messages);
|
||||||
|
DispatchMessage(&messages);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Sleep(30);
|
||||||
|
|
||||||
|
HRESULT hresult = webBrowser->get_Document(&spDocument);
|
||||||
|
if (SUCCEEDED(hresult) && (spDocument != 0))
|
||||||
|
{
|
||||||
|
|
||||||
|
IOleObject* spOleObject;
|
||||||
|
if (SUCCEEDED(spDocument->QueryInterface(IID_IOleObject,(void**)&spOleObject)))
|
||||||
|
{
|
||||||
|
IOleClientSite* spClientSite;
|
||||||
|
hresult = spOleObject->GetClientSite(&spClientSite);
|
||||||
|
if (SUCCEEDED(hresult) && spClientSite)
|
||||||
|
{
|
||||||
|
m_spDefaultDocHostUIHandler = spClientSite;
|
||||||
|
ICustomDoc* spCustomDoc;
|
||||||
|
|
||||||
|
//IEDispatcher* spIEDispatcher;
|
||||||
|
if (SUCCEEDED(m_spDefaultDocHostUIHandler->QueryInterface(IID_IDocHostUIHandler,(void**)&m_spHandler)))
|
||||||
|
{
|
||||||
|
if (SUCCEEDED(spDocument->QueryInterface(IID_ICustomDoc,(void**)&spCustomDoc)))
|
||||||
|
{
|
||||||
|
spCustomDoc->SetUIHandler(m_spHandler);
|
||||||
|
|
||||||
|
m_spHandler->GetExternal(&m_spExternal);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox(NULL,"Cannot read IWebBrowser2...",(g_PlaceholderName+" Crash").c_str(),MB_OK);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
23
IEBrowser.h
Normal file
23
IEBrowser.h
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
//#include "WindowFunctions.h"
|
||||||
|
#pragma once
|
||||||
|
#include <mshtml.h>
|
||||||
|
#include <exdisp.h>
|
||||||
|
#include <Mshtmhst.h>
|
||||||
|
|
||||||
|
class IEBrowser {
|
||||||
|
public:
|
||||||
|
IEBrowser(HWND attachHWnd);
|
||||||
|
~IEBrowser(void);
|
||||||
|
bool navigateSyncURL(wchar_t* url);
|
||||||
|
void Boop(char* test);
|
||||||
|
private:
|
||||||
|
IWebBrowser2* webBrowser;
|
||||||
|
HWND hwnd;
|
||||||
|
IDispatch* spDocument;
|
||||||
|
IHTMLDocument* spDocument2;
|
||||||
|
IDocHostUIHandler* m_spHandler;
|
||||||
|
IDispatch* m_spExternal;
|
||||||
|
IDispatch* m_newExternal;
|
||||||
|
IOleClientSite* m_spDefaultDocHostUIHandler;
|
||||||
|
int setExternal(IDispatch** ext);
|
||||||
|
};
|
||||||
39
IEDispatcher.cpp
Normal file
39
IEDispatcher.cpp
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
#include "IEDispatcher.h"
|
||||||
|
|
||||||
|
IEDispatcher::IEDispatcher(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
IEDispatcher::~IEDispatcher(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT STDMETHODCALLTYPE IEDispatcher::QueryInterface(const IID &riid, void **ppvObject)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
ULONG STDMETHODCALLTYPE IEDispatcher::AddRef()
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
ULONG STDMETHODCALLTYPE IEDispatcher::Release()
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
HRESULT STDMETHODCALLTYPE IEDispatcher::GetTypeInfoCount(UINT *pctinfo)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
HRESULT STDMETHODCALLTYPE IEDispatcher::GetTypeInfo(UINT, LCID, ITypeInfo **)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
HRESULT STDMETHODCALLTYPE IEDispatcher::GetIDsOfNames(const IID &, LPOLESTR *, UINT, LCID, DISPID *)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
HRESULT STDMETHODCALLTYPE IEDispatcher::Invoke(DISPID, const IID &, LCID, WORD, DISPPARAMS *, VARIANT *, EXCEPINFO *, UINT *)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
30
IEDispatcher.h
Normal file
30
IEDispatcher.h
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "oaidl.h"
|
||||||
|
//DEFINE_GUID(CLSID_G3d, 0xB323F8E0L, 0x2E68, 0x11D0, 0x90, 0xEA, 0x00, 0xAA, 0x00, 0x60, 0xF8, 0x6F);
|
||||||
|
|
||||||
|
/*
|
||||||
|
class IEDispatcher : public IDispatch
|
||||||
|
{
|
||||||
|
*/
|
||||||
|
|
||||||
|
EXTERN_C const IID IID_IDispatch;
|
||||||
|
|
||||||
|
#if defined(__cplusplus) && !defined(CINTERFACE)
|
||||||
|
|
||||||
|
MIDL_INTERFACE("B323F8E0-2E68-11D0-90EA-00AA0060F86F")
|
||||||
|
IEDispatcher : public IDispatch
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
IEDispatcher(void);
|
||||||
|
~IEDispatcher(void);
|
||||||
|
HRESULT STDMETHODCALLTYPE IEDispatcher::QueryInterface(const IID &riid, void **ppvObject);
|
||||||
|
ULONG STDMETHODCALLTYPE IEDispatcher::AddRef();
|
||||||
|
ULONG STDMETHODCALLTYPE IEDispatcher::Release();
|
||||||
|
HRESULT STDMETHODCALLTYPE IEDispatcher::GetTypeInfoCount(UINT *pctinfo);
|
||||||
|
HRESULT STDMETHODCALLTYPE IEDispatcher::GetTypeInfo(UINT, LCID, ITypeInfo **);
|
||||||
|
HRESULT STDMETHODCALLTYPE IEDispatcher::GetIDsOfNames(const IID &, LPOLESTR *, UINT, LCID, DISPID *);
|
||||||
|
HRESULT STDMETHODCALLTYPE IEDispatcher::Invoke(DISPID, const IID &, LCID, WORD, DISPPARAMS *, VARIANT *, EXCEPINFO *, UINT *);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
133
ImageButtonInstance.cpp
Normal file
133
ImageButtonInstance.cpp
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
#include "ImageButtonInstance.h"
|
||||||
|
|
||||||
|
ImageButtonInstance::ImageButtonInstance(G3D::TextureRef newImage, G3D::TextureRef overImage = NULL, G3D::TextureRef downImage = NULL, G3D::TextureRef disableImage = NULL)
|
||||||
|
{
|
||||||
|
BaseButtonInstance::BaseButtonInstance();
|
||||||
|
image = newImage;
|
||||||
|
openGLID = image->getOpenGLID();
|
||||||
|
image_ovr = overImage;
|
||||||
|
if(!image_ovr.isNull())
|
||||||
|
openGLID_ovr = image_ovr->getOpenGLID();
|
||||||
|
image_dn = downImage;
|
||||||
|
if(!image_dn.isNull())
|
||||||
|
openGLID_dn = image_dn->getOpenGLID();
|
||||||
|
image_ds = disableImage;
|
||||||
|
if(!image_ds.isNull())
|
||||||
|
openGLID_ds = image_ds->getOpenGLID();
|
||||||
|
Vector2 size = Vector2(0,0);
|
||||||
|
Vector2 position = Vector2(0,0);
|
||||||
|
floatCenter = false;
|
||||||
|
floatBottom = false;
|
||||||
|
floatRight = false;
|
||||||
|
disabled = false;
|
||||||
|
className = "ImageButton";
|
||||||
|
}
|
||||||
|
|
||||||
|
ImageButtonInstance::~ImageButtonInstance(void)
|
||||||
|
{
|
||||||
|
//Delete everything on destruction
|
||||||
|
image.~ReferenceCountedPointer();
|
||||||
|
delete image.getPointer();
|
||||||
|
image_ovr.~ReferenceCountedPointer();
|
||||||
|
delete image_ovr.getPointer();
|
||||||
|
image_ds.~ReferenceCountedPointer();
|
||||||
|
delete image_ds.getPointer();
|
||||||
|
image_dn.~ReferenceCountedPointer();
|
||||||
|
delete image_dn.getPointer();
|
||||||
|
image = NULL;
|
||||||
|
image_ovr = NULL;
|
||||||
|
image_ds = NULL;
|
||||||
|
image_dn = NULL;
|
||||||
|
delete listener;
|
||||||
|
listener = NULL;
|
||||||
|
selected = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ImageButtonInstance::mouseInButton(float mousex, float mousey, RenderDevice* rd)
|
||||||
|
{
|
||||||
|
Vector2 positionRelative = position;
|
||||||
|
if(floatRight && floatBottom)
|
||||||
|
{
|
||||||
|
positionRelative = Vector2(rd->getWidth() + position.x, rd->getHeight() + position.y);
|
||||||
|
}
|
||||||
|
else if(floatBottom)
|
||||||
|
{
|
||||||
|
positionRelative = Vector2(position.x, rd->getHeight() + position.y);
|
||||||
|
}
|
||||||
|
else if(floatRight)
|
||||||
|
{
|
||||||
|
positionRelative = Vector2(rd->getWidth() + position.x, position.y);
|
||||||
|
}
|
||||||
|
if(mousex >= positionRelative.x && mousey >= positionRelative.y)
|
||||||
|
{
|
||||||
|
if(mousex < positionRelative.x + size.x && mousey < positionRelative.y + size.y)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageButtonInstance::drawObj(RenderDevice* rd, Vector2 mousePos, bool mouseDown)
|
||||||
|
{
|
||||||
|
bool drawDisabledBox = false;
|
||||||
|
Vector2 positionRelative = position;
|
||||||
|
if(floatRight && floatBottom)
|
||||||
|
{
|
||||||
|
positionRelative = Vector2(rd->getWidth() + position.x, rd->getHeight() + position.y);
|
||||||
|
}
|
||||||
|
else if(floatBottom)
|
||||||
|
{
|
||||||
|
positionRelative = Vector2(position.x, rd->getHeight() + position.y);
|
||||||
|
}
|
||||||
|
else if(floatRight)
|
||||||
|
{
|
||||||
|
positionRelative = Vector2(rd->getWidth() + position.x, position.y);
|
||||||
|
}
|
||||||
|
int renderimage = openGLID;
|
||||||
|
if(selected == true && !image_dn.isNull() && !disabled)
|
||||||
|
{
|
||||||
|
renderimage = openGLID_dn;
|
||||||
|
}
|
||||||
|
else if(disabled)
|
||||||
|
{
|
||||||
|
if(!image_ds.isNull())
|
||||||
|
renderimage = openGLID_ds;
|
||||||
|
else
|
||||||
|
drawDisabledBox = true;
|
||||||
|
}
|
||||||
|
else if(mouseInArea(positionRelative.x, positionRelative.y, positionRelative.x + size.x, positionRelative.y + size.y, mousePos.x, mousePos.y))
|
||||||
|
{
|
||||||
|
if(mouseDown && !image_dn.isNull())
|
||||||
|
{
|
||||||
|
renderimage = openGLID_dn;
|
||||||
|
}
|
||||||
|
else if(!image_ovr.isNull())
|
||||||
|
{
|
||||||
|
renderimage = openGLID_ovr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
glEnable( GL_TEXTURE_2D );
|
||||||
|
glEnable(GL_BLEND);// you enable blending function
|
||||||
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
glBindTexture( GL_TEXTURE_2D, renderimage);
|
||||||
|
glBegin( GL_QUADS );
|
||||||
|
glTexCoord2d(0.0,0.0);
|
||||||
|
glVertex2f( positionRelative.x, positionRelative.y );
|
||||||
|
glTexCoord2d( 1.0,0.0 );
|
||||||
|
glVertex2f( positionRelative.x + size.x, positionRelative.y );
|
||||||
|
glTexCoord2d( 1.0,1.0 );
|
||||||
|
glVertex2f( positionRelative.x + size.x, positionRelative.y + size.y );
|
||||||
|
glTexCoord2d( 0.0,1.0 );
|
||||||
|
glVertex2f( positionRelative.x, positionRelative.y + size.y );
|
||||||
|
glEnd();
|
||||||
|
glDisable( GL_TEXTURE_2D );
|
||||||
|
|
||||||
|
if(drawDisabledBox)
|
||||||
|
{
|
||||||
|
Draw::box(Box(Vector3(positionRelative.x, positionRelative.y, 0), Vector3(positionRelative.x+size.x, positionRelative.y+size.y, 0)), rd, Color4(0.7F,0.7F,0.7F,0.3F), Color4::clear());
|
||||||
|
}
|
||||||
|
}
|
||||||
27
ImageButtonInstance.h
Normal file
27
ImageButtonInstance.h
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "BaseButtonInstance.h"
|
||||||
|
|
||||||
|
class BaseButtonInstance;
|
||||||
|
|
||||||
|
class ImageButtonInstance : public BaseButtonInstance
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//ImageButtonInstance(G3D::TextureRef);
|
||||||
|
//ImageButtonInstance(G3D::TextureRef,G3D::TextureRef);
|
||||||
|
//ImageButtonInstance(G3D::TextureRef,G3D::TextureRef,G3D::TextureRef);
|
||||||
|
ImageButtonInstance(G3D::TextureRef,G3D::TextureRef,G3D::TextureRef,G3D::TextureRef);
|
||||||
|
~ImageButtonInstance(void);
|
||||||
|
void drawObj(RenderDevice*, Vector2, bool);
|
||||||
|
Vector2 size;
|
||||||
|
Vector2 position;
|
||||||
|
|
||||||
|
G3D::TextureRef image;
|
||||||
|
int openGLID;
|
||||||
|
G3D::TextureRef image_ovr;
|
||||||
|
int openGLID_ovr;
|
||||||
|
G3D::TextureRef image_dn;
|
||||||
|
int openGLID_dn;
|
||||||
|
G3D::TextureRef image_ds;
|
||||||
|
int openGLID_ds;
|
||||||
|
bool mouseInButton(float, float, RenderDevice*);
|
||||||
|
};
|
||||||
174
Instance.cpp
174
Instance.cpp
@@ -1,21 +1,183 @@
|
|||||||
|
#define WINVER 0x0400
|
||||||
#include <G3DAll.h>
|
#include <G3DAll.h>
|
||||||
#include "Instance.h"
|
#include "Instance.h"
|
||||||
|
|
||||||
std::string name;
|
|
||||||
Instance* parent;
|
|
||||||
static std::string className = "Instance";
|
|
||||||
|
|
||||||
Instance::Instance(void)
|
Instance::Instance(void)
|
||||||
{
|
{
|
||||||
|
parent = NULL;
|
||||||
name = "Default Game Instance";
|
name = "Default Game Instance";
|
||||||
className = "Part";
|
className = "BaseInstance";
|
||||||
|
listicon = 1;
|
||||||
|
canDelete = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Instance::Instance(const Instance &oinst)
|
||||||
|
{
|
||||||
|
|
||||||
|
name = oinst.name;
|
||||||
|
className = oinst.className;
|
||||||
|
canDelete = oinst.canDelete;
|
||||||
|
listicon = oinst.listicon;
|
||||||
|
//setParent(oinst.parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void Instance::render(RenderDevice* rd)
|
||||||
|
{
|
||||||
|
for(size_t i = 0; i < children.size(); i++)
|
||||||
|
{
|
||||||
|
children[i]->render(rd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Instance::update()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
PROPGRIDITEM Instance::createPGI(LPSTR catalog, LPSTR propName, LPSTR propDesc, LPARAM curVal, INT type, TCHAR choices[])
|
||||||
|
{
|
||||||
|
PROPGRIDITEM pItem;
|
||||||
|
PropGrid_ItemInit(pItem);
|
||||||
|
pItem.lpszCatalog=catalog;
|
||||||
|
pItem.lpszPropName=propName;
|
||||||
|
pItem.lpszPropDesc=propDesc;
|
||||||
|
pItem.lpCurValue=curVal;
|
||||||
|
pItem.iItemType=type;
|
||||||
|
if(choices != NULL)
|
||||||
|
pItem.lpszzCmbItems = choices;
|
||||||
|
return pItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Instance::PropUpdate(LPPROPGRIDITEM &item)
|
||||||
|
{
|
||||||
|
if(strcmp(item->lpszPropName, "Name") == 0)
|
||||||
|
{
|
||||||
|
name = (LPSTR)item->lpCurValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<PROPGRIDITEM> Instance::getProperties()
|
||||||
|
{
|
||||||
|
std::vector<PROPGRIDITEM> properties;
|
||||||
|
|
||||||
|
|
||||||
|
properties.push_back(createPGI(
|
||||||
|
"Properties",
|
||||||
|
"Name",
|
||||||
|
"The name of this instance",
|
||||||
|
(LPARAM)name.c_str(),
|
||||||
|
PIT_EDIT
|
||||||
|
));
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Instance::~Instance(void)
|
Instance::~Instance(void)
|
||||||
{
|
{
|
||||||
name = "Default Game Instance";
|
for(size_t i = 0; i < children.size(); i++)
|
||||||
|
{
|
||||||
|
delete children.at(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Instance::setName(std::string newName)
|
||||||
|
{
|
||||||
|
name = newName;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Instance::getClassName()
|
||||||
|
{
|
||||||
|
return className;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<Instance* > Instance::getChildren()
|
||||||
|
{
|
||||||
|
return children;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<Instance* > Instance::getAllChildren()
|
||||||
|
{
|
||||||
|
if(!children.empty())
|
||||||
|
{
|
||||||
|
std::vector<Instance* > totalchildren = children;
|
||||||
|
for(size_t i = 0; i < children.size(); i++)
|
||||||
|
{
|
||||||
|
std::vector<Instance* > subchildren = children.at(i)->getAllChildren();
|
||||||
|
if(!subchildren.empty())
|
||||||
|
totalchildren.insert(totalchildren.end(), subchildren.begin(), subchildren.end());
|
||||||
|
}
|
||||||
|
return totalchildren;
|
||||||
|
}
|
||||||
|
return children;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<Instance* > Instance::compileAndGetPVVector()
|
||||||
|
{
|
||||||
|
std::vector<Instance* > totalchildren;
|
||||||
|
if(!children.empty())
|
||||||
|
{
|
||||||
|
for(size_t i = 0; i < children.size(); i++)
|
||||||
|
{
|
||||||
|
std::vector<Instance* > subchildren = children.at(i)->compileAndGetPVVector();
|
||||||
|
if(!subchildren.empty())
|
||||||
|
totalchildren.insert(totalchildren.end(), subchildren.begin(), subchildren.end());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return totalchildren;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Instance::setParent(Instance* newParent)
|
||||||
|
{
|
||||||
|
if(parent != NULL)
|
||||||
|
{
|
||||||
|
parent->removeChild(this);
|
||||||
|
}
|
||||||
|
parent = newParent;
|
||||||
|
if(newParent != NULL)
|
||||||
|
{
|
||||||
|
newParent->addChild(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Instance* Instance::getParent()
|
||||||
|
{
|
||||||
|
return parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Instance::addChild(Instance* newChild)
|
||||||
|
{
|
||||||
|
children.push_back(newChild);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Instance::clearChildren()
|
||||||
|
{
|
||||||
|
children.clear();
|
||||||
|
}
|
||||||
|
void Instance::removeChild(Instance* oldChild)
|
||||||
|
{
|
||||||
|
for(size_t i = 0; i < children.size(); i++)
|
||||||
|
{
|
||||||
|
if(children.at(i) == oldChild)
|
||||||
|
{
|
||||||
|
children.erase(children.begin() + i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Instance* Instance::findFirstChild(std::string name)
|
||||||
|
{
|
||||||
|
for(size_t i = 0; i < children.size(); i++)
|
||||||
|
{
|
||||||
|
if(children.at(i)->name.compare(name) == 0)
|
||||||
|
{
|
||||||
|
return children.at(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
29
Instance.h
29
Instance.h
@@ -1,11 +1,36 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
#include <G3DAll.h>
|
||||||
|
#include "propertyGrid.h"
|
||||||
|
|
||||||
class Instance
|
class Instance
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
bool canDelete;
|
||||||
Instance(void);
|
Instance(void);
|
||||||
~Instance(void);
|
Instance(const Instance&);
|
||||||
|
virtual ~Instance(void);
|
||||||
std::string name;
|
std::string name;
|
||||||
Instance* parent; // Another pointer.
|
virtual void render(RenderDevice*);
|
||||||
|
virtual void update();
|
||||||
|
std::string getClassName();
|
||||||
|
Instance* findFirstChild(std::string);
|
||||||
|
std::vector<Instance* > getChildren();
|
||||||
|
std::vector<Instance* > getAllChildren();
|
||||||
|
std::vector<Instance* > compileAndGetPVVector();
|
||||||
|
virtual void setParent(Instance*);
|
||||||
|
void setName(std::string newName);
|
||||||
|
void addChild(Instance*);
|
||||||
|
void removeChild(Instance*);
|
||||||
|
void clearChildren();
|
||||||
|
Instance* getParent();
|
||||||
|
virtual Instance* clone() const { return new Instance(*this); }
|
||||||
|
virtual std::vector<PROPGRIDITEM> getProperties();
|
||||||
|
virtual void PropUpdate(LPPROPGRIDITEM &pItem);
|
||||||
|
int listicon;
|
||||||
|
protected:
|
||||||
|
std::vector<Instance*> children; // All children.
|
||||||
std::string className;
|
std::string className;
|
||||||
|
Instance* parent; // Another pointer.
|
||||||
|
PROPGRIDITEM createPGI(LPSTR catalog, LPSTR propName, LPSTR propDesc, LPARAM curVal, INT type, TCHAR choices[] = NULL);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
339
LICENSE
Normal file
339
LICENSE
Normal file
@@ -0,0 +1,339 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 2, June 1991
|
||||||
|
|
||||||
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
License is intended to guarantee your freedom to share and change free
|
||||||
|
software--to make sure the software is free for all its users. This
|
||||||
|
General Public License applies to most of the Free Software
|
||||||
|
Foundation's software and to any other program whose authors commit to
|
||||||
|
using it. (Some other Free Software Foundation software is covered by
|
||||||
|
the GNU Lesser General Public License instead.) You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
this service if you wish), that you receive source code or can get it
|
||||||
|
if you want it, that you can change the software or use pieces of it
|
||||||
|
in new free programs; and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
anyone to deny you these rights or to ask you to surrender the rights.
|
||||||
|
These restrictions translate to certain responsibilities for you if you
|
||||||
|
distribute copies of the software, or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must give the recipients all the rights that
|
||||||
|
you have. You must make sure that they, too, receive or can get the
|
||||||
|
source code. And you must show them these terms so they know their
|
||||||
|
rights.
|
||||||
|
|
||||||
|
We protect your rights with two steps: (1) copyright the software, and
|
||||||
|
(2) offer you this license which gives you legal permission to copy,
|
||||||
|
distribute and/or modify the software.
|
||||||
|
|
||||||
|
Also, for each author's protection and ours, we want to make certain
|
||||||
|
that everyone understands that there is no warranty for this free
|
||||||
|
software. If the software is modified by someone else and passed on, we
|
||||||
|
want its recipients to know that what they have is not the original, so
|
||||||
|
that any problems introduced by others will not reflect on the original
|
||||||
|
authors' reputations.
|
||||||
|
|
||||||
|
Finally, any free program is threatened constantly by software
|
||||||
|
patents. We wish to avoid the danger that redistributors of a free
|
||||||
|
program will individually obtain patent licenses, in effect making the
|
||||||
|
program proprietary. To prevent this, we have made it clear that any
|
||||||
|
patent must be licensed for everyone's free use or not licensed at all.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License applies to any program or other work which contains
|
||||||
|
a notice placed by the copyright holder saying it may be distributed
|
||||||
|
under the terms of this General Public License. The "Program", below,
|
||||||
|
refers to any such program or work, and a "work based on the Program"
|
||||||
|
means either the Program or any derivative work under copyright law:
|
||||||
|
that is to say, a work containing the Program or a portion of it,
|
||||||
|
either verbatim or with modifications and/or translated into another
|
||||||
|
language. (Hereinafter, translation is included without limitation in
|
||||||
|
the term "modification".) Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running the Program is not restricted, and the output from the Program
|
||||||
|
is covered only if its contents constitute a work based on the
|
||||||
|
Program (independent of having been made by running the Program).
|
||||||
|
Whether that is true depends on what the Program does.
|
||||||
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Program's
|
||||||
|
source code as you receive it, in any medium, provided that you
|
||||||
|
conspicuously and appropriately publish on each copy an appropriate
|
||||||
|
copyright notice and disclaimer of warranty; keep intact all the
|
||||||
|
notices that refer to this License and to the absence of any warranty;
|
||||||
|
and give any other recipients of the Program a copy of this License
|
||||||
|
along with the Program.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy, and
|
||||||
|
you may at your option offer warranty protection in exchange for a fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Program or any portion
|
||||||
|
of it, thus forming a work based on the Program, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) You must cause the modified files to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
b) You must cause any work that you distribute or publish, that in
|
||||||
|
whole or in part contains or is derived from the Program or any
|
||||||
|
part thereof, to be licensed as a whole at no charge to all third
|
||||||
|
parties under the terms of this License.
|
||||||
|
|
||||||
|
c) If the modified program normally reads commands interactively
|
||||||
|
when run, you must cause it, when started running for such
|
||||||
|
interactive use in the most ordinary way, to print or display an
|
||||||
|
announcement including an appropriate copyright notice and a
|
||||||
|
notice that there is no warranty (or else, saying that you provide
|
||||||
|
a warranty) and that users may redistribute the program under
|
||||||
|
these conditions, and telling the user how to view a copy of this
|
||||||
|
License. (Exception: if the Program itself is interactive but
|
||||||
|
does not normally print such an announcement, your work based on
|
||||||
|
the Program is not required to print an announcement.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Program,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Program, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Program.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Program
|
||||||
|
with the Program (or with a work based on the Program) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may copy and distribute the Program (or a work based on it,
|
||||||
|
under Section 2) in object code or executable form under the terms of
|
||||||
|
Sections 1 and 2 above provided that you also do one of the following:
|
||||||
|
|
||||||
|
a) Accompany it with the complete corresponding machine-readable
|
||||||
|
source code, which must be distributed under the terms of Sections
|
||||||
|
1 and 2 above on a medium customarily used for software interchange; or,
|
||||||
|
|
||||||
|
b) Accompany it with a written offer, valid for at least three
|
||||||
|
years, to give any third party, for a charge no more than your
|
||||||
|
cost of physically performing source distribution, a complete
|
||||||
|
machine-readable copy of the corresponding source code, to be
|
||||||
|
distributed under the terms of Sections 1 and 2 above on a medium
|
||||||
|
customarily used for software interchange; or,
|
||||||
|
|
||||||
|
c) Accompany it with the information you received as to the offer
|
||||||
|
to distribute corresponding source code. (This alternative is
|
||||||
|
allowed only for noncommercial distribution and only if you
|
||||||
|
received the program in object code or executable form with such
|
||||||
|
an offer, in accord with Subsection b above.)
|
||||||
|
|
||||||
|
The source code for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For an executable work, complete source
|
||||||
|
code means all the source code for all modules it contains, plus any
|
||||||
|
associated interface definition files, plus the scripts used to
|
||||||
|
control compilation and installation of the executable. However, as a
|
||||||
|
special exception, the source code distributed need not include
|
||||||
|
anything that is normally distributed (in either source or binary
|
||||||
|
form) with the major components (compiler, kernel, and so on) of the
|
||||||
|
operating system on which the executable runs, unless that component
|
||||||
|
itself accompanies the executable.
|
||||||
|
|
||||||
|
If distribution of executable or object code is made by offering
|
||||||
|
access to copy from a designated place, then offering equivalent
|
||||||
|
access to copy the source code from the same place counts as
|
||||||
|
distribution of the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
4. You may not copy, modify, sublicense, or distribute the Program
|
||||||
|
except as expressly provided under this License. Any attempt
|
||||||
|
otherwise to copy, modify, sublicense or distribute the Program is
|
||||||
|
void, and will automatically terminate your rights under this License.
|
||||||
|
However, parties who have received copies, or rights, from you under
|
||||||
|
this License will not have their licenses terminated so long as such
|
||||||
|
parties remain in full compliance.
|
||||||
|
|
||||||
|
5. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Program or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Program (or any work based on the
|
||||||
|
Program), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Program or works based on it.
|
||||||
|
|
||||||
|
6. Each time you redistribute the Program (or any work based on the
|
||||||
|
Program), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute or modify the Program subject to
|
||||||
|
these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties to
|
||||||
|
this License.
|
||||||
|
|
||||||
|
7. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Program at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Program by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Program.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under
|
||||||
|
any particular circumstance, the balance of the section is intended to
|
||||||
|
apply and the section as a whole is intended to apply in other
|
||||||
|
circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system, which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
8. If the distribution and/or use of the Program is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Program under this License
|
||||||
|
may add an explicit geographical distribution limitation excluding
|
||||||
|
those countries, so that distribution is permitted only in or among
|
||||||
|
countries not thus excluded. In such case, this License incorporates
|
||||||
|
the limitation as if written in the body of this License.
|
||||||
|
|
||||||
|
9. The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program
|
||||||
|
specifies a version number of this License which applies to it and "any
|
||||||
|
later version", you have the option of following the terms and conditions
|
||||||
|
either of that version or of any later version published by the Free
|
||||||
|
Software Foundation. If the Program does not specify a version number of
|
||||||
|
this License, you may choose any version ever published by the Free Software
|
||||||
|
Foundation.
|
||||||
|
|
||||||
|
10. If you wish to incorporate parts of the Program into other free
|
||||||
|
programs whose distribution conditions are different, write to the author
|
||||||
|
to ask for permission. For software which is copyrighted by the Free
|
||||||
|
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||||
|
make exceptions for this. Our decision will be guided by the two goals
|
||||||
|
of preserving the free status of all derivatives of our free software and
|
||||||
|
of promoting the sharing and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||||
|
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||||
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||||
|
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||||
|
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||||
|
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||||
|
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||||
|
REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||||
|
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||||
|
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||||
|
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||||
|
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||||
|
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
convey the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program is interactive, make it output a short notice like this
|
||||||
|
when it starts in an interactive mode:
|
||||||
|
|
||||||
|
Gnomovision version 69, Copyright (C) year name of author
|
||||||
|
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, the commands you use may
|
||||||
|
be called something other than `show w' and `show c'; they could even be
|
||||||
|
mouse-clicks or menu items--whatever suits your program.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||||
|
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||||
|
|
||||||
|
<signature of Ty Coon>, 1 April 1989
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
This General Public License does not permit incorporating your program into
|
||||||
|
proprietary programs. If your program is a subroutine library, you may
|
||||||
|
consider it more useful to permit linking proprietary applications with the
|
||||||
|
library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License.
|
||||||
73
LevelInstance.cpp
Normal file
73
LevelInstance.cpp
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
#include "LevelInstance.h"
|
||||||
|
|
||||||
|
LevelInstance::LevelInstance(void)
|
||||||
|
{
|
||||||
|
Instance::Instance();
|
||||||
|
name = "Level";
|
||||||
|
winMessage = "You Won!";
|
||||||
|
loseMessage = "You Lost. Try Again";
|
||||||
|
timer = 60.0F;
|
||||||
|
score = 0;
|
||||||
|
canDelete = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
LevelInstance::~LevelInstance(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char timerTxt[12];
|
||||||
|
char scoreTxt[12];
|
||||||
|
std::vector<PROPGRIDITEM> LevelInstance::getProperties()
|
||||||
|
{
|
||||||
|
std::vector<PROPGRIDITEM> properties = Instance::getProperties();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
properties.push_back(createPGI("Messages",
|
||||||
|
"WinMessage",
|
||||||
|
"The message that shows when the player wins.",
|
||||||
|
(LPARAM)winMessage.c_str(),
|
||||||
|
PIT_EDIT));
|
||||||
|
properties.push_back(createPGI("Messages",
|
||||||
|
"LoseMessage",
|
||||||
|
"The message that shows when the player loses.",
|
||||||
|
(LPARAM)loseMessage.c_str(),
|
||||||
|
PIT_EDIT));
|
||||||
|
|
||||||
|
|
||||||
|
sprintf_s(timerTxt, "%g", timer);
|
||||||
|
sprintf_s(scoreTxt, "%d", score);
|
||||||
|
properties.push_back(createPGI("Gameplay",
|
||||||
|
"InitialTimerValue",
|
||||||
|
"The ammount of time in seconds the player has to complete this level.\r\n\r\nPut 0 if time is limitless.",
|
||||||
|
(LPARAM)timerTxt,
|
||||||
|
PIT_EDIT));
|
||||||
|
properties.push_back(createPGI("Gameplay",
|
||||||
|
"InitialScoreValue",
|
||||||
|
"The ammount of points the player starts with.",
|
||||||
|
(LPARAM)scoreTxt,
|
||||||
|
PIT_EDIT));
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
void LevelInstance::PropUpdate(LPPROPGRIDITEM &pItem)
|
||||||
|
{
|
||||||
|
if(strcmp(pItem->lpszPropName, "InitialTimerValue") == 0)
|
||||||
|
{
|
||||||
|
timer = atoi((LPSTR)pItem->lpCurValue);
|
||||||
|
}
|
||||||
|
if(strcmp(pItem->lpszPropName, "InitialScoreValue") == 0)
|
||||||
|
{
|
||||||
|
score = atof((LPSTR)pItem->lpCurValue);
|
||||||
|
}
|
||||||
|
if(strcmp(pItem->lpszPropName, "LoseMessage") == 0)
|
||||||
|
{
|
||||||
|
loseMessage = (LPSTR)pItem->lpCurValue;
|
||||||
|
}
|
||||||
|
if(strcmp(pItem->lpszPropName, "WinMessage") == 0)
|
||||||
|
{
|
||||||
|
winMessage = (LPSTR)pItem->lpCurValue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Instance::PropUpdate(pItem);
|
||||||
|
}
|
||||||
16
LevelInstance.h
Normal file
16
LevelInstance.h
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "instance.h"
|
||||||
|
|
||||||
|
class LevelInstance :
|
||||||
|
public Instance
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LevelInstance(void);
|
||||||
|
~LevelInstance(void);
|
||||||
|
float timer;
|
||||||
|
int score;
|
||||||
|
virtual std::vector<PROPGRIDITEM> getProperties();
|
||||||
|
std::string winMessage;
|
||||||
|
std::string loseMessage;
|
||||||
|
virtual void PropUpdate(LPPROPGRIDITEM &pItem);
|
||||||
|
};
|
||||||
28
ModeSelectionListener.cpp
Normal file
28
ModeSelectionListener.cpp
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
#include "Globals.h"
|
||||||
|
#include "Instance.h"
|
||||||
|
#include "ModeSelectionListener.h"
|
||||||
|
#include "Application.h"
|
||||||
|
|
||||||
|
void ModeSelectionListener::onButton1MouseClick(BaseButtonInstance* button)
|
||||||
|
{
|
||||||
|
//CoordinateFrame frame = g_usableApp->g3dCamera.getCoordinateFrame();
|
||||||
|
int mode = g_usableApp->getMode();
|
||||||
|
|
||||||
|
std::vector<Instance*> instances_2D = g_dataModel->getGuiRoot()->getAllChildren();
|
||||||
|
for(size_t i = 0; i < instances_2D.size(); i++)
|
||||||
|
{
|
||||||
|
if(instances_2D.at(i)->name == "Cursor" || instances_2D.at(i)->name == "Resize" || instances_2D.at(i)->name == "Arrows")
|
||||||
|
{
|
||||||
|
BaseButtonInstance* button = (BaseButtonInstance*)instances_2D.at(i);
|
||||||
|
button->selected = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
button->selected = true;
|
||||||
|
if(button->name == "Cursor")
|
||||||
|
g_usableApp->setMode(CURSOR);
|
||||||
|
else if(button->name == "Resize")
|
||||||
|
g_usableApp->setMode(RESIZE);
|
||||||
|
else if(button->name == "Arrows")
|
||||||
|
g_usableApp->setMode(ARROWS);
|
||||||
|
}
|
||||||
11
ModeSelectionListener.h
Normal file
11
ModeSelectionListener.h
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "ButtonListener.h"
|
||||||
|
|
||||||
|
#define CURSOR 0
|
||||||
|
#define ARROWS 1
|
||||||
|
#define RESIZE 2
|
||||||
|
|
||||||
|
class ModeSelectionListener : public ButtonListener {
|
||||||
|
public:
|
||||||
|
void onButton1MouseClick(BaseButtonInstance*);
|
||||||
|
};
|
||||||
80
PVInstance.cpp
Normal file
80
PVInstance.cpp
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
#include "PVInstance.h"
|
||||||
|
#include "WorkspaceInstance.h"
|
||||||
|
|
||||||
|
PVInstance::PVInstance(void)
|
||||||
|
{
|
||||||
|
Instance::Instance();
|
||||||
|
nameShown = false;
|
||||||
|
className = "PVInstance";
|
||||||
|
listicon = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PVInstance::PVInstance(const PVInstance &oinst)
|
||||||
|
{
|
||||||
|
Instance::Instance(oinst);
|
||||||
|
}
|
||||||
|
|
||||||
|
PVInstance::~PVInstance(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void PVInstance::postRender(RenderDevice* rd)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void PVInstance::render(RenderDevice* rd)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void PVInstance::setParent(Instance* newParent)
|
||||||
|
{
|
||||||
|
if(parent != NULL)
|
||||||
|
{
|
||||||
|
Instance* workspace = parent;
|
||||||
|
while(workspace != NULL)
|
||||||
|
{
|
||||||
|
if(WorkspaceInstance* wsp = dynamic_cast<WorkspaceInstance*>(workspace))
|
||||||
|
{
|
||||||
|
wsp->removeFromPVector(this);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
workspace = workspace->getParent();
|
||||||
|
}
|
||||||
|
parent->removeChild(this);
|
||||||
|
}
|
||||||
|
parent = newParent;
|
||||||
|
if(newParent != NULL)
|
||||||
|
{
|
||||||
|
Instance* workspace = parent;
|
||||||
|
while(workspace != NULL)
|
||||||
|
{
|
||||||
|
if(WorkspaceInstance* wsp = dynamic_cast<WorkspaceInstance*>(workspace))
|
||||||
|
{
|
||||||
|
wsp->addToPVector(this);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
workspace = workspace->getParent();
|
||||||
|
}
|
||||||
|
newParent->addChild(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<PROPGRIDITEM> PVInstance::getProperties()
|
||||||
|
{
|
||||||
|
std::vector<PROPGRIDITEM> properties = Instance::getProperties();
|
||||||
|
properties.push_back(createPGI(
|
||||||
|
"Item",
|
||||||
|
"NameShown",
|
||||||
|
"This chooses whether the item name is shown",
|
||||||
|
nameShown,
|
||||||
|
PIT_CHECK));
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
void PVInstance::PropUpdate(LPPROPGRIDITEM &pItem)
|
||||||
|
{
|
||||||
|
if(strcmp(pItem->lpszPropName, "NameShown") == 0)
|
||||||
|
{
|
||||||
|
nameShown = (bool)pItem->lpCurValue;
|
||||||
|
}
|
||||||
|
else Instance::PropUpdate(pItem);
|
||||||
|
}
|
||||||
17
PVInstance.h
Normal file
17
PVInstance.h
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "instance.h"
|
||||||
|
|
||||||
|
class PVInstance :
|
||||||
|
public Instance
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PVInstance(void);
|
||||||
|
~PVInstance(void);
|
||||||
|
PVInstance(const PVInstance &oinst);
|
||||||
|
virtual void postRender(RenderDevice* rd);
|
||||||
|
virtual void setParent(Instance* newParent);
|
||||||
|
virtual std::vector<PROPGRIDITEM> getProperties();
|
||||||
|
virtual void PropUpdate(LPPROPGRIDITEM &pItem);
|
||||||
|
virtual void render(RenderDevice* rd);
|
||||||
|
bool nameShown;
|
||||||
|
};
|
||||||
1028
PartInstance.cpp
Normal file
1028
PartInstance.cpp
Normal file
File diff suppressed because it is too large
Load Diff
72
PartInstance.h
Normal file
72
PartInstance.h
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "PVInstance.h"
|
||||||
|
#include "Enum.h"
|
||||||
|
|
||||||
|
#define NEW_BOX_RENDER
|
||||||
|
|
||||||
|
class PartInstance : public PVInstance
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PartInstance(void);
|
||||||
|
PartInstance(const PartInstance &oinst);
|
||||||
|
Instance* clone() const { return new PartInstance(*this); }
|
||||||
|
virtual void PartInstance::postRender(RenderDevice* rd);
|
||||||
|
~PartInstance(void);
|
||||||
|
virtual void render(RenderDevice*);
|
||||||
|
Vector3 velocity;
|
||||||
|
Enum::SurfaceType::Value top;
|
||||||
|
Enum::SurfaceType::Value front;
|
||||||
|
Enum::SurfaceType::Value right;
|
||||||
|
Enum::SurfaceType::Value back;
|
||||||
|
Enum::SurfaceType::Value left;
|
||||||
|
Enum::SurfaceType::Value bottom;
|
||||||
|
Enum::Shape::Value shape;
|
||||||
|
CoordinateFrame cFrame;
|
||||||
|
Color3 color;
|
||||||
|
Vector3 getPosition();
|
||||||
|
void setPosition(Vector3);
|
||||||
|
CoordinateFrame getCFrame();
|
||||||
|
void setCFrame(CoordinateFrame);
|
||||||
|
Box getBox();
|
||||||
|
Box getScaledBox();
|
||||||
|
CoordinateFrame getCFrameRenderBased();
|
||||||
|
Vector3 getSize();
|
||||||
|
void setSize(Vector3);
|
||||||
|
void setShape(Enum::Shape::Value shape);
|
||||||
|
bool canCollide;
|
||||||
|
bool anchored;
|
||||||
|
Vector3 rotVelocity;
|
||||||
|
bool collides(Box);
|
||||||
|
virtual std::vector<PROPGRIDITEM> getProperties();
|
||||||
|
virtual void PropUpdate(LPPROPGRIDITEM &pItem);
|
||||||
|
#ifdef NEW_BOX_RENDER
|
||||||
|
void addVertex(Vector3 vertexPos,Color3 color);
|
||||||
|
void addNormals(Vector3 normal);
|
||||||
|
void addSingularNormal(Vector3 normal);
|
||||||
|
void addTriangle(Vector3 vertexPos,Vector3 vertexPos2, Vector3 vertexPos3);
|
||||||
|
void addSmoothTriangle(Vector3 vertexPos,Vector3 vertexPos2, Vector3 vertexPos3);
|
||||||
|
void makeSmoothFace(int vertex1, int vertex2, int vertex3);
|
||||||
|
void addPlus(Vector3 v1);
|
||||||
|
void addPlus2(Vector3 v1);
|
||||||
|
void debugPrintVertexIDs(RenderDevice* rd, GFontRef font, Matrix3 camRot);
|
||||||
|
void makeFace(int vertex1, int vertex2, int vertex3);
|
||||||
|
bool isUniqueVertex(Vector3 pos);
|
||||||
|
#endif
|
||||||
|
private:
|
||||||
|
Vector3 position;
|
||||||
|
Vector3 size;
|
||||||
|
float _bevelSize;
|
||||||
|
int _parseVert;
|
||||||
|
int _debugTimer;
|
||||||
|
std::vector<Vector3> _debugUniqueVertices;
|
||||||
|
#ifdef NEW_BOX_RENDER
|
||||||
|
std::vector<GLfloat> _vertices;
|
||||||
|
std::vector<GLfloat> _normals;
|
||||||
|
#else
|
||||||
|
GLfloat _vertices[96];
|
||||||
|
#endif
|
||||||
|
std::vector<GLushort> _indices;
|
||||||
|
bool changed;
|
||||||
|
Box itemBox;
|
||||||
|
GLuint glList;
|
||||||
|
};
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
#include <G3DAll.h>
|
|
||||||
#include "PhysicalInstance.h"
|
|
||||||
|
|
||||||
bool canCollide = true;
|
|
||||||
bool anchored = false;
|
|
||||||
Vector3 size;
|
|
||||||
Vector3 position;
|
|
||||||
Vector3 velocity;
|
|
||||||
Vector3 rotVelocity;
|
|
||||||
Color3 color;
|
|
||||||
|
|
||||||
PhysicalInstance::PhysicalInstance(void)
|
|
||||||
{
|
|
||||||
name = "Default PhysicalInstance";
|
|
||||||
className = "Part";
|
|
||||||
canCollide = true;
|
|
||||||
anchored = true;
|
|
||||||
size = Vector3(2,1,4);
|
|
||||||
position = Vector3(0,0,0);
|
|
||||||
color = Color3::gray();
|
|
||||||
velocity = Vector3(0,0,0);
|
|
||||||
rotVelocity = Vector3(0,0,0);
|
|
||||||
}
|
|
||||||
|
|
||||||
PhysicalInstance::~PhysicalInstance(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
#include "instance.h"
|
|
||||||
|
|
||||||
class PhysicalInstance :
|
|
||||||
public Instance
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
PhysicalInstance(void);
|
|
||||||
~PhysicalInstance(void);
|
|
||||||
Vector3 size;
|
|
||||||
Vector3 position;
|
|
||||||
Vector3 velocity;
|
|
||||||
Vector3 rotvelocity;
|
|
||||||
Color3 color;
|
|
||||||
};
|
|
||||||
372
PropertyWindow.cpp
Normal file
372
PropertyWindow.cpp
Normal file
@@ -0,0 +1,372 @@
|
|||||||
|
#define _WINSOCKAPI_
|
||||||
|
#include <windows.h>
|
||||||
|
#include "WindowFunctions.h"
|
||||||
|
#include "resource.h"
|
||||||
|
#include "PropertyWindow.h"
|
||||||
|
#include "Globals.h"
|
||||||
|
#include "strsafe.h"
|
||||||
|
#include "Application.h"
|
||||||
|
|
||||||
|
/*typedef struct typPRGP {
|
||||||
|
Instance* instance; // Declare member types
|
||||||
|
Property ∝
|
||||||
|
} PRGP;*/
|
||||||
|
|
||||||
|
std::vector<PROPGRIDITEM> prop;
|
||||||
|
std::vector<Instance*> children;
|
||||||
|
Instance * selectedInstance;
|
||||||
|
Instance * parent = NULL;
|
||||||
|
const int CX_BITMAP = 16;
|
||||||
|
const int CY_BITMAP = 16;
|
||||||
|
|
||||||
|
|
||||||
|
HBITMAP CreateBitmapMask(HBITMAP hbmColour, COLORREF crTransparent)
|
||||||
|
{
|
||||||
|
HDC hdcMem, hdcMem2;
|
||||||
|
HBITMAP hbmMask;
|
||||||
|
BITMAP bm;
|
||||||
|
|
||||||
|
// Create monochrome (1 bit) mask bitmap.
|
||||||
|
|
||||||
|
GetObject(hbmColour, sizeof(BITMAP), &bm);
|
||||||
|
hbmMask = CreateBitmap(bm.bmWidth, bm.bmHeight, 1, 1, NULL);
|
||||||
|
|
||||||
|
// Get some HDCs that are compatible with the display driver
|
||||||
|
|
||||||
|
hdcMem = CreateCompatibleDC(0);
|
||||||
|
hdcMem2 = CreateCompatibleDC(0);
|
||||||
|
|
||||||
|
SelectObject(hdcMem, hbmColour);
|
||||||
|
SelectObject(hdcMem2, hbmMask);
|
||||||
|
|
||||||
|
// Set the background colour of the colour image to the colour
|
||||||
|
// you want to be transparent.
|
||||||
|
SetBkColor(hdcMem, crTransparent);
|
||||||
|
|
||||||
|
// Copy the bits from the colour image to the B+W mask... everything
|
||||||
|
// with the background colour ends up white while everythig else ends up
|
||||||
|
// black...Just what we wanted.
|
||||||
|
|
||||||
|
BitBlt(hdcMem2, 0, 0, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY);
|
||||||
|
|
||||||
|
// Take our new mask and use it to turn the transparent colour in our
|
||||||
|
// original colour image to black so the transparency effect will
|
||||||
|
// work right.
|
||||||
|
BitBlt(hdcMem, 0, 0, bm.bmWidth, bm.bmHeight, hdcMem2, 0, 0, SRCINVERT);
|
||||||
|
|
||||||
|
// Clean up.
|
||||||
|
|
||||||
|
DeleteDC(hdcMem);
|
||||||
|
DeleteDC(hdcMem2);
|
||||||
|
|
||||||
|
return hbmMask;
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT CALLBACK PropProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
TCHAR achTemp[256];
|
||||||
|
PropertyWindow *propWind = (PropertyWindow *)GetWindowLongPtr(hwnd, GWL_USERDATA);
|
||||||
|
if (propWind==NULL)
|
||||||
|
{
|
||||||
|
return DefWindowProc(hwnd, msg, wParam, lParam);
|
||||||
|
}
|
||||||
|
switch(msg)
|
||||||
|
{
|
||||||
|
case WM_CLOSE:
|
||||||
|
{
|
||||||
|
ShowWindow(hwnd, SW_HIDE);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WM_DRAWITEM:
|
||||||
|
{
|
||||||
|
std::cout << "Drawing?" << "\r\n";
|
||||||
|
COLORREF clrBackground;
|
||||||
|
COLORREF clrForeground;
|
||||||
|
TEXTMETRIC tm;
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
HRESULT hr;
|
||||||
|
size_t cch;
|
||||||
|
|
||||||
|
LPDRAWITEMSTRUCT lpdis = (LPDRAWITEMSTRUCT) lParam;
|
||||||
|
|
||||||
|
if (lpdis->itemID == -1) // Empty item)
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Get the food icon from the item data.
|
||||||
|
HBITMAP hbmIcon = LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_BITMAP1));
|
||||||
|
HBITMAP hbmMask = CreateBitmapMask(hbmIcon, RGB(255, 0, 220));
|
||||||
|
// The colors depend on whether the item is selected.
|
||||||
|
clrForeground = SetTextColor(lpdis->hDC,
|
||||||
|
GetSysColor(lpdis->itemState & ODS_SELECTED ?
|
||||||
|
COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT));
|
||||||
|
|
||||||
|
clrBackground = SetBkColor(lpdis->hDC,
|
||||||
|
GetSysColor(lpdis->itemState & ODS_SELECTED ?
|
||||||
|
COLOR_HIGHLIGHT : COLOR_WINDOW));
|
||||||
|
|
||||||
|
// Calculate the vertical and horizontal position.
|
||||||
|
GetTextMetrics(lpdis->hDC, &tm);
|
||||||
|
y = (lpdis->rcItem.bottom + lpdis->rcItem.top - tm.tmHeight) / 2;
|
||||||
|
x = LOWORD(GetDialogBaseUnits()) / 4;
|
||||||
|
|
||||||
|
// Get and display the text for the list item.
|
||||||
|
int mul = 0;
|
||||||
|
SendMessage(lpdis->hwndItem, CB_GETLBTEXT, lpdis->itemID, (LPARAM) achTemp);
|
||||||
|
|
||||||
|
if(lpdis->itemID >= 0)
|
||||||
|
{
|
||||||
|
mul = children[lpdis->itemID]->listicon;
|
||||||
|
}
|
||||||
|
//else mul = children[lpdis->itemID-1]->listicon;
|
||||||
|
|
||||||
|
//mul = children[lpdis->itemID]->listicon;
|
||||||
|
|
||||||
|
hr = StringCchLength(achTemp, 256, &cch);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
// TODO: Write error handler.
|
||||||
|
}
|
||||||
|
|
||||||
|
ExtTextOut(lpdis->hDC, CX_BITMAP + 2 * x, y,
|
||||||
|
ETO_CLIPPED | ETO_OPAQUE, &lpdis->rcItem,
|
||||||
|
achTemp, (UINT)cch, NULL);
|
||||||
|
|
||||||
|
// Restore the previous colors.
|
||||||
|
SetTextColor(lpdis->hDC, clrForeground);
|
||||||
|
SetBkColor(lpdis->hDC, clrBackground);
|
||||||
|
|
||||||
|
// Draw the food icon for the item.
|
||||||
|
HDC hdc = CreateCompatibleDC(lpdis->hDC);
|
||||||
|
if (hdc == NULL)
|
||||||
|
break;
|
||||||
|
|
||||||
|
SelectObject(hdc, hbmMask);
|
||||||
|
BitBlt(lpdis->hDC, x, lpdis->rcItem.top,
|
||||||
|
CX_BITMAP, CY_BITMAP, hdc, mul*16, 0, SRCAND);
|
||||||
|
|
||||||
|
SelectObject(hdc, hbmIcon);
|
||||||
|
BitBlt(lpdis->hDC, x, lpdis->rcItem.top,
|
||||||
|
CX_BITMAP, CY_BITMAP, hdc, mul*16, 0, SRCPAINT);
|
||||||
|
|
||||||
|
DeleteDC(hdc);
|
||||||
|
|
||||||
|
// If the item has the focus, draw the focus rectangle.
|
||||||
|
if (lpdis->itemState & ODS_FOCUS)
|
||||||
|
DrawFocusRect(lpdis->hDC, &lpdis->rcItem);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WM_MEASUREITEM:
|
||||||
|
{
|
||||||
|
LPMEASUREITEMSTRUCT lpmis = (LPMEASUREITEMSTRUCT) lParam;
|
||||||
|
if (lpmis->itemHeight < 18)
|
||||||
|
lpmis->itemHeight = 18;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WM_SIZE:
|
||||||
|
{
|
||||||
|
propWind->onResize();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WM_COMMAND:
|
||||||
|
{
|
||||||
|
if(HIWORD(wParam) == CBN_SELCHANGE)
|
||||||
|
{
|
||||||
|
int ItemIndex = SendMessage((HWND) lParam, (UINT) CB_GETCURSEL, (WPARAM) 0, (LPARAM) 0);
|
||||||
|
CHAR ListItem[256];
|
||||||
|
SendMessage((HWND) lParam, (UINT) CB_GETLBTEXT, (WPARAM) ItemIndex, (LPARAM) ListItem);
|
||||||
|
propWind->ClearProperties();
|
||||||
|
g_usableApp->selectInstance(children.at(ItemIndex),propWind);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WM_NOTIFY:
|
||||||
|
{
|
||||||
|
switch(((LPNMHDR)lParam)->code)
|
||||||
|
{
|
||||||
|
case PGN_PROPERTYCHANGE:
|
||||||
|
{
|
||||||
|
if (IDC_PROPERTYGRID==wParam) {
|
||||||
|
LPNMHDR pnm = (LPNMHDR)lParam;
|
||||||
|
LPNMPROPGRID lpnmp = (LPNMPROPGRID)pnm;
|
||||||
|
LPPROPGRIDITEM item = PropGrid_GetItemData(pnm->hwndFrom,lpnmp->iIndex);
|
||||||
|
selectedInstance->PropUpdate(item);
|
||||||
|
//propWind->UpdateSelected(selectedInstance);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//MessageBox(NULL,"Test","Test",0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return DefWindowProc(hwnd, msg, wParam, lParam);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PropertyWindow::refreshExplorer(Instance* selectedInstance)
|
||||||
|
{
|
||||||
|
SendMessage(_explorerComboBox,CB_RESETCONTENT,0,0);
|
||||||
|
parent = NULL;
|
||||||
|
children.clear();
|
||||||
|
//g_selectedInstances.clear();
|
||||||
|
//for (unsigned int i=0;i<g_selectedInstances.size();i++) {
|
||||||
|
children.push_back(selectedInstance);
|
||||||
|
SendMessage(_explorerComboBox, CB_ADDSTRING, 0, (LPARAM)selectedInstance->name.c_str());
|
||||||
|
if(selectedInstance->getParent() != NULL)
|
||||||
|
{
|
||||||
|
std::string title = ".. (";
|
||||||
|
title += selectedInstance->getParent()->name;
|
||||||
|
title += ")";
|
||||||
|
SendMessage(_explorerComboBox,CB_ADDSTRING, 0,(LPARAM)title.c_str());
|
||||||
|
parent = selectedInstance->getParent();
|
||||||
|
children.push_back(selectedInstance->getParent());
|
||||||
|
}
|
||||||
|
//children = g_selectedInstances[i]->getChildren();
|
||||||
|
|
||||||
|
std::vector<Instance*> selectedChildren = selectedInstance->getChildren();
|
||||||
|
for(size_t z = 0; z < selectedChildren.size(); z++)
|
||||||
|
{
|
||||||
|
children.push_back(selectedChildren.at(z));
|
||||||
|
SendMessage(_explorerComboBox,CB_ADDSTRING, 0,(LPARAM)selectedChildren.at(z)->name.c_str());
|
||||||
|
}
|
||||||
|
//g_usableApp->selectInstance(selectedInstance, this);
|
||||||
|
SendMessage(_explorerComboBox,CB_SETCURSEL,0,(LPARAM)0);
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PropertyWindow::onCreate(int x, int y, int sx, int sy, HMODULE hThisInstance) {
|
||||||
|
if (!createWindowClass("propHWND",PropProc,hThisInstance))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
_hwndProp = CreateWindowEx(
|
||||||
|
WS_EX_TOOLWINDOW,
|
||||||
|
"propHWND",
|
||||||
|
"PropertyGrid",
|
||||||
|
WS_VISIBLE | WS_POPUPWINDOW | WS_THICKFRAME | WS_CAPTION,
|
||||||
|
CW_USEDEFAULT,
|
||||||
|
CW_USEDEFAULT,
|
||||||
|
300,
|
||||||
|
660,
|
||||||
|
NULL, // parent
|
||||||
|
NULL, // menu
|
||||||
|
hThisInstance,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
_explorerComboBox = CreateWindowEx(
|
||||||
|
NULL,
|
||||||
|
"COMBOBOX",
|
||||||
|
"Combo",
|
||||||
|
WS_VISIBLE | WS_CHILD | CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS ,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
_hwndProp, // parent
|
||||||
|
NULL, // menu
|
||||||
|
hThisInstance,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
SendMessage(_explorerComboBox, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), 0);
|
||||||
|
|
||||||
|
_propGrid = New_PropertyGrid(_hwndProp,IDC_PROPERTYGRID);
|
||||||
|
|
||||||
|
/*PROPGRIDITEM pItem;
|
||||||
|
PropGrid_ItemInit(pItem);
|
||||||
|
|
||||||
|
pItem.lpszCatalog="Test";
|
||||||
|
pItem.lpszPropName="Offset";
|
||||||
|
pItem.lpszzCmbItems="What";
|
||||||
|
pItem.lpszPropDesc="Description";
|
||||||
|
pItem.lpCurValue=(LPARAM)"0, 0, 0";
|
||||||
|
|
||||||
|
pItem.iItemType=PIT_EDIT;
|
||||||
|
|
||||||
|
PROPGRIDITEM pItem2;
|
||||||
|
PropGrid_ItemInit(pItem2);
|
||||||
|
|
||||||
|
pItem2.lpszCatalog="Test";
|
||||||
|
pItem2.lpszPropName="s";
|
||||||
|
pItem2.lpszzCmbItems="itemlist\0itemlist2\0itemlist3";
|
||||||
|
pItem2.lpszPropDesc="";
|
||||||
|
pItem2.lpCurValue=0;
|
||||||
|
|
||||||
|
pItem2.iItemType=PIT_COMBO;
|
||||||
|
|
||||||
|
/*PROPGRIDITEM FauxExplorerItem;
|
||||||
|
PropGrid_ItemInit(FauxExplorerItem);
|
||||||
|
FauxExplorerItem.lpszCatalog="Test";
|
||||||
|
FauxExplorerItem.lpszPropName = "Editable Combo Field";
|
||||||
|
FauxExplorerItem.lpszzCmbItems = "Test1\0Test2\0Test3";
|
||||||
|
FauxExplorerItem.lpszPropDesc = "Press F4 to view drop down.";
|
||||||
|
FauxExplorerItem.iItemType = PIT_EDITCOMBO;
|
||||||
|
FauxExplorerItem.lpCurValue = 1;
|
||||||
|
PropGrid_AddItem(_propGrid, &FauxExplorerItem);*/
|
||||||
|
|
||||||
|
PropGrid_Enable(_propGrid,true);
|
||||||
|
ShowWindow(_propGrid,SW_SHOW);
|
||||||
|
// PropGrid_AddItem(_propGrid,&pItem);
|
||||||
|
// PropGrid_AddItem(_propGrid,&pItem2);
|
||||||
|
PropGrid_SetItemHeight(_propGrid,20);
|
||||||
|
PropGrid_ShowToolTips(_propGrid,TRUE);
|
||||||
|
PropGrid_ShowPropertyDescriptions(_propGrid,TRUE);
|
||||||
|
PropGrid_ExpandAllCatalogs(_propGrid);
|
||||||
|
|
||||||
|
|
||||||
|
SetWindowLongPtr(_hwndProp,GWL_USERDATA,(LONG)this);
|
||||||
|
|
||||||
|
//refreshExplorer();
|
||||||
|
_resize();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
PropertyWindow::PropertyWindow(int x, int y, int sx, int sy, HMODULE hThisInstance) {
|
||||||
|
onCreate(x, y, sx, sy, hThisInstance);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PropertyWindow::onResize()
|
||||||
|
{
|
||||||
|
_resize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PropertyWindow::_resize()
|
||||||
|
{
|
||||||
|
RECT rect;
|
||||||
|
GetClientRect(_hwndProp,&rect);
|
||||||
|
SetWindowPos(_propGrid, NULL, 0, 20, rect.right, rect.bottom-20, SWP_NOZORDER | SWP_NOACTIVATE);
|
||||||
|
SetWindowPos(_explorerComboBox, NULL, 0, 0, rect.right, 400, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PropertyWindow::UpdateSelected(Instance * instance)
|
||||||
|
{
|
||||||
|
PropGrid_ResetContent(_propGrid);
|
||||||
|
prop = instance->getProperties();
|
||||||
|
if (selectedInstance != instance)
|
||||||
|
{
|
||||||
|
selectedInstance = instance;
|
||||||
|
for(size_t i = 0; i < prop.size(); i++)
|
||||||
|
{
|
||||||
|
::PROPGRIDITEM item = prop.at(i);
|
||||||
|
PropGrid_AddItem(_propGrid, &item);
|
||||||
|
//PRGP propgp;
|
||||||
|
//propgp.instance = instance;
|
||||||
|
//propgp.prop = prop.at(i);
|
||||||
|
}
|
||||||
|
PropGrid_ExpandAllCatalogs(_propGrid);
|
||||||
|
//SetWindowLongPtr(_propGrid,GWL_USERDATA,(LONG)this);
|
||||||
|
|
||||||
|
refreshExplorer(instance);
|
||||||
|
_resize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PropertyWindow::ClearProperties()
|
||||||
|
{
|
||||||
|
PropGrid_ResetContent(_propGrid);
|
||||||
|
}
|
||||||
17
PropertyWindow.h
Normal file
17
PropertyWindow.h
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "Instance.h"
|
||||||
|
|
||||||
|
class PropertyWindow {
|
||||||
|
public:
|
||||||
|
PropertyWindow(int x, int y, int sx, int sy, HMODULE hThisInstance);
|
||||||
|
bool onCreate(int x, int y, int sx, int sy, HMODULE hThisInstance);
|
||||||
|
void UpdateSelected(Instance *);
|
||||||
|
void ClearProperties();
|
||||||
|
void onResize();
|
||||||
|
void refreshExplorer(Instance* selectedInstance);
|
||||||
|
HWND _hwndProp;
|
||||||
|
private:
|
||||||
|
HWND _propGrid;
|
||||||
|
HWND _explorerComboBox;
|
||||||
|
void _resize();
|
||||||
|
};
|
||||||
10
README.md
Normal file
10
README.md
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# ROBLOX 2005 Recreation Project
|
||||||
|
## Why are we doing this?
|
||||||
|
ROBLOX in 2005 was a different game, based around minigames with win and lose conditions rather than a 3D building game. Since this build of the client is presumed lost despite having around 100 users, we have to recreate it. We are using era-appropriate tools for this as well (Visual Studio 2005 and 2005-era compilers), as well as G3D 6.10, the era-appropriate version of the Graphics3D graphics library used by ROBLOX to this day.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
Equivalent to known features of 05 as it stood in October 2005 with the 'Morgan McGuire builds'
|
||||||
|
|
||||||
|
## Credits
|
||||||
|
- Morgan McGuire, creator of G3D - his old pre-2006 website for the only existing colour pictures of 2005 era roblox on the internet, as well as a couple of helpful emails. He assisted roblox development in the 2004-2006 timeframe.
|
||||||
|
- David Baszucki and Erik Cassel (1967-2013, RIP) - for creating roblox
|
||||||
21
RotateButtonListener.cpp
Normal file
21
RotateButtonListener.cpp
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
#include "BaseButtonInstance.h"
|
||||||
|
#include "RotateButtonListener.h"
|
||||||
|
#include "Globals.h"
|
||||||
|
#include "AudioPlayer.h"
|
||||||
|
|
||||||
|
void RotateButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
||||||
|
{
|
||||||
|
if(g_selectedInstances.size() > 0)
|
||||||
|
{
|
||||||
|
Instance* selectedInstance = g_selectedInstances.at(0);
|
||||||
|
AudioPlayer::playSound(clickSound);
|
||||||
|
if(PartInstance* part = dynamic_cast<PartInstance*>(selectedInstance))
|
||||||
|
{
|
||||||
|
if(button->name == "Tilt")
|
||||||
|
part->setCFrame(part->getCFrame()*Matrix3::fromEulerAnglesXYZ(0,0,toRadians(90)));
|
||||||
|
else if(button->name == "Rotate")
|
||||||
|
part->setCFrame(part->getCFrame()*Matrix3::fromEulerAnglesXYZ(0,toRadians(90),0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
7
RotateButtonListener.h
Normal file
7
RotateButtonListener.h
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "ButtonListener.h"
|
||||||
|
|
||||||
|
class RotateButtonListener : public ButtonListener {
|
||||||
|
public:
|
||||||
|
void onButton1MouseClick(BaseButtonInstance*);
|
||||||
|
};
|
||||||
9
ShapeRenderer.cpp
Normal file
9
ShapeRenderer.cpp
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#include "ShapeRenderer.h"
|
||||||
|
|
||||||
|
ShapeRenderer::ShapeRenderer(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
ShapeRenderer::~ShapeRenderer(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
34
StringFunctions.cpp
Normal file
34
StringFunctions.cpp
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
#include <G3DAll.h>
|
||||||
|
#include <sstream>
|
||||||
|
#include "ErrorFunctions.h"
|
||||||
|
#include "StringFunctions.h"
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
std::string Convert (float number)
|
||||||
|
{
|
||||||
|
std::ostringstream buff;
|
||||||
|
buff<<number;
|
||||||
|
return buff.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
6
StringFunctions.h
Normal file
6
StringFunctions.h
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
std::string Convert (float number);
|
||||||
|
std::string ExePath();
|
||||||
|
std::string GetFileInPath(std::string file);
|
||||||
122
TextButtonInstance.cpp
Normal file
122
TextButtonInstance.cpp
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
#include "TextButtonInstance.h"
|
||||||
|
|
||||||
|
|
||||||
|
TextButtonInstance::TextButtonInstance(void)
|
||||||
|
{
|
||||||
|
BaseButtonInstance::BaseButtonInstance();
|
||||||
|
boxBegin = Vector2(0,0);
|
||||||
|
boxEnd = Vector2(0,0);
|
||||||
|
fontLocationRelativeTo = Vector2(0,0);
|
||||||
|
centeredWithinBox = false;
|
||||||
|
title = "TextBox";
|
||||||
|
textColor = Color4(1, 1, 1, 1);
|
||||||
|
textOutlineColor = Color4(0, 0, 0, 0);
|
||||||
|
boxColor = Color4(0.6F,0.6F,0.6F,0.4F);
|
||||||
|
boxOutlineColor = Color4(0, 0, 0, 0);
|
||||||
|
setAllColorsSame();
|
||||||
|
textSize = 12;
|
||||||
|
floatBottom = false;
|
||||||
|
floatRight = false;
|
||||||
|
floatCenter = false;
|
||||||
|
visible = true;
|
||||||
|
className = "TextButton";
|
||||||
|
disabled = false;
|
||||||
|
selected = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TextButtonInstance::mouseInButton(float mousex, float mousey, RenderDevice* rd)
|
||||||
|
{
|
||||||
|
Vector3 point1;
|
||||||
|
Vector3 point2;
|
||||||
|
if(floatBottom)
|
||||||
|
{
|
||||||
|
point1 = Vector3(boxBegin.x, rd->getHeight() + boxBegin.y,0);
|
||||||
|
point2 = Vector3(boxEnd.x, rd->getHeight() + boxEnd.y,0);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
point1 = Vector3(boxBegin.x, boxBegin.y,0);
|
||||||
|
point2 = Vector3(boxEnd.x, boxEnd.y,0);
|
||||||
|
}
|
||||||
|
if(mousex >= point1.x && mousey >= point1.y)
|
||||||
|
{
|
||||||
|
if(mousex < point2.x && mousey < point2.y)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TextButtonInstance::setAllColorsSame()
|
||||||
|
{
|
||||||
|
textColorOvr = textColor;
|
||||||
|
textOutlineColorOvr = textOutlineColor;
|
||||||
|
boxColorOvr = boxColor;
|
||||||
|
boxOutlineColorOvr = boxOutlineColor;
|
||||||
|
textColorDn = textColor;
|
||||||
|
textOutlineColorDn = textOutlineColor;
|
||||||
|
boxColorDn = boxColor;
|
||||||
|
boxOutlineColorDn = boxOutlineColor;
|
||||||
|
textColorDis = textColor;
|
||||||
|
textOutlineColorDis = textOutlineColor;
|
||||||
|
boxColorDis = boxColor;
|
||||||
|
boxOutlineColorDis = boxOutlineColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
TextButtonInstance::~TextButtonInstance(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void TextButtonInstance::drawObj(RenderDevice* rd, Vector2 mousePos, bool mouseDown)
|
||||||
|
{
|
||||||
|
Vector3 point1;
|
||||||
|
Vector3 point2;
|
||||||
|
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
glDisableClientState(GL_COLOR_ARRAY);
|
||||||
|
|
||||||
|
if(floatBottom)
|
||||||
|
{
|
||||||
|
point1 = Vector3(boxBegin.x, rd->getHeight() + boxBegin.y,0);
|
||||||
|
point2 = Vector3(boxEnd.x, rd->getHeight() + boxEnd.y,0);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
point1 = Vector3(boxBegin.x, boxBegin.y,0);
|
||||||
|
point2 = Vector3(boxEnd.x, boxEnd.y,0);
|
||||||
|
}
|
||||||
|
Vector2 RelativeTo = Vector2(point1.x + fontLocationRelativeTo.x, point1.y + fontLocationRelativeTo.y);
|
||||||
|
if(disabled)
|
||||||
|
{
|
||||||
|
Draw::box(Box(point1, point2), rd, boxColorDis, boxOutlineColorDis);
|
||||||
|
font->draw2D(rd, title, RelativeTo, textSize, textColorDis, textOutlineColorDis);
|
||||||
|
}
|
||||||
|
else if(mouseInArea(point1.x, point1.y, point2.x, point2.y, mousePos.x, mousePos.y) && mouseDown)
|
||||||
|
{
|
||||||
|
Draw::box(Box(point1, point2), rd, boxColorDn, boxOutlineColorDn);
|
||||||
|
font->draw2D(rd, title, RelativeTo, textSize, textColorDn, textOutlineColorDn);
|
||||||
|
}
|
||||||
|
else if(mouseInArea(point1.x, point1.y, point2.x, point2.y, mousePos.x, mousePos.y))
|
||||||
|
{
|
||||||
|
Draw::box(Box(point1, point2), rd, boxColorOvr, boxOutlineColorOvr);
|
||||||
|
font->draw2D(rd, title, RelativeTo, textSize, textColorOvr, textOutlineColorOvr);
|
||||||
|
}
|
||||||
|
else if(selected)
|
||||||
|
{
|
||||||
|
Draw::box(Box(point1, point2), rd, boxColorOvr, boxOutlineColorOvr);
|
||||||
|
font->draw2D(rd, title, RelativeTo, textSize, textColorOvr, textOutlineColorOvr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Draw::box(Box(point1, point2), rd, boxColor, boxOutlineColor);
|
||||||
|
font->draw2D(rd, title, RelativeTo, textSize, textColor, textOutlineColor);
|
||||||
|
}
|
||||||
|
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
glEnableClientState(GL_COLOR_ARRAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
void doNullCheck()
|
||||||
|
{
|
||||||
|
}
|
||||||
35
TextButtonInstance.h
Normal file
35
TextButtonInstance.h
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "BaseButtonInstance.h"
|
||||||
|
class TextButtonInstance : public BaseButtonInstance
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TextButtonInstance(void);
|
||||||
|
~TextButtonInstance(void);
|
||||||
|
void setAllColorsSame();
|
||||||
|
Vector2 boxBegin;
|
||||||
|
Vector2 boxEnd;
|
||||||
|
Vector2 fontLocationRelativeTo;
|
||||||
|
Color4 textColor;
|
||||||
|
Color4 textOutlineColor;
|
||||||
|
Color4 boxColor;
|
||||||
|
Color4 boxOutlineColor;
|
||||||
|
Color4 textColorOvr;
|
||||||
|
Color4 textOutlineColorOvr;
|
||||||
|
Color4 boxColorOvr;
|
||||||
|
Color4 boxOutlineColorOvr;
|
||||||
|
Color4 textColorDn;
|
||||||
|
Color4 textOutlineColorDn;
|
||||||
|
Color4 boxColorDn;
|
||||||
|
Color4 boxOutlineColorDn;
|
||||||
|
Color4 textColorDis;
|
||||||
|
Color4 textOutlineColorDis;
|
||||||
|
Color4 boxColorDis;
|
||||||
|
Color4 boxOutlineColorDis;
|
||||||
|
bool centeredWithinBox;
|
||||||
|
std::string title;
|
||||||
|
G3D::GFontRef font;
|
||||||
|
bool visible;
|
||||||
|
int textSize;
|
||||||
|
void drawObj(RenderDevice*, Vector2, bool);
|
||||||
|
bool mouseInButton(float, float, RenderDevice*);
|
||||||
|
};
|
||||||
32
WindowFunctions.cpp
Normal file
32
WindowFunctions.cpp
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
|
||||||
|
#include "WindowFunctions.h"
|
||||||
|
#include <sstream>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
bool createWindowClass(const char* name,WNDPROC proc,HMODULE hInstance)
|
||||||
|
{
|
||||||
|
WNDCLASSEX wc;
|
||||||
|
wc.cbSize = sizeof(WNDCLASSEX);
|
||||||
|
wc.style = 0;
|
||||||
|
wc.lpfnWndProc = proc;
|
||||||
|
wc.cbClsExtra = 0;
|
||||||
|
wc.cbWndExtra = 0;
|
||||||
|
wc.hInstance = hInstance;
|
||||||
|
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
|
||||||
|
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||||
|
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW);
|
||||||
|
wc.lpszMenuName = NULL;
|
||||||
|
wc.lpszClassName = name;
|
||||||
|
wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
|
||||||
|
if (!RegisterClassEx (&wc))
|
||||||
|
{
|
||||||
|
stringstream errMsg;
|
||||||
|
errMsg<<"Failed to register " << name;
|
||||||
|
MessageBox(NULL, errMsg.str().c_str(),"Dynamica Crash", MB_OK);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
4
WindowFunctions.h
Normal file
4
WindowFunctions.h
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
bool createWindowClass(const char* name,WNDPROC proc,HMODULE hInstance);
|
||||||
23
WorkspaceInstance.cpp
Normal file
23
WorkspaceInstance.cpp
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#include "WorkspaceInstance.h"
|
||||||
|
|
||||||
|
|
||||||
|
WorkspaceInstance::WorkspaceInstance(void)
|
||||||
|
{
|
||||||
|
GroupInstance::GroupInstance();
|
||||||
|
name = "Workspace";
|
||||||
|
className = "Workspace";
|
||||||
|
canDelete = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
WorkspaceInstance::~WorkspaceInstance(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorkspaceInstance::removeFromPVector(PVInstance * instance)
|
||||||
|
{
|
||||||
|
__pvVector.erase(std::remove(__pvVector.begin(), __pvVector.end(), instance), __pvVector.end());
|
||||||
|
}
|
||||||
|
void WorkspaceInstance::addToPVector(PVInstance * instance)
|
||||||
|
{
|
||||||
|
__pvVector.push_back(instance);
|
||||||
|
}
|
||||||
15
WorkspaceInstance.h
Normal file
15
WorkspaceInstance.h
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "GroupInstance.h"
|
||||||
|
#include <set>
|
||||||
|
|
||||||
|
class WorkspaceInstance :
|
||||||
|
public GroupInstance
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
WorkspaceInstance(void);
|
||||||
|
~WorkspaceInstance(void);
|
||||||
|
void removeFromPVector(PVInstance *);
|
||||||
|
void addToPVector(PVInstance *);
|
||||||
|
std::vector<PVInstance*> __pvVector;
|
||||||
|
std::vector<PVInstance*>* getPVVector();
|
||||||
|
};
|
||||||
639
ax.cpp
Normal file
639
ax.cpp
Normal file
@@ -0,0 +1,639 @@
|
|||||||
|
// AX.CPP
|
||||||
|
#include <windows.h>
|
||||||
|
#include <comdef.h>
|
||||||
|
#include <exdisp.h>
|
||||||
|
#include <oledlg.h>
|
||||||
|
#include "ax.h"
|
||||||
|
|
||||||
|
|
||||||
|
#pragma warning (disable: 4311)
|
||||||
|
#pragma warning (disable: 4312)
|
||||||
|
#pragma warning (disable: 4244)
|
||||||
|
#pragma warning (disable: 4800)
|
||||||
|
|
||||||
|
|
||||||
|
// AXClientSite class
|
||||||
|
// ------- Implement member functions
|
||||||
|
AXClientSite :: AXClientSite()
|
||||||
|
{
|
||||||
|
refNum = 0;
|
||||||
|
CalledCanInPlace = 0;
|
||||||
|
InPlace = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
AXClientSite :: ~AXClientSite()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// IUnknown methods
|
||||||
|
STDMETHODIMP AXClientSite :: QueryInterface(REFIID iid,void**ppvObject)
|
||||||
|
{
|
||||||
|
*ppvObject = 0;
|
||||||
|
if (iid == IID_IOleClientSite)
|
||||||
|
*ppvObject = (IOleClientSite*)this;
|
||||||
|
if (iid == IID_IUnknown)
|
||||||
|
*ppvObject = this;
|
||||||
|
if (iid == IID_IAdviseSink)
|
||||||
|
*ppvObject = (IAdviseSink*)this;
|
||||||
|
if (iid == IID_IDispatch)
|
||||||
|
*ppvObject = (IDispatch*)this;
|
||||||
|
if (ExternalPlace == false)
|
||||||
|
{
|
||||||
|
if (iid == IID_IOleInPlaceSite)
|
||||||
|
*ppvObject = (IOleInPlaceSite*)this;
|
||||||
|
if (iid == IID_IOleInPlaceFrame)
|
||||||
|
*ppvObject = (IOleInPlaceFrame*)this;
|
||||||
|
if (iid == IID_IOleInPlaceUIWindow)
|
||||||
|
*ppvObject = (IOleInPlaceUIWindow*)this;
|
||||||
|
}
|
||||||
|
|
||||||
|
//* Log Call
|
||||||
|
if (*ppvObject)
|
||||||
|
{
|
||||||
|
AddRef();
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
return E_NOINTERFACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP_(ULONG) AXClientSite :: AddRef()
|
||||||
|
{
|
||||||
|
refNum++;
|
||||||
|
return refNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP_(ULONG) AXClientSite :: Release()
|
||||||
|
{
|
||||||
|
refNum--;
|
||||||
|
return refNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// IOleClientSite methods
|
||||||
|
STDMETHODIMP AXClientSite :: SaveObject()
|
||||||
|
{
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: GetMoniker(DWORD dwA,DWORD dwW,IMoniker**pm)
|
||||||
|
{
|
||||||
|
*pm = 0;
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: GetContainer(IOleContainer**pc)
|
||||||
|
{
|
||||||
|
*pc = 0;
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: ShowObject()
|
||||||
|
{
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: OnShowWindow(BOOL f)
|
||||||
|
{
|
||||||
|
InvalidateRect(Window, 0, TRUE);
|
||||||
|
InvalidateRect(Parent, 0, TRUE);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: RequestNewObjectLayout()
|
||||||
|
{
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP_(void) AXClientSite :: OnViewChange(DWORD dwAspect,LONG lIndex)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP_(void) AXClientSite :: OnRename(IMoniker * pmk)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP_(void) AXClientSite :: OnSave()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP_(void) AXClientSite :: OnClose()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// IOleInPlaceSite methods
|
||||||
|
STDMETHODIMP AXClientSite :: GetWindow(HWND *p)
|
||||||
|
{
|
||||||
|
*p = Window;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: ContextSensitiveHelp(BOOL)
|
||||||
|
{
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: CanInPlaceActivate()
|
||||||
|
{
|
||||||
|
if (InPlace)
|
||||||
|
{
|
||||||
|
CalledCanInPlace = true;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
return S_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: OnInPlaceActivate()
|
||||||
|
{
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: OnUIActivate()
|
||||||
|
{
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: GetWindowContext(IOleInPlaceFrame** ppFrame,IOleInPlaceUIWindow **ppDoc,LPRECT r1,LPRECT r2,LPOLEINPLACEFRAMEINFO o)
|
||||||
|
{
|
||||||
|
*ppFrame = (IOleInPlaceFrame*)this;
|
||||||
|
AddRef();
|
||||||
|
|
||||||
|
*ppDoc = NULL;
|
||||||
|
GetClientRect(Window,r1);
|
||||||
|
GetClientRect(Window,r2);
|
||||||
|
o->cb = sizeof(OLEINPLACEFRAMEINFO);
|
||||||
|
o->fMDIApp = false;
|
||||||
|
o->hwndFrame = Parent;
|
||||||
|
o->haccel = 0;
|
||||||
|
o->cAccelEntries = 0;
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: Scroll(SIZE s)
|
||||||
|
{
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: OnUIDeactivate(int)
|
||||||
|
{
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: OnInPlaceDeactivate()
|
||||||
|
{
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: DiscardUndoState()
|
||||||
|
{
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: DeactivateAndUndo()
|
||||||
|
{
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: OnPosRectChange(LPCRECT)
|
||||||
|
{
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// IOleInPlaceFrame methods
|
||||||
|
STDMETHODIMP AXClientSite :: GetBorder(LPRECT l)
|
||||||
|
{
|
||||||
|
GetClientRect(Window,l);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: RequestBorderSpace(LPCBORDERWIDTHS b)
|
||||||
|
{
|
||||||
|
//return S_OK;
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: SetBorderSpace(LPCBORDERWIDTHS b)
|
||||||
|
{
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: SetActiveObject(IOleInPlaceActiveObject*pV,LPCOLESTR s)
|
||||||
|
{
|
||||||
|
ax->Pao = pV;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: SetStatusText(LPCOLESTR t)
|
||||||
|
{
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: EnableModeless(BOOL f)
|
||||||
|
{
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: TranslateAccelerator(LPMSG,WORD)
|
||||||
|
{
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// IDispatch Methods
|
||||||
|
HRESULT _stdcall AXClientSite :: GetTypeInfoCount(
|
||||||
|
unsigned int * pctinfo) {return E_NOTIMPL;}
|
||||||
|
|
||||||
|
HRESULT _stdcall AXClientSite :: GetTypeInfo(
|
||||||
|
unsigned int iTInfo,
|
||||||
|
LCID lcid,
|
||||||
|
ITypeInfo FAR* FAR* ppTInfo) {return E_NOTIMPL;}
|
||||||
|
|
||||||
|
HRESULT _stdcall AXClientSite :: GetIDsOfNames(
|
||||||
|
REFIID riid,
|
||||||
|
OLECHAR FAR* FAR*,
|
||||||
|
unsigned int cNames,
|
||||||
|
LCID lcid,
|
||||||
|
DISPID FAR* ) {return E_NOTIMPL;}
|
||||||
|
|
||||||
|
|
||||||
|
// Other Methods
|
||||||
|
void AX :: Init(char* cls)
|
||||||
|
{
|
||||||
|
wchar_t x[1000] = {0};
|
||||||
|
MultiByteToWideChar(CP_ACP,0,cls,-1,x,1000);
|
||||||
|
CLSIDFromString(x,&clsid);
|
||||||
|
iid = (IID*)&IID_IOleObject;
|
||||||
|
OleObject = 0;
|
||||||
|
Storage = 0;
|
||||||
|
View = 0;
|
||||||
|
Data = 0;
|
||||||
|
Unk = 0;
|
||||||
|
Pao = 0;
|
||||||
|
AdviseToken = 0;
|
||||||
|
memset(DAdviseToken,0,sizeof(DAdviseToken));
|
||||||
|
Site.ax = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
AX :: AX(char* cls)
|
||||||
|
{
|
||||||
|
Init(cls);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void AX :: Clean()
|
||||||
|
{
|
||||||
|
if (Site.InPlace == true)
|
||||||
|
{
|
||||||
|
Site.InPlace = false;
|
||||||
|
IOleInPlaceObject* iib = 0;
|
||||||
|
if (OleObject)
|
||||||
|
OleObject->QueryInterface(IID_IOleInPlaceObject,(void**)&iib);
|
||||||
|
if (iib)
|
||||||
|
{
|
||||||
|
iib->UIDeactivate();
|
||||||
|
iib->InPlaceDeactivate();
|
||||||
|
iib->Release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (AdviseToken && OleObject)
|
||||||
|
{
|
||||||
|
OleObject->Unadvise(AdviseToken);
|
||||||
|
AdviseToken = 0;
|
||||||
|
}
|
||||||
|
if (Data)
|
||||||
|
{
|
||||||
|
for(int i = 0 ; i < 100 ; i++)
|
||||||
|
if (DAdviseToken[i])
|
||||||
|
Data->DUnadvise(DAdviseToken[i]);
|
||||||
|
memset(DAdviseToken,0,sizeof(DAdviseToken));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (Pao) Pao->Release();
|
||||||
|
if (Unk) Unk->Release();
|
||||||
|
if (Data) Data->Release();
|
||||||
|
if (View) View->Release();
|
||||||
|
if (Storage) Storage->Release();
|
||||||
|
if (OleObject) OleObject->Release();
|
||||||
|
Unk = 0;
|
||||||
|
Data = 0;
|
||||||
|
View = 0;
|
||||||
|
Storage = 0;
|
||||||
|
OleObject = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
AX :: ~AX()
|
||||||
|
{
|
||||||
|
Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
CLSID AX :: GetCLSID()
|
||||||
|
{
|
||||||
|
return clsid;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT _stdcall AXClientSite :: InsertMenus(HMENU h,LPOLEMENUGROUPWIDTHS x)
|
||||||
|
{
|
||||||
|
/* AX * t = (AX*)ax;
|
||||||
|
if (t->AddMenu)
|
||||||
|
{
|
||||||
|
x->width[0] = 0;
|
||||||
|
x->width[2] = 0;
|
||||||
|
x->width[4] = 0;
|
||||||
|
//InsertMenu(h,0,MF_BYPOSITION | MF_POPUP,(int)Menu,"test");
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
HRESULT _stdcall AXClientSite :: SetMenu(HMENU h,HOLEMENU hO,HWND hw)
|
||||||
|
{
|
||||||
|
AX * t = (AX*)ax;
|
||||||
|
/* if (t->AddMenu)
|
||||||
|
{
|
||||||
|
if (!h && !hO)
|
||||||
|
{
|
||||||
|
//::SetMenu(Window,Menu);
|
||||||
|
//DrawMenuBar(Window);
|
||||||
|
::SetMenu(Parent,Menu);
|
||||||
|
DrawMenuBar(Parent);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
//::SetMenu(Window,h);
|
||||||
|
//DrawMenuBar(Window);
|
||||||
|
|
||||||
|
//HMENU hm = GetMenu(Parent);
|
||||||
|
//AppendMenu(hm,MF_POPUP | MF_MENUBREAK,(int)h,0);
|
||||||
|
//::SetMenu(Parent,hm);
|
||||||
|
::SetMenu(Parent,h);
|
||||||
|
DrawMenuBar(Parent);
|
||||||
|
|
||||||
|
//hOleWindow = hw;
|
||||||
|
//OleSetMenuDescriptor(hO,Window,hw,0,0);
|
||||||
|
OleSetMenuDescriptor(hO,Parent,hw,0,0);
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT _stdcall AXClientSite :: RemoveMenus(HMENU h)
|
||||||
|
{
|
||||||
|
AX * t = (AX*)ax;
|
||||||
|
if (t->AddMenu)
|
||||||
|
{
|
||||||
|
if (!h)
|
||||||
|
return S_OK;
|
||||||
|
|
||||||
|
int c = GetMenuItemCount(h);
|
||||||
|
for (int i = c ; i >= 0 ; i--)
|
||||||
|
{
|
||||||
|
HMENU hh = GetSubMenu(h,i);
|
||||||
|
if (hh == Menu)
|
||||||
|
RemoveMenu(h,i,MF_BYPOSITION);
|
||||||
|
}
|
||||||
|
if (h == Menu)
|
||||||
|
DestroyMenu(h);
|
||||||
|
|
||||||
|
//DrawMenuBar(Window);
|
||||||
|
DrawMenuBar(Parent);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HRESULT _stdcall AXClientSite :: Invoke(
|
||||||
|
DISPID dispIdMember,
|
||||||
|
REFIID riid,
|
||||||
|
LCID lcid,
|
||||||
|
WORD wFlags,
|
||||||
|
DISPPARAMS FAR* pDispParams,
|
||||||
|
VARIANT FAR* pVarResult,
|
||||||
|
EXCEPINFO FAR* pExcepInfo,
|
||||||
|
unsigned int FAR* puArgErr)
|
||||||
|
{
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void _stdcall AXClientSite :: OnDataChange(FORMATETC *pFormatEtc,STGMEDIUM *pStgmed)
|
||||||
|
{
|
||||||
|
// Notify our app that a change is being requested
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Window Procedure for AX control
|
||||||
|
LRESULT CALLBACK AXWndProc(HWND hh,UINT mm,WPARAM ww,LPARAM ll)
|
||||||
|
{
|
||||||
|
if (mm == WM_CREATE)
|
||||||
|
{
|
||||||
|
char tit[1000] = {0};
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
GetWindowTextA(hh,tit,1000);
|
||||||
|
|
||||||
|
AX* ax;
|
||||||
|
ax = new AX(tit);
|
||||||
|
|
||||||
|
SetWindowLong(hh,GWL_USERDATA,(LONG)ax);
|
||||||
|
ax->Site.Window = hh;
|
||||||
|
ax->Site.Parent = GetParent(hh);
|
||||||
|
|
||||||
|
hr = StgCreateDocfile(0,STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_DIRECT | STGM_CREATE,0,&ax->Storage);
|
||||||
|
ax->Site.Window = hh;
|
||||||
|
|
||||||
|
REFIID rid = *ax->iid;
|
||||||
|
hr = OleCreate(ax->GetCLSID(),rid,OLERENDER_DRAW,0,&ax->Site,ax->Storage,(void**)&ax->OleObject);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (!ax->OleObject)
|
||||||
|
{
|
||||||
|
delete ax;
|
||||||
|
SetWindowLong(hh,GWL_USERDATA,0);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = OleSetContainedObject(ax->OleObject, TRUE);
|
||||||
|
hr = ax->OleObject->Advise(&ax->Site,&ax->AdviseToken);
|
||||||
|
hr = ax->OleObject->QueryInterface(IID_IViewObject,(void**)&ax->View);
|
||||||
|
hr = ax->OleObject->QueryInterface(IID_IDataObject,(void**)&ax->Data);
|
||||||
|
if (ax->View)
|
||||||
|
hr = ax->View->SetAdvise(DVASPECT_CONTENT,0,&ax->Site);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (mm == WM_DESTROY)
|
||||||
|
{
|
||||||
|
AX* ax = (AX*)GetWindowLong(hh,GWL_USERDATA);
|
||||||
|
if (!ax)
|
||||||
|
return 0;
|
||||||
|
ax->Clean();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mm == AX_SETDATAADVISE)
|
||||||
|
{
|
||||||
|
AX* ax = (AX*)GetWindowLong(hh,GWL_USERDATA);
|
||||||
|
if (!ax)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// 1.Enum available FORMATETC structures
|
||||||
|
// 2.Set Data Advise specified to index ww
|
||||||
|
if (!ax->Data)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
IEnumFORMATETC* ief = 0;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
FORMATETC fe;
|
||||||
|
ax->Data->EnumFormatEtc((LPARAM)ll,&ief);
|
||||||
|
if (!ief)
|
||||||
|
return 0;
|
||||||
|
for(;;)
|
||||||
|
{
|
||||||
|
HRESULT hr = ief->Next(1,&fe,0);
|
||||||
|
if (hr != S_OK)
|
||||||
|
break;
|
||||||
|
if (ww == i)
|
||||||
|
break;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
ief->Release();
|
||||||
|
if (ww == -1)
|
||||||
|
return i;
|
||||||
|
|
||||||
|
if (ax->Data)
|
||||||
|
ax->Data->DAdvise(&fe,0,&ax->Site,&ax->DAdviseToken[ww]);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mm == AX_GETAXINTERFACE)
|
||||||
|
{
|
||||||
|
AX* ax = (AX*)GetWindowLong(hh,GWL_USERDATA);
|
||||||
|
return (LONG)ax;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mm == AX_QUERYINTERFACE)
|
||||||
|
{
|
||||||
|
char* p = (char*)ww;
|
||||||
|
AX* ax = (AX*)GetWindowLong(hh,GWL_USERDATA);
|
||||||
|
if (!ax)
|
||||||
|
return 0;
|
||||||
|
return ax->OleObject->QueryInterface((REFIID)*p,(void**)ll);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mm == WM_LBUTTONDBLCLK)
|
||||||
|
{
|
||||||
|
PostMessage(hh,AX_INPLACE,1,0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (mm == AX_INPLACE)
|
||||||
|
{
|
||||||
|
AX* ax = (AX*)GetWindowLong(hh,GWL_USERDATA);
|
||||||
|
if (!ax)
|
||||||
|
return 0;
|
||||||
|
if (!ax->OleObject)
|
||||||
|
return 0;
|
||||||
|
RECT rect;
|
||||||
|
HRESULT hr;
|
||||||
|
::GetClientRect(hh,&rect);
|
||||||
|
|
||||||
|
if (ax->Site.InPlace == false && ww == 1) // Activate In Place
|
||||||
|
{
|
||||||
|
ax->Site.InPlace = true;
|
||||||
|
ax->Site.ExternalPlace = ll;
|
||||||
|
hr = ax->OleObject->DoVerb(OLEIVERB_INPLACEACTIVATE,0,&ax->Site,0,hh,&rect);
|
||||||
|
InvalidateRect(hh,0,true);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ax->Site.InPlace == true && ww == 0) // Deactivate
|
||||||
|
{
|
||||||
|
ax->Site.InPlace = false;
|
||||||
|
|
||||||
|
IOleInPlaceObject* iib;
|
||||||
|
ax->OleObject->QueryInterface(IID_IOleInPlaceObject,(void**)&iib);
|
||||||
|
if (iib)
|
||||||
|
{
|
||||||
|
iib->UIDeactivate();
|
||||||
|
iib->InPlaceDeactivate();
|
||||||
|
iib->Release();
|
||||||
|
InvalidateRect(hh,0,true);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mm == WM_SIZE)
|
||||||
|
{
|
||||||
|
AX* ax = (AX*)GetWindowLong(hh,GWL_USERDATA);
|
||||||
|
if (!ax)
|
||||||
|
return 0;
|
||||||
|
if (!ax->OleObject)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
DefWindowProc(hh,mm,ww,ll);
|
||||||
|
|
||||||
|
if (ax->Site.InPlace == true)
|
||||||
|
{
|
||||||
|
SendMessage(hh,AX_INPLACE,0,0);
|
||||||
|
InvalidateRect(hh,0,true);
|
||||||
|
SendMessage(hh,AX_INPLACE,1,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
IOleInPlaceObject* pl;
|
||||||
|
ax->OleObject->QueryInterface(IID_IOleInPlaceObject,(void**)&pl);
|
||||||
|
if (!pl)
|
||||||
|
return 0;
|
||||||
|
RECT r;
|
||||||
|
GetClientRect(ax->Site.Window,&r);
|
||||||
|
pl->SetObjectRects(&r,&r);
|
||||||
|
pl->Release();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return DefWindowProc(hh,mm,ww,ll);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Registration function
|
||||||
|
ATOM AXRegister()
|
||||||
|
{
|
||||||
|
WNDCLASSEXA wC = {0};
|
||||||
|
|
||||||
|
wC.cbSize = sizeof(wC);
|
||||||
|
wC.style = CS_GLOBALCLASS | CS_DBLCLKS;
|
||||||
|
wC.lpfnWndProc = AXWndProc;
|
||||||
|
wC.cbWndExtra = 4;
|
||||||
|
wC.hInstance = GetModuleHandle(0);
|
||||||
|
wC.lpszClassName = "AX";
|
||||||
|
return RegisterClassExA(&wC);
|
||||||
|
}
|
||||||
|
|
||||||
142
ax.h
Normal file
142
ax.h
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
// AX.H
|
||||||
|
|
||||||
|
// messages
|
||||||
|
#define AX_QUERYINTERFACE (WM_USER + 1)
|
||||||
|
#define AX_INPLACE (WM_USER + 2)
|
||||||
|
#define AX_GETAXINTERFACE (WM_USER + 3)
|
||||||
|
#define AX_CONNECTOBJECT (WM_USER + 4)
|
||||||
|
#define AX_DISCONNECTOBJECT (WM_USER + 5)
|
||||||
|
#define AX_SETDATAADVISE (WM_USER + 6)
|
||||||
|
#define AX_DOVERB (WM_USER + 7)
|
||||||
|
|
||||||
|
|
||||||
|
// Registration function
|
||||||
|
ATOM AXRegister();
|
||||||
|
|
||||||
|
|
||||||
|
// Class AXClientSide
|
||||||
|
class AXClientSite :
|
||||||
|
public IOleClientSite,
|
||||||
|
public IDispatch,
|
||||||
|
public IAdviseSink,
|
||||||
|
public IOleInPlaceSite,
|
||||||
|
public IOleInPlaceFrame
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
|
||||||
|
int refNum;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
HWND Window;
|
||||||
|
HWND Parent;
|
||||||
|
HMENU Menu;
|
||||||
|
bool InPlace;
|
||||||
|
bool ExternalPlace;
|
||||||
|
bool CalledCanInPlace;
|
||||||
|
|
||||||
|
class AX* ax;
|
||||||
|
|
||||||
|
// MyClientSite Methods
|
||||||
|
AXClientSite();
|
||||||
|
virtual ~AXClientSite();
|
||||||
|
STDMETHODIMP_(void) OnDataChange2(FORMATETC*);
|
||||||
|
|
||||||
|
// IUnknown methods
|
||||||
|
STDMETHODIMP QueryInterface(REFIID iid,void**ppvObject);
|
||||||
|
STDMETHODIMP_(ULONG) AddRef();
|
||||||
|
STDMETHODIMP_(ULONG) Release();
|
||||||
|
|
||||||
|
// IOleClientSite methods
|
||||||
|
STDMETHODIMP SaveObject();
|
||||||
|
STDMETHODIMP GetMoniker(DWORD dwA,DWORD dwW,IMoniker**pm);
|
||||||
|
STDMETHODIMP GetContainer(IOleContainer**pc);
|
||||||
|
STDMETHODIMP ShowObject();
|
||||||
|
STDMETHODIMP OnShowWindow(BOOL f);
|
||||||
|
STDMETHODIMP RequestNewObjectLayout();
|
||||||
|
|
||||||
|
// IAdviseSink methods
|
||||||
|
STDMETHODIMP_(void) OnDataChange(FORMATETC *pFormatEtc,STGMEDIUM *pStgmed);
|
||||||
|
|
||||||
|
STDMETHODIMP_(void) OnViewChange(DWORD dwAspect,LONG lIndex);
|
||||||
|
STDMETHODIMP_(void) OnRename(IMoniker * pmk);
|
||||||
|
STDMETHODIMP_(void) OnSave();
|
||||||
|
STDMETHODIMP_(void) OnClose();
|
||||||
|
|
||||||
|
// IOleInPlaceSite methods
|
||||||
|
STDMETHODIMP GetWindow(HWND *p);
|
||||||
|
STDMETHODIMP ContextSensitiveHelp(BOOL);
|
||||||
|
STDMETHODIMP CanInPlaceActivate();
|
||||||
|
STDMETHODIMP OnInPlaceActivate();
|
||||||
|
STDMETHODIMP OnUIActivate();
|
||||||
|
STDMETHODIMP GetWindowContext(IOleInPlaceFrame** ppFrame,IOleInPlaceUIWindow **ppDoc,LPRECT r1,LPRECT r2,LPOLEINPLACEFRAMEINFO o);
|
||||||
|
STDMETHODIMP Scroll(SIZE s);
|
||||||
|
STDMETHODIMP OnUIDeactivate(int);
|
||||||
|
STDMETHODIMP OnInPlaceDeactivate();
|
||||||
|
STDMETHODIMP DiscardUndoState();
|
||||||
|
STDMETHODIMP DeactivateAndUndo();
|
||||||
|
STDMETHODIMP OnPosRectChange(LPCRECT);
|
||||||
|
|
||||||
|
// IOleInPlaceFrame methods
|
||||||
|
STDMETHODIMP GetBorder(LPRECT l);
|
||||||
|
STDMETHODIMP RequestBorderSpace(LPCBORDERWIDTHS);
|
||||||
|
STDMETHODIMP SetBorderSpace(LPCBORDERWIDTHS w);
|
||||||
|
STDMETHODIMP SetActiveObject(IOleInPlaceActiveObject*pV,LPCOLESTR s);
|
||||||
|
STDMETHODIMP InsertMenus(HMENU h,LPOLEMENUGROUPWIDTHS x);
|
||||||
|
STDMETHODIMP SetMenu(HMENU h,HOLEMENU hO,HWND hw);
|
||||||
|
STDMETHODIMP RemoveMenus(HMENU h);
|
||||||
|
STDMETHODIMP SetStatusText(LPCOLESTR t);
|
||||||
|
STDMETHODIMP EnableModeless(BOOL f);
|
||||||
|
STDMETHODIMP TranslateAccelerator(LPMSG,WORD);
|
||||||
|
|
||||||
|
|
||||||
|
// IDispatch Methods
|
||||||
|
HRESULT _stdcall GetTypeInfoCount(unsigned int * pctinfo);
|
||||||
|
HRESULT _stdcall GetTypeInfo(unsigned int iTInfo,LCID lcid,ITypeInfo FAR* FAR* ppTInfo);
|
||||||
|
HRESULT _stdcall GetIDsOfNames(REFIID riid,OLECHAR FAR* FAR*,unsigned int cNames,LCID lcid,DISPID FAR* );
|
||||||
|
HRESULT _stdcall Invoke(DISPID dispIdMember,REFIID riid,LCID lcid,WORD wFlags,DISPPARAMS FAR* pDispParams,VARIANT FAR* pVarResult,EXCEPINFO FAR* pExcepInfo,unsigned int FAR* puArgErr);
|
||||||
|
|
||||||
|
// IOleControlSite Methods
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Class AX
|
||||||
|
class AX
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
AX(char* clsid);
|
||||||
|
CLSID GetCLSID();
|
||||||
|
~AX();
|
||||||
|
|
||||||
|
|
||||||
|
void Init(char* clsid);
|
||||||
|
void Clean();
|
||||||
|
|
||||||
|
AXClientSite Site;
|
||||||
|
IID* iid;
|
||||||
|
IOleObject* OleObject;
|
||||||
|
IStorage* Storage;
|
||||||
|
IViewObject* View;
|
||||||
|
IDataObject* Data;
|
||||||
|
IUnknown* Unk;
|
||||||
|
IOleInPlaceActiveObject* Pao;
|
||||||
|
//AX_CONNECTSTRUCT* tcs;
|
||||||
|
bool AddMenu;
|
||||||
|
DWORD AdviseToken;
|
||||||
|
DWORD DAdviseToken[100];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
CLSID clsid;
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
BIN
content/cursor.png
Normal file
BIN
content/cursor.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 576 B |
BIN
content/cursor2.png
Normal file
BIN
content/cursor2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 637 B |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user