Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -52,3 +52,4 @@ G3DTest.suo
|
|||||||
G3DTest.suo
|
G3DTest.suo
|
||||||
stderr.txt
|
stderr.txt
|
||||||
desktop.ini
|
desktop.ini
|
||||||
|
main.cpp
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
2
Demo.h
2
Demo.h
@@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <G3DAll.h>
|
#include <G3DAll.h>
|
||||||
#include "CameraController.h"
|
#include "CameraController.h"
|
||||||
|
#include "PropertyWindow.h"
|
||||||
|
|
||||||
class Demo { // : public GApp {
|
class Demo { // : public GApp {
|
||||||
public:
|
public:
|
||||||
@@ -45,6 +46,7 @@ class Demo { // : public GApp {
|
|||||||
HWND _hwndToolbox;
|
HWND _hwndToolbox;
|
||||||
HWND _buttonTest;
|
HWND _buttonTest;
|
||||||
HWND _hwndRenderer;
|
HWND _hwndRenderer;
|
||||||
|
PropertyWindow* _propWindow;
|
||||||
protected:
|
protected:
|
||||||
Stopwatch m_graphicsWatch;
|
Stopwatch m_graphicsWatch;
|
||||||
Stopwatch m_logicWatch;
|
Stopwatch m_logicWatch;
|
||||||
|
|||||||
@@ -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/"
|
||||||
@@ -290,10 +290,18 @@
|
|||||||
/>
|
/>
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Property.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\propertyGrid.cpp"
|
RelativePath=".\propertyGrid.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\PropertyWindow.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\WindowFunctions.cpp"
|
RelativePath=".\WindowFunctions.cpp"
|
||||||
>
|
>
|
||||||
@@ -399,10 +407,18 @@
|
|||||||
RelativePath=".\PartType.h"
|
RelativePath=".\PartType.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Property.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\propertyGrid.h"
|
RelativePath=".\propertyGrid.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\PropertyWindow.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\resource.h"
|
RelativePath=".\resource.h"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -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(DWORD &addr, PROPGRIDITEM &pItem)
|
||||||
|
{
|
||||||
|
if((DWORD)&name == addr)
|
||||||
|
{
|
||||||
|
name = pItem.lpCurValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<Property> Instance::getProperties()
|
||||||
|
{
|
||||||
|
std::vector<Property> properties;
|
||||||
|
|
||||||
|
|
||||||
|
properties.push_back(Property(createPGI(
|
||||||
|
"Properties",
|
||||||
|
"Name",
|
||||||
|
"The name of this instance",
|
||||||
|
(LPARAM)name.c_str(),
|
||||||
|
PIT_EDIT
|
||||||
|
), (DWORD)&name));
|
||||||
|
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 "Property.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<Property> getProperties();
|
||||||
|
virtual void PropUpdate(DWORD &addr, PROPGRIDITEM &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)
|
||||||
{
|
{
|
||||||
@@ -216,5 +214,35 @@ PhysicalInstance::~PhysicalInstance(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PhysicalInstance::PropUpdate(DWORD &addr, PROPGRIDITEM &pItem)
|
||||||
|
{
|
||||||
|
if((DWORD)&name == addr)
|
||||||
|
{
|
||||||
|
name = pItem.lpCurValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<Property> PhysicalInstance::getProperties()
|
||||||
|
{
|
||||||
|
std::vector<Property> properties;
|
||||||
|
|
||||||
|
|
||||||
|
properties.push_back(Property(createPGI(
|
||||||
|
"Properties",
|
||||||
|
"Name",
|
||||||
|
"The name of this instance",
|
||||||
|
(LPARAM)name.c_str(),
|
||||||
|
PIT_EDIT
|
||||||
|
), (DWORD)&name));
|
||||||
|
char pso[512];
|
||||||
|
|
||||||
|
properties.push_back(Property(createPGI(
|
||||||
|
"Item",
|
||||||
|
"Offset",
|
||||||
|
"The position of the object in the workspace",
|
||||||
|
(LPARAM)"Coming soon",
|
||||||
|
PIT_EDIT
|
||||||
|
), (DWORD)&name));
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,12 @@ public:
|
|||||||
bool anchored;
|
bool anchored;
|
||||||
Vector3 rotVelocity;
|
Vector3 rotVelocity;
|
||||||
bool collides(Box);
|
bool collides(Box);
|
||||||
|
virtual std::vector<Property> getProperties();
|
||||||
|
virtual void PropUpdate(DWORD &addr, PROPGRIDITEM &pItem);
|
||||||
private:
|
private:
|
||||||
Vector3 position;
|
Vector3 position;
|
||||||
Vector3 size;
|
Vector3 size;
|
||||||
|
GLfloat vertecies[96];
|
||||||
|
bool changed;
|
||||||
|
Box itemBox;
|
||||||
};
|
};
|
||||||
|
|||||||
15
Property.cpp
Normal file
15
Property.cpp
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#include "Property.h"
|
||||||
|
|
||||||
|
Property::Property(PROPGRIDITEM item, DWORD addr)
|
||||||
|
{
|
||||||
|
this->addr = addr;
|
||||||
|
this->item = item;
|
||||||
|
}
|
||||||
|
|
||||||
|
Property::~Property(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
11
Property.h
Normal file
11
Property.h
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <windows.h>
|
||||||
|
#include "propertyGrid.h"
|
||||||
|
class Property
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PROPGRIDITEM item;
|
||||||
|
DWORD addr;
|
||||||
|
Property(PROPGRIDITEM item, DWORD addr);
|
||||||
|
~Property(void);
|
||||||
|
};
|
||||||
137
PropertyWindow.cpp
Normal file
137
PropertyWindow.cpp
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
#define _WINSOCKAPI_
|
||||||
|
#include <windows.h>
|
||||||
|
#include "WindowFunctions.h"
|
||||||
|
#include "Property.h"
|
||||||
|
#include "resource.h"
|
||||||
|
#include "PropertyWindow.h"
|
||||||
|
|
||||||
|
/*typedef struct typPRGP {
|
||||||
|
Instance* instance; // Declare member types
|
||||||
|
Property ∝
|
||||||
|
} PRGP;*/
|
||||||
|
|
||||||
|
//std::vector<PRGP> propvec;
|
||||||
|
LRESULT CALLBACK PropProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
PropertyWindow *propWind = (PropertyWindow *)GetWindowLongPtr(hwnd, GWL_USERDATA);
|
||||||
|
if (propWind==NULL)
|
||||||
|
{
|
||||||
|
return DefWindowProc(hwnd, msg, wParam, lParam);
|
||||||
|
}
|
||||||
|
switch(msg)
|
||||||
|
{
|
||||||
|
case WM_SIZE:
|
||||||
|
{
|
||||||
|
propWind->onResize();
|
||||||
|
}
|
||||||
|
case WM_NOTIFY:
|
||||||
|
MessageBox(NULL,"Test","Test",0);
|
||||||
|
break;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return DefWindowProc(hwnd, msg, wParam, lParam);
|
||||||
|
}
|
||||||
|
return 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",
|
||||||
|
"Prop Test",
|
||||||
|
WS_VISIBLE | WS_POPUPWINDOW | WS_THICKFRAME | WS_CAPTION,
|
||||||
|
CW_USEDEFAULT,
|
||||||
|
CW_USEDEFAULT,
|
||||||
|
300,
|
||||||
|
660,
|
||||||
|
NULL, // parent
|
||||||
|
NULL, // menu
|
||||||
|
hThisInstance,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
_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);
|
||||||
|
_redraw();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
PropertyWindow::PropertyWindow(int x, int y, int sx, int sy, HMODULE hThisInstance) {
|
||||||
|
onCreate(x, y, sx, sy, hThisInstance);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PropertyWindow::onResize()
|
||||||
|
{
|
||||||
|
_redraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PropertyWindow::_redraw()
|
||||||
|
{
|
||||||
|
RECT rect;
|
||||||
|
GetClientRect(_hwndProp,&rect);
|
||||||
|
SetWindowPos(_propGrid, NULL, 0, 20, rect.right, rect.bottom-20, SWP_NOZORDER | SWP_NOACTIVATE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PropertyWindow::SetProperties(Instance * instance)
|
||||||
|
{
|
||||||
|
PropGrid_ResetContent(_propGrid);
|
||||||
|
std::vector<Property> prop = instance->getProperties();
|
||||||
|
|
||||||
|
for(size_t i = 0; i < prop.size(); i++)
|
||||||
|
{
|
||||||
|
::PROPGRIDITEM item = prop.at(i).item;
|
||||||
|
PropGrid_AddItem(_propGrid, &item);
|
||||||
|
//PRGP propgp;
|
||||||
|
//propgp.instance = instance;
|
||||||
|
//propgp.prop = prop.at(i);
|
||||||
|
}
|
||||||
|
PropGrid_ExpandAllCatalogs(_propGrid);
|
||||||
|
SetWindowLongPtr(_propGrid,GWL_USERDATA,(LONG)this);
|
||||||
|
_redraw();
|
||||||
|
}
|
||||||
13
PropertyWindow.h
Normal file
13
PropertyWindow.h
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#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 SetProperties(Instance *);
|
||||||
|
void onResize();
|
||||||
|
private:
|
||||||
|
HWND _propGrid;
|
||||||
|
HWND _hwndProp;
|
||||||
|
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)
|
||||||
{
|
{
|
||||||
|
|||||||
73
main.cpp
73
main.cpp
@@ -38,7 +38,7 @@
|
|||||||
#include "ax.h"
|
#include "ax.h"
|
||||||
#include <cguid.h>
|
#include <cguid.h>
|
||||||
#include "IEBrowser.h"
|
#include "IEBrowser.h"
|
||||||
#include "propertyGrid.h"
|
#include "PropertyWindow.h"
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
|
|
||||||
#if G3D_VER < 61000
|
#if G3D_VER < 61000
|
||||||
@@ -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;
|
||||||
|
|
||||||
@@ -141,7 +141,7 @@ Demo::Demo(const GAppSettings& settings,HWND parentWindow) { //: GApp(settings,w
|
|||||||
|
|
||||||
SetWindowLongPtr(_hWndMain,GWL_USERDATA,(LONG)this);
|
SetWindowLongPtr(_hWndMain,GWL_USERDATA,(LONG)this);
|
||||||
SetWindowLongPtr(_hwndRenderer,GWL_USERDATA,(LONG)this);
|
SetWindowLongPtr(_hwndRenderer,GWL_USERDATA,(LONG)this);
|
||||||
|
_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/");
|
||||||
}
|
}
|
||||||
@@ -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;
|
||||||
}
|
}
|
||||||
@@ -279,7 +287,6 @@ void RotateButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
|||||||
else if(button->name == "Rotate")
|
else if(button->name == "Rotate")
|
||||||
part->setCFrame(part->getCFrame()*Matrix3::fromEulerAnglesXYZ(0,toRadians(90),0));
|
part->setCFrame(part->getCFrame()*Matrix3::fromEulerAnglesXYZ(0,toRadians(90),0));
|
||||||
}
|
}
|
||||||
selectedInstances.erase(selectedInstances.begin());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1270,6 +1277,7 @@ void Demo::onMouseLeftPressed(HWND hwnd,int x,int y)
|
|||||||
while(selectedInstances.size() > 0)
|
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;
|
||||||
@@ -1349,8 +1357,6 @@ void Boop()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
Demo *app = (Demo *)GetWindowLongPtr(hwnd, GWL_USERDATA);
|
Demo *app = (Demo *)GetWindowLongPtr(hwnd, GWL_USERDATA);
|
||||||
@@ -1611,63 +1617,12 @@ int main(int argc, char** argv) {
|
|||||||
settings.window.center = true;
|
settings.window.center = true;
|
||||||
HMODULE hThisInstance = GetModuleHandle(NULL);
|
HMODULE hThisInstance = GetModuleHandle(NULL);
|
||||||
|
|
||||||
if (!createWindowClass("propHWND",WndProc,hThisInstance))
|
|
||||||
return false;
|
|
||||||
if (!createWindowClass("mainHWND",WndProc,hThisInstance))
|
if (!createWindowClass("mainHWND",WndProc,hThisInstance))
|
||||||
return false;
|
return false;
|
||||||
if (!createWindowClass("toolboxHWND",ToolboxProc,hThisInstance))
|
if (!createWindowClass("toolboxHWND",ToolboxProc,hThisInstance))
|
||||||
return false;
|
return false;
|
||||||
if (!createWindowClass("G3DWindow",G3DProc,hThisInstance))
|
if (!createWindowClass("G3DWindow",G3DProc,hThisInstance))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
HWND hwndProp = CreateWindowEx(
|
|
||||||
WS_EX_TOOLWINDOW,
|
|
||||||
"propHWND",
|
|
||||||
"PropertyGrid",
|
|
||||||
WS_OVERLAPPEDWINDOW & ~WS_MAXIMIZEBOX & ~WS_MINIMIZEBOX,
|
|
||||||
CW_USEDEFAULT,
|
|
||||||
CW_USEDEFAULT,
|
|
||||||
300,
|
|
||||||
660,
|
|
||||||
NULL, // parent
|
|
||||||
NULL, // menu
|
|
||||||
hThisInstance,
|
|
||||||
NULL
|
|
||||||
);
|
|
||||||
ShowWindow(hwndProp,SW_SHOW);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
HWND propGrid = New_PropertyGrid(hwndProp, 1000);
|
|
||||||
//InitPropertyGrid(GetModuleHandle(NULL));
|
|
||||||
|
|
||||||
PROPGRIDITEM pItem;
|
|
||||||
PropGrid_ItemInit(pItem);
|
|
||||||
|
|
||||||
pItem.lpszCatalog="Test";
|
|
||||||
pItem.lpszPropName="Test2";
|
|
||||||
pItem.lpszzCmbItems="What\0\0";
|
|
||||||
pItem.lpszPropDesc="Description";
|
|
||||||
pItem.iItemType = PIT_EDITCOMBO;
|
|
||||||
pItem.lpCurValue=0;
|
|
||||||
//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);
|
|
||||||
pItem.iItemType=PIT_EDIT;
|
|
||||||
PropGrid_Enable(propGrid,true);
|
|
||||||
ShowWindow(propGrid,SW_SHOW);
|
|
||||||
PropGrid_AddItem(propGrid,&pItem);
|
|
||||||
PropGrid_SetItemHeight(propGrid, 20);
|
|
||||||
PropGrid_ShowToolTips(propGrid, TRUE);
|
|
||||||
PropGrid_ShowPropertyDescriptions(propGrid, TRUE);
|
|
||||||
PropGrid_ExpandAllCatalogs(propGrid);
|
|
||||||
|
|
||||||
|
|
||||||
HWND hwndMain = CreateWindowEx(
|
HWND hwndMain = CreateWindowEx(
|
||||||
WS_EX_ACCEPTFILES,
|
WS_EX_ACCEPTFILES,
|
||||||
@@ -1689,10 +1644,8 @@ int main(int argc, char** argv) {
|
|||||||
MessageBox(NULL, "Failed to create HWND", (PlaceholderName + " Crash").c_str() , MB_OK);
|
MessageBox(NULL, "Failed to create HWND", (PlaceholderName + " Crash").c_str() , MB_OK);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SendMessage(hwndMain, WM_SETICON, ICON_BIG,(LPARAM)LoadImage(GetModuleHandle(NULL), (LPCSTR)MAKEINTRESOURCEW(IDI_ICON1), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR | LR_DEFAULTSIZE));
|
SendMessage(hwndMain, WM_SETICON, ICON_BIG,(LPARAM)LoadImage(GetModuleHandle(NULL), (LPCSTR)MAKEINTRESOURCEW(IDI_ICON1), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR | LR_DEFAULTSIZE));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Demo demo = Demo(settings,hwndMain);
|
Demo demo = Demo(settings,hwndMain);
|
||||||
demo.run();
|
demo.run();
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
// Used by Dialogs.rc
|
// Used by Dialogs.rc
|
||||||
//
|
//
|
||||||
#define IDI_ICON1 102
|
#define IDI_ICON1 102
|
||||||
|
#define IDC_PROPERTYGRID 2000
|
||||||
|
|
||||||
// Next default values for new objects
|
// Next default values for new objects
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user