fixing bugs + InnerOnKeyPress added
This commit is contained in:
1 parent
ec2e6830aa
commit
94e073eaaa
5 files changed
+67
-9
No files matched your search
@@ -133,6 +133,8 @@ void TApplication::OnKeyPress(cardinal key)
|
||||
{
|
||||
ResourceManager->GUIManager.KeyPressedSignal(static_cast<int>(key));
|
||||
}
|
||||
|
||||
App->InnerOnKeyPress(key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -221,10 +223,14 @@ case WM_MOUSEMOVE:
|
||||
if (MouseButtonPressed)
|
||||
{
|
||||
vec2 currentMousePos(static_cast<float>(mouseState.X), static_cast<float>(Renderer->GetScreenHeight() - mouseState.Y));
|
||||
|
||||
currentMousePos.v[0] *= SE::Renderer->GetMatrixWidth() / SE::Renderer->GetScreenWidth();
|
||||
currentMousePos.v[1] *= SE::Renderer->GetMatrixHeight() / SE::Renderer->GetScreenHeight();
|
||||
|
||||
vec2 shift = (MouseButtonPos - currentMousePos);
|
||||
//shift.v[1] = - shift.v[1];
|
||||
App->OuterOnMove(shift);
|
||||
//App->OuterOnMove(currentMousePos - MouseButtonPos);
|
||||
|
||||
App->OuterOnMove(shift, 0);
|
||||
|
||||
MouseButtonPos = currentMousePos;
|
||||
|
||||
MouseTotalShift += shift;
|
||||
@@ -247,9 +253,12 @@ case WM_MOUSEMOVE:
|
||||
|
||||
MouseButtonPos = vec2(static_cast<float>(mouseState.X), static_cast<float>(Renderer->GetScreenHeight() - mouseState.Y));
|
||||
|
||||
MouseButtonPos.v[0] *= SE::Renderer->GetMatrixWidth() / SE::Renderer->GetScreenWidth();
|
||||
MouseButtonPos.v[1] *= SE::Renderer->GetMatrixHeight() / SE::Renderer->GetScreenHeight();
|
||||
|
||||
if (mouseState.LeftButtonPressed)
|
||||
{
|
||||
App->OuterOnTapDown(MouseButtonPos);
|
||||
App->OuterOnTapDown(MouseButtonPos, 0);
|
||||
|
||||
}
|
||||
|
||||
@@ -270,13 +279,20 @@ case WM_MOUSEMOVE:
|
||||
mouseState.MiddleButtonPressed = (wParam & MK_MBUTTON);
|
||||
mouseState.MiddleButtonPressed = (wParam & MK_RBUTTON);
|
||||
|
||||
|
||||
MouseButtonPos = vec2(static_cast<float>(mouseState.X), static_cast<float>(Renderer->GetScreenHeight() - mouseState.Y));
|
||||
MouseButtonPos.v[0] *= SE::Renderer->GetMatrixWidth() / SE::Renderer->GetScreenWidth();
|
||||
MouseButtonPos.v[1] *= SE::Renderer->GetMatrixHeight() / SE::Renderer->GetScreenHeight();
|
||||
|
||||
|
||||
|
||||
if (MouseMoved)
|
||||
{
|
||||
App->OuterOnTapUpAfterMove(vec2(static_cast<float>(mouseState.X), static_cast<float>(Renderer->GetScreenHeight() - mouseState.Y)));
|
||||
App->OuterOnTapUpAfterMove(MouseButtonPos, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
App->OuterOnTapUp(vec2(static_cast<float>(mouseState.X), static_cast<float>(Renderer->GetScreenHeight() - mouseState.Y)));
|
||||
App->OuterOnTapUp(MouseButtonPos, 0);
|
||||
}
|
||||
|
||||
MouseButtonPressed = false;
|
||||
|
||||
@@ -320,7 +320,7 @@ int LineCrossLine2d(const vec2& a1, const vec2& a2, const vec2& b1, const vec2&
|
||||
|
||||
float detm = m.m[0] * m.m[3] - m.m[1] * m.m[2];
|
||||
|
||||
if (fabs(detm) <= 0.00005f)
|
||||
if (fabs(detm) <= 0.005f)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
@@ -345,7 +345,9 @@ int LineCrossLine2d(const vec2& a1, const vec2& a2, const vec2& b1, const vec2&
|
||||
t.v[0] = vx.v[0] * rev_m.m[0] + vx.v[1] * rev_m.m[1];
|
||||
t.v[1] = vx.v[0] * rev_m.m[2] + vx.v[1] * rev_m.m[3];
|
||||
|
||||
if (t.v[0] < 0 || t.v[0] > 1 || t.v[1] < 0 || t.v[1] > 1)
|
||||
//if (t.v[0] < 0 || t.v[0] > 1 || t.v[1] < 0 || t.v[1] > 1)
|
||||
//if (t.v[0] < 0.01f|| t.v[0] > 0.99f || t.v[1] < 0.01f || t.v[1] > 0.99f)
|
||||
if (t.v[0] < -0.01f || t.v[0] > 1.01f || t.v[1] < -0.01f || t.v[1] > 1.01f)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,29 @@
|
||||
namespace SE
|
||||
{
|
||||
|
||||
|
||||
|
||||
template <>
|
||||
vec2 GetValueFromSubtree(const boost::property_tree::ptree::value_type& subTree, const std::string& path)
|
||||
{
|
||||
return StringToVec2(subTree.second.get<std::string>(path));
|
||||
}
|
||||
|
||||
template <>
|
||||
vec3 GetValueFromSubtree(const boost::property_tree::ptree::value_type& subTree, const std::string& path)
|
||||
{
|
||||
return StringToVec3(subTree.second.get<std::string>(path));
|
||||
}
|
||||
|
||||
template <>
|
||||
vec4 GetValueFromSubtree(const boost::property_tree::ptree::value_type& subTree, const std::string& path)
|
||||
{
|
||||
return StringToVec4(subTree.second.get<std::string>(path));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void ReplaceText(boost::property_tree::ptree& propertyTree, std::map<std::string, std::string>& replaceMap)
|
||||
{
|
||||
for (boost::property_tree::ptree::iterator i = propertyTree.begin(); i != propertyTree.end(); )
|
||||
|
||||
Reference in new issue
Block a user