Made window show on double click
This commit is contained in:
@@ -212,7 +212,8 @@ void PhysicalInstance::render(RenderDevice* rd)
|
|||||||
PhysicalInstance::~PhysicalInstance(void)
|
PhysicalInstance::~PhysicalInstance(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
char pto[512];
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
void PhysicalInstance::PropUpdate(LPPROPGRIDITEM &item)
|
void PhysicalInstance::PropUpdate(LPPROPGRIDITEM &item)
|
||||||
{
|
{
|
||||||
@@ -220,8 +221,36 @@ void PhysicalInstance::PropUpdate(LPPROPGRIDITEM &item)
|
|||||||
{
|
{
|
||||||
name = (LPTSTR)item->lpCurValue;
|
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();
|
||||||
}
|
}
|
||||||
char pto[512];
|
|
||||||
|
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> PhysicalInstance::getProperties()
|
||||||
{
|
{
|
||||||
std::vector<PROPGRIDITEM> properties;
|
std::vector<PROPGRIDITEM> properties;
|
||||||
@@ -239,7 +268,6 @@ std::vector<PROPGRIDITEM> PhysicalInstance::getProperties()
|
|||||||
|
|
||||||
sprintf(pto, "%g, %g, %g", cFrame.translation.x, cFrame.translation.y, cFrame.translation.z, "what");
|
sprintf(pto, "%g, %g, %g", cFrame.translation.x, cFrame.translation.y, cFrame.translation.z, "what");
|
||||||
LPCSTR str = LPCSTR(pto);
|
LPCSTR str = LPCSTR(pto);
|
||||||
std::cout << str << std::endl;
|
|
||||||
properties.push_back(createPGI(
|
properties.push_back(createPGI(
|
||||||
"Item",
|
"Item",
|
||||||
"Offset",
|
"Offset",
|
||||||
|
|||||||
@@ -20,6 +20,11 @@ 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();
|
||||||
@@ -56,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,
|
||||||
|
|||||||
@@ -6,8 +6,9 @@ public:
|
|||||||
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 SetProperties(Instance *);
|
||||||
void onResize();
|
void onResize();
|
||||||
|
|
||||||
|
HWND _hwndProp;
|
||||||
private:
|
private:
|
||||||
HWND _propGrid;
|
HWND _propGrid;
|
||||||
HWND _hwndProp;
|
|
||||||
void _redraw();
|
void _redraw();
|
||||||
};
|
};
|
||||||
18
main.cpp
18
main.cpp
@@ -1258,8 +1258,6 @@ 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;
|
||||||
@@ -1274,9 +1272,23 @@ void Demo::onMouseLeftPressed(HWND hwnd,int x,int y)
|
|||||||
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);
|
_propWindow->SetProperties(test);
|
||||||
//message = "Dragging = true.";
|
//message = "Dragging = true.";
|
||||||
//messageTime = System::time();
|
//messageTime = System::time();
|
||||||
|
|||||||
Reference in New Issue
Block a user