Made window show on double click

This commit is contained in:
andreja6
2018-10-23 15:09:08 -07:00
parent 5114ceb4b7
commit 8909ded488
4 changed files with 54 additions and 8 deletions

View File

@@ -212,7 +212,8 @@ void PhysicalInstance::render(RenderDevice* rd)
PhysicalInstance::~PhysicalInstance(void)
{
}
char pto[512];
#include <sstream>
void PhysicalInstance::PropUpdate(LPPROPGRIDITEM &item)
{
@@ -220,8 +221,36 @@ void PhysicalInstance::PropUpdate(LPPROPGRIDITEM &item)
{
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> 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");
LPCSTR str = LPCSTR(pto);
std::cout << str << std::endl;
properties.push_back(createPGI(
"Item",
"Offset",

View File

@@ -20,6 +20,11 @@ LRESULT CALLBACK PropProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
}
switch(msg)
{
case WM_CLOSE:
{
ShowWindow(hwnd, SW_HIDE);
}
break;
case WM_SIZE:
{
propWind->onResize();
@@ -56,7 +61,7 @@ bool PropertyWindow::onCreate(int x, int y, int sx, int sy, HMODULE hThisInstanc
_hwndProp = CreateWindowEx(
WS_EX_TOOLWINDOW,
"propHWND",
"Prop Test",
"PropertyGrid",
WS_VISIBLE | WS_POPUPWINDOW | WS_THICKFRAME | WS_CAPTION,
CW_USEDEFAULT,
CW_USEDEFAULT,

View File

@@ -6,8 +6,9 @@ public:
bool onCreate(int x, int y, int sx, int sy, HMODULE hThisInstance);
void SetProperties(Instance *);
void onResize();
HWND _hwndProp;
private:
HWND _propGrid;
HWND _hwndProp;
void _redraw();
};

View File

@@ -1258,8 +1258,6 @@ void Demo::onMouseLeftPressed(HWND hwnd,int x,int y)
}
if(!onGUI)
{
while(selectedInstances.size() > 0)
selectedInstances.erase(selectedInstances.begin());
testRay = cameraController.getCamera()->worldRay(dataModel->mousex, dataModel->mousey, renderDevice->getViewport());
float nearest=std::numeric_limits<float>::infinity();
Vector3 camPos = cameraController.getCamera()->getCoordinateFrame().translation;
@@ -1274,9 +1272,23 @@ void Demo::onMouseLeftPressed(HWND hwnd,int x,int y)
if (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.push_back(test);
}
_propWindow->SetProperties(test);
//message = "Dragging = true.";
//messageTime = System::time();