Added properties to PhysicalInstance
This commit is contained in:
32
Instance.cpp
32
Instance.cpp
@@ -17,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++)
|
||||||
@@ -25,6 +27,20 @@ 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)
|
void Instance::PropUpdate(DWORD &addr, PROPGRIDITEM &pItem)
|
||||||
{
|
{
|
||||||
if((DWORD)&name == addr)
|
if((DWORD)&name == addr)
|
||||||
@@ -36,15 +52,15 @@ void Instance::PropUpdate(DWORD &addr, PROPGRIDITEM &pItem)
|
|||||||
std::vector<Property> Instance::getProperties()
|
std::vector<Property> Instance::getProperties()
|
||||||
{
|
{
|
||||||
std::vector<Property> properties;
|
std::vector<Property> properties;
|
||||||
PROPGRIDITEM pItem;
|
|
||||||
PropGrid_ItemInit(pItem);
|
|
||||||
pItem.lpszCatalog="Properties";
|
|
||||||
pItem.lpszPropName="Name";
|
|
||||||
pItem.lpszPropDesc="The name of the current instance";
|
|
||||||
pItem.lpCurValue=(LPARAM)name.c_str();
|
|
||||||
pItem.iItemType=PIT_EDIT;
|
|
||||||
|
|
||||||
properties.push_back(Property(pItem, (DWORD)&name));
|
|
||||||
|
properties.push_back(Property(createPGI(
|
||||||
|
"Properties",
|
||||||
|
"Name",
|
||||||
|
"The name of this instance",
|
||||||
|
(LPARAM)name.c_str(),
|
||||||
|
PIT_EDIT
|
||||||
|
), (DWORD)&name));
|
||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,5 +25,6 @@ public:
|
|||||||
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);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -214,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,6 +33,8 @@ 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;
|
||||||
|
|||||||
Reference in New Issue
Block a user