Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
421498e1fe | ||
|
|
8909ded488 | ||
|
|
5114ceb4b7 | ||
|
|
1472b7d6a5 | ||
|
|
52d2cbf5dd | ||
|
|
e4529a949a | ||
|
|
6d1428ced9 | ||
|
|
0f700aeda5 | ||
|
|
7273ee9ce0 | ||
|
|
1a7cd2e250 | ||
|
|
99f78be344 | ||
|
|
ee528d1245 | ||
|
|
18b856602c | ||
|
|
0dcd054da3 | ||
|
|
268a0cd2ee | ||
|
|
c71dcb8a91 | ||
|
|
24306c04ec | ||
|
|
b986815fcb | ||
|
|
a70cc31d28 | ||
|
|
b097cb15e4 |
@@ -1,14 +1,7 @@
|
|||||||
#include "DataModelInstance.h"
|
#include "DataModelInstance.h"
|
||||||
|
|
||||||
|
|
||||||
WorkspaceInstance* workspace;
|
|
||||||
Instance* guiRoot;
|
|
||||||
float mousex;
|
|
||||||
float mousey;
|
|
||||||
bool mouseButton1Down;
|
|
||||||
std::string message;
|
|
||||||
bool showMessage;
|
|
||||||
G3D::GFontRef font;
|
|
||||||
|
|
||||||
|
|
||||||
DataModelInstance::DataModelInstance(void)
|
DataModelInstance::DataModelInstance(void)
|
||||||
|
|||||||
@@ -11,8 +11,12 @@ public:
|
|||||||
void setMessage(std::string);
|
void setMessage(std::string);
|
||||||
void clearMessage();
|
void clearMessage();
|
||||||
void drawMessage(RenderDevice*);
|
void drawMessage(RenderDevice*);
|
||||||
GFontRef font;
|
|
||||||
WorkspaceInstance* getWorkspace();
|
WorkspaceInstance* getWorkspace();
|
||||||
|
WorkspaceInstance* workspace;
|
||||||
|
Instance* guiRoot;
|
||||||
|
std::string message;
|
||||||
|
bool showMessage;
|
||||||
|
G3D::GFontRef font;
|
||||||
Instance* getGuiRoot();
|
Instance* getGuiRoot();
|
||||||
float mousex;
|
float mousex;
|
||||||
float mousey;
|
float mousey;
|
||||||
|
|||||||
@@ -74,7 +74,7 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalDependencies="Advapi32.lib UxTheme.lib Comctl32.lib"
|
AdditionalDependencies="Advapi32.lib UxTheme.lib Comctl32.lib Comdlg32.lib Shell32.lib"
|
||||||
OutputFile="./G3DTest.exe"
|
OutputFile="./G3DTest.exe"
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
SuppressStartupBanner="true"
|
SuppressStartupBanner="true"
|
||||||
@@ -147,8 +147,8 @@
|
|||||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
|
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
|
||||||
MinimalRebuild="false"
|
MinimalRebuild="false"
|
||||||
BasicRuntimeChecks="0"
|
BasicRuntimeChecks="0"
|
||||||
RuntimeLibrary="2"
|
RuntimeLibrary="3"
|
||||||
EnableFunctionLevelLinking="true"
|
EnableFunctionLevelLinking="false"
|
||||||
PrecompiledHeaderFile=".\Debug/G3DTest.pch"
|
PrecompiledHeaderFile=".\Debug/G3DTest.pch"
|
||||||
AssemblerListingLocation=".\Debug/"
|
AssemblerListingLocation=".\Debug/"
|
||||||
ObjectFile=".\Debug/"
|
ObjectFile=".\Debug/"
|
||||||
@@ -176,7 +176,7 @@
|
|||||||
SuppressStartupBanner="true"
|
SuppressStartupBanner="true"
|
||||||
GenerateDebugInformation="true"
|
GenerateDebugInformation="true"
|
||||||
ProgramDatabaseFile=".\Debug/G3DTest.pdb"
|
ProgramDatabaseFile=".\Debug/G3DTest.pdb"
|
||||||
SubSystem="2"
|
SubSystem="1"
|
||||||
TargetMachine="1"
|
TargetMachine="1"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
//#include "WindowFunctions.h"
|
//#include "WindowFunctions.h"
|
||||||
|
#pragma once
|
||||||
#include <mshtml.h>
|
#include <mshtml.h>
|
||||||
#include <exdisp.h>
|
#include <exdisp.h>
|
||||||
//#include <Mshtmhst.h>
|
//#include <Mshtmhst.h>
|
||||||
|
|||||||
@@ -1,14 +1,5 @@
|
|||||||
#include "ImageButtonInstance.h"
|
#include "ImageButtonInstance.h"
|
||||||
G3D::TextureRef image = NULL;
|
|
||||||
int openGLID = 0;
|
|
||||||
G3D::TextureRef image_ovr = NULL;
|
|
||||||
int openGLID_ovr = 0;
|
|
||||||
G3D::TextureRef image_dn = NULL;
|
|
||||||
int openGLID_dn = 0;
|
|
||||||
G3D::TextureRef image_ds = NULL;
|
|
||||||
int openGLID_ds = 0;
|
|
||||||
Vector2 size;
|
|
||||||
Vector2 position;
|
|
||||||
ImageButtonInstance::ImageButtonInstance(G3D::TextureRef newImage, G3D::TextureRef overImage = NULL, G3D::TextureRef downImage = NULL, G3D::TextureRef disableImage = NULL)
|
ImageButtonInstance::ImageButtonInstance(G3D::TextureRef newImage, G3D::TextureRef overImage = NULL, G3D::TextureRef downImage = NULL, G3D::TextureRef disableImage = NULL)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
48
Instance.cpp
48
Instance.cpp
@@ -2,10 +2,6 @@
|
|||||||
#include <G3DAll.h>
|
#include <G3DAll.h>
|
||||||
#include "Instance.h"
|
#include "Instance.h"
|
||||||
|
|
||||||
std::string name;
|
|
||||||
Instance* parent = NULL;
|
|
||||||
std::vector<Instance* > children;
|
|
||||||
static std::string className = "BaseInstance";
|
|
||||||
|
|
||||||
Instance::Instance(void)
|
Instance::Instance(void)
|
||||||
{
|
{
|
||||||
@@ -21,6 +17,8 @@ Instance::Instance(const Instance &oinst)
|
|||||||
className = oinst.className;
|
className = oinst.className;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Instance::render(RenderDevice* rd)
|
void Instance::render(RenderDevice* rd)
|
||||||
{
|
{
|
||||||
for(size_t i = 0; i < children.size(); i++)
|
for(size_t i = 0; i < children.size(); i++)
|
||||||
@@ -29,6 +27,45 @@ void Instance::render(RenderDevice* rd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PROPGRIDITEM Instance::createPGI(LPSTR catalog, LPSTR propName, LPSTR propDesc, LPARAM curVal, INT type)
|
||||||
|
{
|
||||||
|
PROPGRIDITEM pItem;
|
||||||
|
PropGrid_ItemInit(pItem);
|
||||||
|
pItem.lpszCatalog=catalog;
|
||||||
|
pItem.lpszPropName=propName;
|
||||||
|
pItem.lpszPropDesc=propDesc;
|
||||||
|
pItem.lpCurValue=curVal;
|
||||||
|
pItem.iItemType=type;
|
||||||
|
return pItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Instance::PropUpdate(LPPROPGRIDITEM &item)
|
||||||
|
{
|
||||||
|
if(strcmp(item->lpszPropName, "Name") == 0)
|
||||||
|
{
|
||||||
|
name = 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)
|
||||||
{
|
{
|
||||||
for(size_t i = 0; i < children.size(); i++)
|
for(size_t i = 0; i < children.size(); i++)
|
||||||
@@ -110,3 +147,6 @@ Instance* Instance::findFirstChild(std::string name)
|
|||||||
}
|
}
|
||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include <G3DAll.h>
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include <G3DAll.h>
|
||||||
|
#include "propertyGrid.h"
|
||||||
class Instance
|
class Instance
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -19,7 +20,11 @@ public:
|
|||||||
void removeChild(Instance*);
|
void removeChild(Instance*);
|
||||||
Instance* getParent();
|
Instance* getParent();
|
||||||
virtual Instance* clone() const { return new Instance(*this); }
|
virtual Instance* clone() const { return new Instance(*this); }
|
||||||
|
virtual std::vector<PROPGRIDITEM> getProperties();
|
||||||
|
virtual void PropUpdate(LPPROPGRIDITEM &pItem);
|
||||||
protected:
|
protected:
|
||||||
std::string className;
|
std::string className;
|
||||||
Instance* parent; // Another pointer.
|
Instance* parent; // Another pointer.
|
||||||
|
PROPGRIDITEM createPGI(LPSTR catalog, LPSTR propName, LPSTR propDesc, LPARAM curVal, INT type);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
#include "PhysicalInstance.h"
|
#include "PhysicalInstance.h"
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
GLfloat vertecies[96];
|
|
||||||
bool changed = true;
|
|
||||||
Box itemBox = Box();
|
|
||||||
|
|
||||||
PhysicalInstance::PhysicalInstance(void)
|
PhysicalInstance::PhysicalInstance(void)
|
||||||
{
|
{
|
||||||
@@ -214,7 +212,69 @@ void PhysicalInstance::render(RenderDevice* rd)
|
|||||||
PhysicalInstance::~PhysicalInstance(void)
|
PhysicalInstance::~PhysicalInstance(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
char pto[512];
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
void PhysicalInstance::PropUpdate(LPPROPGRIDITEM &item)
|
||||||
|
{
|
||||||
|
if(strcmp(item->lpszPropName, "Name") == 0)
|
||||||
|
{
|
||||||
|
name = (LPTSTR)item->lpCurValue;
|
||||||
|
}
|
||||||
|
else if(strcmp(item->lpszPropName, "Offset") == 0)
|
||||||
|
{
|
||||||
|
std::string str = (LPTSTR)item->lpCurValue;
|
||||||
|
std::vector<float> vect;
|
||||||
|
std::stringstream ss(str);
|
||||||
|
float i;
|
||||||
|
|
||||||
|
while (ss >> i)
|
||||||
|
{
|
||||||
|
vect.push_back(i);
|
||||||
|
|
||||||
|
if (ss.peek() == ',')
|
||||||
|
ss.ignore();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(vect.size() != 3)
|
||||||
|
{
|
||||||
|
sprintf(pto, "%g, %g, %g", cFrame.translation.x, cFrame.translation.y, cFrame.translation.z, "what");
|
||||||
|
LPCSTR str = LPCSTR(pto);
|
||||||
|
item->lpCurValue = (LPARAM)str;
|
||||||
|
MessageBox(NULL, "NO","NO", MB_OK);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Vector3 pos(vect.at(0),vect.at(1),vect.at(2));
|
||||||
|
setPosition(pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<PROPGRIDITEM> PhysicalInstance::getProperties()
|
||||||
|
{
|
||||||
|
std::vector<PROPGRIDITEM> properties;
|
||||||
|
|
||||||
|
|
||||||
|
properties.push_back(createPGI(
|
||||||
|
"Properties",
|
||||||
|
"Name",
|
||||||
|
"The name of this instance",
|
||||||
|
(LPARAM)name.c_str(),
|
||||||
|
PIT_EDIT
|
||||||
|
));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
sprintf(pto, "%g, %g, %g", cFrame.translation.x, cFrame.translation.y, cFrame.translation.z, "what");
|
||||||
|
LPCSTR str = LPCSTR(pto);
|
||||||
|
properties.push_back(createPGI(
|
||||||
|
"Item",
|
||||||
|
"Offset",
|
||||||
|
"The position of the object in the workspace",
|
||||||
|
(LPARAM)str,
|
||||||
|
PIT_EDIT
|
||||||
|
));
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,12 @@ public:
|
|||||||
bool anchored;
|
bool anchored;
|
||||||
Vector3 rotVelocity;
|
Vector3 rotVelocity;
|
||||||
bool collides(Box);
|
bool collides(Box);
|
||||||
|
virtual std::vector<PROPGRIDITEM> getProperties();
|
||||||
|
virtual void PropUpdate(LPPROPGRIDITEM &pItem);
|
||||||
private:
|
private:
|
||||||
Vector3 position;
|
Vector3 position;
|
||||||
Vector3 size;
|
Vector3 size;
|
||||||
|
GLfloat vertecies[96];
|
||||||
|
bool changed;
|
||||||
|
Box itemBox;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,9 +1,16 @@
|
|||||||
|
#define _WINSOCKAPI_
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include "WindowFunctions.h"
|
#include "WindowFunctions.h"
|
||||||
#include "propertyGrid.h"
|
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include "PropertyWindow.h"
|
#include "PropertyWindow.h"
|
||||||
|
|
||||||
|
/*typedef struct typPRGP {
|
||||||
|
Instance* instance; // Declare member types
|
||||||
|
Property ∝
|
||||||
|
} PRGP;*/
|
||||||
|
|
||||||
|
std::vector<PROPGRIDITEM> prop;
|
||||||
|
Instance* selectedInstance;
|
||||||
LRESULT CALLBACK PropProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
LRESULT CALLBACK PropProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
PropertyWindow *propWind = (PropertyWindow *)GetWindowLongPtr(hwnd, GWL_USERDATA);
|
PropertyWindow *propWind = (PropertyWindow *)GetWindowLongPtr(hwnd, GWL_USERDATA);
|
||||||
@@ -13,11 +20,34 @@ LRESULT CALLBACK PropProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||||||
}
|
}
|
||||||
switch(msg)
|
switch(msg)
|
||||||
{
|
{
|
||||||
|
case WM_CLOSE:
|
||||||
|
{
|
||||||
|
ShowWindow(hwnd, SW_HIDE);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case WM_SIZE:
|
case WM_SIZE:
|
||||||
{
|
{
|
||||||
propWind->onResize();
|
propWind->onResize();
|
||||||
}
|
}
|
||||||
break;
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//MessageBox(NULL,"Test","Test",0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return DefWindowProc(hwnd, msg, wParam, lParam);
|
return DefWindowProc(hwnd, msg, wParam, lParam);
|
||||||
}
|
}
|
||||||
@@ -31,7 +61,7 @@ bool PropertyWindow::onCreate(int x, int y, int sx, int sy, HMODULE hThisInstanc
|
|||||||
_hwndProp = CreateWindowEx(
|
_hwndProp = CreateWindowEx(
|
||||||
WS_EX_TOOLWINDOW,
|
WS_EX_TOOLWINDOW,
|
||||||
"propHWND",
|
"propHWND",
|
||||||
"Prop Test",
|
"PropertyGrid",
|
||||||
WS_VISIBLE | WS_POPUPWINDOW | WS_THICKFRAME | WS_CAPTION,
|
WS_VISIBLE | WS_POPUPWINDOW | WS_THICKFRAME | WS_CAPTION,
|
||||||
CW_USEDEFAULT,
|
CW_USEDEFAULT,
|
||||||
CW_USEDEFAULT,
|
CW_USEDEFAULT,
|
||||||
@@ -45,7 +75,7 @@ bool PropertyWindow::onCreate(int x, int y, int sx, int sy, HMODULE hThisInstanc
|
|||||||
|
|
||||||
_propGrid = New_PropertyGrid(_hwndProp,IDC_PROPERTYGRID);
|
_propGrid = New_PropertyGrid(_hwndProp,IDC_PROPERTYGRID);
|
||||||
|
|
||||||
PROPGRIDITEM pItem;
|
/*PROPGRIDITEM pItem;
|
||||||
PropGrid_ItemInit(pItem);
|
PropGrid_ItemInit(pItem);
|
||||||
|
|
||||||
pItem.lpszCatalog="Test";
|
pItem.lpszCatalog="Test";
|
||||||
@@ -79,14 +109,14 @@ bool PropertyWindow::onCreate(int x, int y, int sx, int sy, HMODULE hThisInstanc
|
|||||||
|
|
||||||
PropGrid_Enable(_propGrid,true);
|
PropGrid_Enable(_propGrid,true);
|
||||||
ShowWindow(_propGrid,SW_SHOW);
|
ShowWindow(_propGrid,SW_SHOW);
|
||||||
PropGrid_AddItem(_propGrid,&pItem);
|
// PropGrid_AddItem(_propGrid,&pItem);
|
||||||
PropGrid_AddItem(_propGrid,&pItem2);
|
// PropGrid_AddItem(_propGrid,&pItem2);
|
||||||
PropGrid_SetItemHeight(_propGrid,20);
|
PropGrid_SetItemHeight(_propGrid,20);
|
||||||
PropGrid_ShowToolTips(_propGrid,TRUE);
|
PropGrid_ShowToolTips(_propGrid,TRUE);
|
||||||
PropGrid_ShowPropertyDescriptions(_propGrid,TRUE);
|
PropGrid_ShowPropertyDescriptions(_propGrid,TRUE);
|
||||||
PropGrid_ExpandAllCatalogs(_propGrid);
|
PropGrid_ExpandAllCatalogs(_propGrid);
|
||||||
|
|
||||||
SetWindowLongPtr(_propGrid,GWL_USERDATA,(LONG)this);
|
SetWindowLongPtr(_hwndProp,GWL_USERDATA,(LONG)this);
|
||||||
_redraw();
|
_redraw();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -107,3 +137,26 @@ void PropertyWindow::_redraw()
|
|||||||
GetClientRect(_hwndProp,&rect);
|
GetClientRect(_hwndProp,&rect);
|
||||||
SetWindowPos(_propGrid, NULL, 0, 20, rect.right, rect.bottom-20, SWP_NOZORDER | SWP_NOACTIVATE);
|
SetWindowPos(_propGrid, NULL, 0, 20, rect.right, rect.bottom-20, SWP_NOZORDER | SWP_NOACTIVATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PropertyWindow::SetProperties(Instance * instance)
|
||||||
|
{
|
||||||
|
PropGrid_ResetContent(_propGrid);
|
||||||
|
prop = instance->getProperties();
|
||||||
|
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);
|
||||||
|
_redraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PropertyWindow::ClearProperties()
|
||||||
|
{
|
||||||
|
PropGrid_ResetContent(_propGrid);
|
||||||
|
}
|
||||||
@@ -1,12 +1,15 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
#include "Instance.h"
|
||||||
class PropertyWindow {
|
class PropertyWindow {
|
||||||
public:
|
public:
|
||||||
PropertyWindow(int x, int y, int sx, int sy, HMODULE hThisInstance);
|
PropertyWindow(int x, int y, int sx, int sy, HMODULE hThisInstance);
|
||||||
bool onCreate(int x, int y, int sx, int sy, HMODULE hThisInstance);
|
bool onCreate(int x, int y, int sx, int sy, HMODULE hThisInstance);
|
||||||
|
void SetProperties(Instance *);
|
||||||
|
void ClearProperties();
|
||||||
void onResize();
|
void onResize();
|
||||||
|
|
||||||
|
HWND _hwndProp;
|
||||||
private:
|
private:
|
||||||
HWND _propGrid;
|
HWND _propGrid;
|
||||||
HWND _hwndProp;
|
|
||||||
void _redraw();
|
void _redraw();
|
||||||
};
|
};
|
||||||
@@ -1,25 +1,5 @@
|
|||||||
#include "TextButtonInstance.h"
|
#include "TextButtonInstance.h"
|
||||||
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;
|
|
||||||
bool centeredWithinBox;
|
|
||||||
std::string title;
|
|
||||||
G3D::GFontRef* font;
|
|
||||||
int textSize;
|
|
||||||
|
|
||||||
bool visible;
|
|
||||||
|
|
||||||
TextButtonInstance::TextButtonInstance(void)
|
TextButtonInstance::TextButtonInstance(void)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#include "WorkspaceInstance.h"
|
#include "WorkspaceInstance.h"
|
||||||
float timer = 60.0F;
|
|
||||||
int score = 0;
|
|
||||||
|
|
||||||
WorkspaceInstance::WorkspaceInstance(void)
|
WorkspaceInstance::WorkspaceInstance(void)
|
||||||
{
|
{
|
||||||
|
|||||||
46
main.cpp
46
main.cpp
@@ -79,7 +79,7 @@ bool dragging = false;
|
|||||||
Vector2 oldMouse = Vector2(0,0);
|
Vector2 oldMouse = Vector2(0,0);
|
||||||
float moveRate = 0.5;
|
float moveRate = 0.5;
|
||||||
std::vector<Instance*> selectedInstances = std::vector<Instance*>();
|
std::vector<Instance*> selectedInstances = std::vector<Instance*>();
|
||||||
static const std::string PlaceholderName = "Dynamica";
|
static const std::string PlaceholderName = "HyperCube";
|
||||||
|
|
||||||
Demo *usableApp = NULL;
|
Demo *usableApp = NULL;
|
||||||
|
|
||||||
@@ -143,7 +143,7 @@ Demo::Demo(const GAppSettings& settings,HWND parentWindow) { //: GApp(settings,w
|
|||||||
SetWindowLongPtr(_hwndRenderer,GWL_USERDATA,(LONG)this);
|
SetWindowLongPtr(_hwndRenderer,GWL_USERDATA,(LONG)this);
|
||||||
_propWindow = new PropertyWindow(0, 0, 200, 640, hThisInstance);
|
_propWindow = new PropertyWindow(0, 0, 200, 640, hThisInstance);
|
||||||
IEBrowser* webBrowser = new IEBrowser(_hwndToolbox);
|
IEBrowser* webBrowser = new IEBrowser(_hwndToolbox);
|
||||||
webBrowser->navigateSyncURL(L"http://scottbeebiwan.tk/g3d/toolbox/");
|
//webBrowser->navigateSyncURL(L"http://scottbeebiwan.tk/g3d/toolbox/");
|
||||||
}
|
}
|
||||||
|
|
||||||
void clearInstances()
|
void clearInstances()
|
||||||
@@ -254,7 +254,15 @@ void GUDButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
|||||||
std::vector<Instance*> newinst;
|
std::vector<Instance*> newinst;
|
||||||
for(size_t i = 0; i < selectedInstances.size(); i++)
|
for(size_t i = 0; i < selectedInstances.size(); i++)
|
||||||
{
|
{
|
||||||
newinst.push_back(selectedInstances.at(i)->clone());
|
PhysicalInstance* tempinst = (PhysicalInstance*) selectedInstances.at(i);
|
||||||
|
Vector3 tempPos = tempinst->getPosition();
|
||||||
|
Vector3 tempSize = tempinst->getSize();
|
||||||
|
|
||||||
|
PhysicalInstance* clonedInstance = (PhysicalInstance*) selectedInstances.at(i)->clone();
|
||||||
|
|
||||||
|
newinst.push_back(tempinst);
|
||||||
|
/*tempinst->setPosition(Vector3(tempPos.x, tempPos.y + tempSize.y, tempPos.z));
|
||||||
|
usableApp->cameraController.centerCamera(selectedInstances.at(0));*/
|
||||||
}
|
}
|
||||||
selectedInstances = newinst;
|
selectedInstances = newinst;
|
||||||
}
|
}
|
||||||
@@ -1250,31 +1258,53 @@ void Demo::onMouseLeftPressed(HWND hwnd,int x,int y)
|
|||||||
}
|
}
|
||||||
if(!onGUI)
|
if(!onGUI)
|
||||||
{
|
{
|
||||||
while(selectedInstances.size() > 0)
|
|
||||||
selectedInstances.erase(selectedInstances.begin());
|
|
||||||
testRay = cameraController.getCamera()->worldRay(dataModel->mousex, dataModel->mousey, renderDevice->getViewport());
|
testRay = cameraController.getCamera()->worldRay(dataModel->mousex, dataModel->mousey, renderDevice->getViewport());
|
||||||
float nearest=std::numeric_limits<float>::infinity();
|
float nearest=std::numeric_limits<float>::infinity();
|
||||||
Vector3 camPos = cameraController.getCamera()->getCoordinateFrame().translation;
|
Vector3 camPos = cameraController.getCamera()->getCoordinateFrame().translation;
|
||||||
std::vector<Instance*> instances = dataModel->getWorkspace()->getAllChildren();
|
std::vector<Instance*> instances = dataModel->getWorkspace()->getAllChildren();
|
||||||
for(size_t i = 0; i < instances.size(); i++)
|
bool objFound = false;
|
||||||
|
for(size_t i = 0; i < instances.size(); i++)
|
||||||
{
|
{
|
||||||
if(PhysicalInstance* test = dynamic_cast<PhysicalInstance*>(instances.at(i)))
|
if(PhysicalInstance* test = dynamic_cast<PhysicalInstance*>(instances.at(i)))
|
||||||
{
|
{
|
||||||
float time = testRay.intersectionTime(test->getBox());
|
float time = testRay.intersectionTime(test->getBox());
|
||||||
|
|
||||||
if (time != inf())
|
if (time != inf())
|
||||||
{
|
{
|
||||||
|
objFound = true;
|
||||||
if (nearest>time)
|
if (nearest>time)
|
||||||
{
|
{
|
||||||
nearest=time;
|
nearest=time;
|
||||||
while(selectedInstances.size() > 0)
|
bool found = false;
|
||||||
|
for(size_t i = 0; i < selectedInstances.size(); i++)
|
||||||
|
{
|
||||||
|
if(selectedInstances.at(i) == test)
|
||||||
|
{
|
||||||
|
found = true;
|
||||||
|
ShowWindow(_propWindow->_hwndProp, SW_SHOW);
|
||||||
|
SetActiveWindow(_propWindow->_hwndProp);
|
||||||
|
SetForegroundWindow(_propWindow->_hwndProp);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!found)
|
||||||
|
{while(selectedInstances.size() > 0)
|
||||||
selectedInstances.erase(selectedInstances.begin());
|
selectedInstances.erase(selectedInstances.begin());
|
||||||
selectedInstances.push_back(test);
|
selectedInstances.push_back(test);
|
||||||
|
}
|
||||||
|
_propWindow->SetProperties(test);
|
||||||
//message = "Dragging = true.";
|
//message = "Dragging = true.";
|
||||||
//messageTime = System::time();
|
//messageTime = System::time();
|
||||||
//dragging = true;
|
//dragging = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if(!objFound)
|
||||||
|
{
|
||||||
|
while(selectedInstances.size() > 0)
|
||||||
|
selectedInstances.erase(selectedInstances.begin());
|
||||||
|
_propWindow->ClearProperties();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user