diff --git a/data/layout.xml b/data/layout.xml
index d1c72e5..f920a25 100644
--- a/data/layout.xml
+++ b/data/layout.xml
@@ -521,7 +521,7 @@
-
+
diff --git a/engine.vcxproj b/engine.vcxproj
index 7ef817c..b8f2c16 100644
--- a/engine.vcxproj
+++ b/engine.vcxproj
@@ -76,7 +76,7 @@
true
- libs\glm;libs\glew-2.0.0\include;libs\stb;libs\tinyxml2;libs\yoga;libs\curl-win\include;libs\jpeg;libs\wacom;C:\Users\omar\Downloads\BugTrap-master\BugTrap-master\source\Client;$(IncludePath)
+ libs\glm;libs\glew-2.0.0\include;libs\stb;libs\tinyxml2;libs\yoga;libs\curl-win\include;libs\jpeg;libs\wacom;C:\Users\omar\Downloads\BugTrap-master\BugTrap-master\source\Client;libs\poly2tri\poly2tri;$(IncludePath)
libs\curl-win\lib\dll-$(Configuration)-$(PlatformShortName);libs\glew-2.0.0\lib\Release\$(Platform);C:\Users\omar\Downloads\BugTrap-master\BugTrap-master\bin;$(LibraryPath)
@@ -86,7 +86,7 @@
false
- libs\glm;libs\glew-2.0.0\include;libs\stb;libs\tinyxml2;libs\yoga;libs\curl-win\include;libs\jpeg;libs\wacom;C:\Users\omar\Downloads\BugTrap-master\BugTrap-master\source\Client;$(IncludePath)
+ libs\glm;libs\glew-2.0.0\include;libs\stb;libs\tinyxml2;libs\yoga;libs\curl-win\include;libs\jpeg;libs\wacom;C:\Users\omar\Downloads\BugTrap-master\BugTrap-master\source\Client;libs\poly2tri\poly2tri;$(IncludePath)
libs\curl-win\lib\dll-$(Configuration)-$(PlatformShortName);libs\glew-2.0.0\lib\Release\$(Platform);C:\Users\omar\Downloads\BugTrap-master\BugTrap-master\bin;$(LibraryPath)
@@ -234,6 +234,26 @@
NotUsing
NotUsing
+
+ NotUsing
+ NotUsing
+
+
+ NotUsing
+ NotUsing
+
+
+ NotUsing
+ NotUsing
+
+
+ NotUsing
+ NotUsing
+
+
+ NotUsing
+ NotUsing
+
NotUsing
NotUsing
diff --git a/engine.vcxproj.filters b/engine.vcxproj.filters
index 98968f1..9fac23a 100644
--- a/engine.vcxproj.filters
+++ b/engine.vcxproj.filters
@@ -34,6 +34,9 @@
{6fe315aa-e2b9-4f01-8291-683a5fda123b}
+
+ {bda6fa93-a186-41ca-9bd9-49b7e0fd1ca4}
+
@@ -201,6 +204,21 @@
Source Files
+
+ Source Files\libs\poly2tri
+
+
+ Source Files\libs\poly2tri
+
+
+ Source Files\libs\poly2tri
+
+
+ Source Files\libs\poly2tri
+
+
+ Source Files\libs\poly2tri
+
diff --git a/engine/app_events.cpp b/engine/app_events.cpp
index 3992360..e28ab92 100644
--- a/engine/app_events.cpp
+++ b/engine/app_events.cpp
@@ -140,7 +140,7 @@ bool App::key_down(kKey key)
e.m_type = kEventType::KeyDown;
e.m_key = key;
auto ret = layout[main_id]->on_event(&e);
- layout[main_id]->update();
+ //layout[main_id]->update();
return ret == kEventResult::Consumed;
}
bool App::key_up(kKey key)
diff --git a/engine/app_layout.cpp b/engine/app_layout.cpp
index a0c81e2..5d09770 100644
--- a/engine/app_layout.cpp
+++ b/engine/app_layout.cpp
@@ -248,7 +248,7 @@ void App::init_toolbar_draw()
layout[main_id]->find("btn-line")->set_color(color_button_normal);
layout[main_id]->find("btn-cam")->set_color(color_button_normal);
layout[main_id]->find("btn-grid")->set_color(color_button_normal);
- //layout[main_id]->find("btn-fill")->set_color(color_button_normal);
+ layout[main_id]->find("btn-fill")->set_color(color_button_normal);
Canvas::set_mode(Canvas::kCanvasMode::Draw);
};
layout[main_id]->find("btn-pen")->set_color(color_button_hlight);
@@ -278,7 +278,7 @@ void App::init_toolbar_draw()
layout[main_id]->find("btn-line")->set_color(color_button_normal);
layout[main_id]->find("btn-cam")->set_color(color_button_normal);
layout[main_id]->find("btn-grid")->set_color(color_button_normal);
- //layout[main_id]->find("btn-fill")->set_color(color_button_normal);
+ layout[main_id]->find("btn-fill")->set_color(color_button_normal);
Canvas::set_mode(Canvas::kCanvasMode::Erase);
};
}
@@ -290,7 +290,7 @@ void App::init_toolbar_draw()
layout[main_id]->find("btn-line")->set_color(color_button_hlight);
layout[main_id]->find("btn-cam")->set_color(color_button_normal);
layout[main_id]->find("btn-grid")->set_color(color_button_normal);
- //layout[main_id]->find("btn-fill")->set_color(color_button_normal);
+ layout[main_id]->find("btn-fill")->set_color(color_button_normal);
Canvas::set_mode(Canvas::kCanvasMode::Line);
};
}
@@ -302,7 +302,7 @@ void App::init_toolbar_draw()
layout[main_id]->find("btn-line")->set_color(color_button_normal);
layout[main_id]->find("btn-cam")->set_color(color_button_hlight);
layout[main_id]->find("btn-grid")->set_color(color_button_normal);
- //layout[main_id]->find("btn-fill")->set_color(color_button_normal);
+ layout[main_id]->find("btn-fill")->set_color(color_button_normal);
Canvas::set_mode(Canvas::kCanvasMode::Camera);
};
}
@@ -314,7 +314,7 @@ void App::init_toolbar_draw()
layout[main_id]->find("btn-line")->set_color(color_button_normal);
layout[main_id]->find("btn-cam")->set_color(color_button_normal);
layout[main_id]->find("btn-grid")->set_color(color_button_hlight);
- //layout[main_id]->find("btn-fill")->set_color(color_button_normal);
+ layout[main_id]->find("btn-fill")->set_color(color_button_normal);
Canvas::set_mode(Canvas::kCanvasMode::Grid);
};
}
@@ -326,7 +326,7 @@ void App::init_toolbar_draw()
layout[main_id]->find("btn-line")->set_color(color_button_normal);
layout[main_id]->find("btn-cam")->set_color(color_button_normal);
layout[main_id]->find("btn-grid")->set_color(color_button_normal);
- //layout[main_id]->find("btn-fill")->set_color(color_button_hlight);
+ layout[main_id]->find("btn-fill")->set_color(color_button_hlight);
Canvas::set_mode(Canvas::kCanvasMode::Fill);
};
}
diff --git a/engine/canvas_modes.cpp b/engine/canvas_modes.cpp
index 3f9a877..79baeab 100644
--- a/engine/canvas_modes.cpp
+++ b/engine/canvas_modes.cpp
@@ -572,7 +572,7 @@ void CanvasModeFill::on_Draw(const glm::mat4& ortho, const glm::mat4& proj, cons
{
ui::ShaderManager::use(ui::kShader::Color);
ui::ShaderManager::u_mat4(ui::kShaderUniform::MVP, glm::scale(glm::vec3(1,-1,1)) * ortho);
- ui::ShaderManager::u_vec4(ui::kShaderUniform::Col, { node->m_brush.m_tip_color.rgb(), node->m_brush.m_tip_opacity });
+ ui::ShaderManager::u_vec4(ui::kShaderUniform::Col, { 0, 0, 0, 1 });
m_dragging ? m_shape.draw_stroke() : m_shape.draw_fill();
}
}
diff --git a/engine/main.cpp b/engine/main.cpp
index 556d8c3..70fdb85 100644
--- a/engine/main.cpp
+++ b/engine/main.cpp
@@ -288,7 +288,7 @@ int main(int argc, char** argv)
while (running)
{
// If there any message in the queue process it
- if (!App::I.redraw && PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
+ if (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
{
running = !(msg.message == WM_QUIT/* || gl.keys[VK_ESCAPE]*/);
DispatchMessage(&msg);
@@ -308,10 +308,10 @@ int main(int argc, char** argv)
SwapBuffers(hDC);
}
}
- else
- {
- Sleep((DWORD)(1.0f / 60.0f * 1000.f));
- }
+// else
+// {
+// Sleep((DWORD)(1.0f / 60.0f * 1000.f));
+// }
}
}
@@ -368,11 +368,11 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
App::I.key_up(convert_key((int)wp));
break;
case WM_CHAR:
- App::I.key_char((int)wp);
+ //App::I.key_char((int)wp);
break;
case WM_MOUSEMOVE:
//TODO: find a way to check if event is mouse/stylus. For now use Mouse for all
- if (leftDown)
+ if (0 && leftDown)
{
POINT pt = { GET_X_LPARAM(lp), GET_Y_LPARAM(lp) };
// See discussion for why this code is wrong
@@ -382,6 +382,14 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
int cmmpt = GetMouseMovePointsEx(sizeof(mmpt), &mmpt,
rgmmpt, 64, GMMP_USE_DISPLAY_POINTS);
+ if (cmmpt == -1 || cmmpt == 64)
+ {
+ App::I.mouse_move((float)GET_X_LPARAM(lp), (float)GET_Y_LPARAM(lp), WacomTablet::I.get_pressure(), kEventSource::Mouse);
+ lastPoint = pt;
+ lastTime = GetMessageTime();
+ break;
+ }
+
POINT ptLastScreen = lastPoint;
ClientToScreen(hWnd, &ptLastScreen);
int i;
@@ -389,6 +397,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
{
if (rgmmpt[i].x > 32767) rgmmpt[i].x -= 65536;
if (rgmmpt[i].y > 32767) rgmmpt[i].y -= 65536;
+ LOG("x %4d y %4d", rgmmpt[i].x, rgmmpt[i].y);
if (rgmmpt[i].time < lastTime) break;
if (rgmmpt[i].time == lastTime &&
diff --git a/engine/node.cpp b/engine/node.cpp
index c8ea42d..e6a28e6 100644
--- a/engine/node.cpp
+++ b/engine/node.cpp
@@ -50,31 +50,36 @@ kEventResult Node::on_event(Event* e)
{
kEventResult ret = kEventResult::Available;
- if (current_mouse_capture)
- return current_mouse_capture->on_event(e);
-
- bool skip_children = false;
- skip_children |= (e->m_cat == kEventCategory::MouseEvent || e->m_cat == kEventCategory::GestureEvent) &&
- (m_mouse_captured) && (root()->current_mouse_capture == this) && m_capture_children;
-
- if (!skip_children)
+ if (e->m_cat == kEventCategory::MouseEvent)
{
- for (auto it = m_children.rbegin(); it != m_children.rend(); ++it)
{
- if ((*it)->on_event(e) == kEventResult::Consumed)
+ if (current_mouse_capture)
+ return current_mouse_capture->on_event(e);
+
+ bool skip_children = false;
+ skip_children |= (e->m_cat == kEventCategory::MouseEvent || e->m_cat == kEventCategory::GestureEvent) &&
+ (m_mouse_captured) && (root()->current_mouse_capture == this) && m_capture_children;
+
+ if (!skip_children)
{
- if (m_flood_events)
+ for (auto it = m_children.rbegin(); it != m_children.rend(); ++it)
{
- ret = kEventResult::Consumed;
- }
- else
- {
- return kEventResult::Consumed;
+ if ((*it)->on_event(e) == kEventResult::Consumed)
+ {
+ if (m_flood_events)
+ {
+ ret = kEventResult::Consumed;
+ }
+ else
+ {
+ return kEventResult::Consumed;
+ }
+ }
}
+ if (ret == kEventResult::Consumed)
+ return ret;
}
}
- if (ret == kEventResult::Consumed)
- return ret;
}
switch (e->m_cat)