Seryov 17 Posted March 22, 2018 Share Posted March 22, 2018 Please, someone can share the function "SetPercentageWithScale", to set a progressbar with scale. Link to comment Share on other sites More sharing options...
Honorable Member xP3NG3Rx 19683 Posted March 22, 2018 Honorable Member Share Posted March 22, 2018 #ui.py def SetPercentageWithScale(self, curValue, maxValue): wndMgr.SetRenderingRectWithScale(self.hWnd, 0.0, 0.0, -1.0 + float(curValue) / float(maxValue), 0.0) // EterPythonLib/PythonWindowManagerModule.cpp PyObject * wndImageSetRenderingRectWithScale(PyObject * poSelf, PyObject * poArgs) { UI::CWindow * pWindow; if (!PyTuple_GetWindow(poArgs, 0, &pWindow)) return Py_BuildException(); float fLeft; if (!PyTuple_GetFloat(poArgs, 1, &fLeft)) return Py_BuildException(); float fTop; if (!PyTuple_GetFloat(poArgs, 2, &fTop)) return Py_BuildException(); float fRight; if (!PyTuple_GetFloat(poArgs, 3, &fRight)) return Py_BuildException(); float fBottom; if (!PyTuple_GetFloat(poArgs, 4, &fBottom)) return Py_BuildException(); if (pWindow->IsType(UI::CExpandedImageBox::Type())) ((UI::CExpandedImageBox*)pWindow)->SetRenderingRectWithScale(fLeft, fTop, fRight, fBottom); else if (pWindow->IsType(UI::CAniImageBox::Type())) ((UI::CAniImageBox*)pWindow)->SetRenderingRectWithScale(fLeft, fTop, fRight, fBottom); return Py_BuildNone(); } // Bottom of the file where is the functionlist: { "SetRenderingRectWithScale", wndImageSetRenderingRectWithScale, METH_VARARGS }, // EterPythonLib/PythonWindow.h // class CExpandedImageBox --> Public function definition: void SetRenderingRectWithScale(float fLeft, float fTop, float fRight, float fBottom); // class CAniImageBox --> Public function definition: void SetRenderingRectWithScale(float fLeft, float fTop, float fRight, float fBottom); // EterPythonLib/PythonWindow.cpp // Add this near to the CExcpandedImageBox functions void CExpandedImageBox::SetRenderingRectWithScale(float fLeft, float fTop, float fRight, float fBottom) { if (!m_pImageInstance) return; ((CGraphicExpandedImageInstance*)m_pImageInstance)->SetRenderingRectWithScale(fLeft, fTop, fRight, fBottom); } // Add this near to the CAniImageBox functions struct FSetRenderingRectWithScale { float fLeft, fTop, fRight, fBottom; void operator () (CGraphicExpandedImageInstance * pInstance) { pInstance->SetRenderingRectWithScale(fLeft, fTop, fRight, fBottom); } }; void CAniImageBox::SetRenderingRectWithScale(float fLeft, float fTop, float fRight, float fBottom) { FSetRenderingRectWithScale setRenderingRect; setRenderingRect.fLeft = fLeft; setRenderingRect.fTop = fTop; setRenderingRect.fRight = fRight; setRenderingRect.fBottom = fBottom; for_each(m_ImageVector.begin(), m_ImageVector.end(), setRenderingRect); } // EterLib/GrpExpandedImageInstance.h // class CGraphicExpandedImageInstance --> Public function definition: void SetRenderingRectWithScale(float fLeft, float fTop, float fRight, float fBottom); // EterLib/GrpExpandedImageInstance.cpp void CGraphicExpandedImageInstance::SetRenderingRectWithScale(float fLeft, float fTop, float fRight, float fBottom) { if (IsEmpty()) return; float fWidth = float(GetWidth() * m_v2Scale.x); float fHeight = float(GetHeight() * m_v2Scale.y); m_RenderingRect.left = fWidth * fLeft; m_RenderingRect.top = fHeight * fTop; m_RenderingRect.right = fWidth * fRight; m_RenderingRect.bottom = fHeight * fBottom; } A couple of minutes of RE 1 4 Link to comment Share on other sites More sharing options...
Seryov 17 Posted March 22, 2018 Author Share Posted March 22, 2018 2 hours ago, xP3NG3Rx said: #ui.py def SetPercentageWithScale(self, curValue, maxValue): wndMgr.SetRenderingRectWithScale(self.hWnd, 0.0, 0.0, -1.0 + float(curValue) / float(maxValue), 0.0) // EterPythonLib/PythonWindowManagerModule.cpp PyObject * wndImageSetRenderingRectWithScale(PyObject * poSelf, PyObject * poArgs) { UI::CWindow * pWindow; if (!PyTuple_GetWindow(poArgs, 0, &pWindow)) return Py_BuildException(); float fLeft; if (!PyTuple_GetFloat(poArgs, 1, &fLeft)) return Py_BuildException(); float fTop; if (!PyTuple_GetFloat(poArgs, 2, &fTop)) return Py_BuildException(); float fRight; if (!PyTuple_GetFloat(poArgs, 3, &fRight)) return Py_BuildException(); float fBottom; if (!PyTuple_GetFloat(poArgs, 4, &fBottom)) return Py_BuildException(); if (pWindow->IsType(UI::CExpandedImageBox::Type())) ((UI::CExpandedImageBox*)pWindow)->SetRenderingRectWithScale(fLeft, fTop, fRight, fBottom); else if (pWindow->IsType(UI::CAniImageBox::Type())) ((UI::CAniImageBox*)pWindow)->SetRenderingRectWithScale(fLeft, fTop, fRight, fBottom); return Py_BuildNone(); } // Bottom of the file where is the functionlist: { "SetRenderingRectWithScale", wndImageSetRenderingRectWithScale, METH_VARARGS }, // EterPythonLib/PythonWindow.h // class CExpandedImageBox --> Public function definition: void SetRenderingRectWithScale(float fLeft, float fTop, float fRight, float fBottom); // class CAniImageBox --> Public function definition: void SetRenderingRectWithScale(float fLeft, float fTop, float fRight, float fBottom); // EterPythonLib/PythonWindow.cpp // Add this near to the CExcpandedImageBox functions void CExpandedImageBox::SetRenderingRectWithScale(float fLeft, float fTop, float fRight, float fBottom) { if (!m_pImageInstance) return; ((CGraphicExpandedImageInstance*)m_pImageInstance)->SetRenderingRectWithScale(fLeft, fTop, fRight, fBottom); } // Add this near to the CAniImageBox functions struct FSetRenderingRectWithScale { float fLeft, fTop, fRight, fBottom; void operator () (CGraphicExpandedImageInstance * pInstance) { pInstance->SetRenderingRectWithScale(fLeft, fTop, fRight, fBottom); } }; void CAniImageBox::SetRenderingRectWithScale(float fLeft, float fTop, float fRight, float fBottom) { FSetRenderingRectWithScale setRenderingRect; setRenderingRect.fLeft = fLeft; setRenderingRect.fTop = fTop; setRenderingRect.fRight = fRight; setRenderingRect.fBottom = fBottom; for_each(m_ImageVector.begin(), m_ImageVector.end(), setRenderingRect); } // EterLib/GrpExpandedImageInstance.h // class CGraphicExpandedImageInstance --> Public function definition: void SetRenderingRectWithScale(float fLeft, float fTop, float fRight, float fBottom); // EterLib/GrpExpandedImageInstance.cpp void CGraphicExpandedImageInstance::SetRenderingRectWithScale(float fLeft, float fTop, float fRight, float fBottom) { if (IsEmpty()) return; float fWidth = float(GetWidth() * m_v2Scale.x); float fHeight = float(GetHeight() * m_v2Scale.y); m_RenderingRect.left = fWidth * fLeft; m_RenderingRect.top = fHeight * fTop; m_RenderingRect.right = fWidth * fRight; m_RenderingRect.bottom = fHeight * fBottom; } A couple of minutes of RE Thank you bro, you god. Link to comment Share on other sites More sharing options...
Xerneas 10 Posted March 22, 2018 Share Posted March 22, 2018 What does it do? Link to comment Share on other sites More sharing options...
Premium TAUMP 840 Posted March 22, 2018 Premium Share Posted March 22, 2018 58 minutes ago, Xerneas said: What does it do? def SetLifeTime(self, curPoint, maxPoint): curPoint = min(curPoint, maxPoint) if maxPoint > 0: self.lifeTimeGauge.SetPercentageWithScale(curPoint, maxPoint) 1 Link to comment Share on other sites More sharing options...
Seryov 17 Posted March 22, 2018 Author Share Posted March 22, 2018 3 hours ago, Xerneas said: What does it do? 2 hours ago, .T4Ump said: def SetLifeTime(self, curPoint, maxPoint): curPoint = min(curPoint, maxPoint) if maxPoint > 0: self.lifeTimeGauge.SetPercentageWithScale(curPoint, maxPoint) Just for you set a progress bar width, height resize. Link to comment Share on other sites More sharing options...
Honorable Member xP3NG3Rx 19683 Posted March 22, 2018 Honorable Member Share Posted March 22, 2018 Actually this is the same as the normal just with scale, I cannot understand ymir why did it this way. I mean if you don't change the scale, it is in standard case 1.0 so basically the new functions are not necessary. Just enough to multiply the sizes with the scales. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now