added color picking with ALT key, added crash report library for windows
This commit is contained in:
@@ -71,23 +71,23 @@
|
|||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
<IncludePath>libs\glm;libs\glew-2.0.0\include;libs\stb;libs\tinyxml2;libs\yoga;libs\curl-win\include;libs\jpeg;libs\wacom;$(IncludePath)</IncludePath>
|
<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;$(IncludePath)</IncludePath>
|
||||||
<LibraryPath>libs\curl-win\lib\dll-$(Configuration)-$(PlatformShortName);libs\glew-2.0.0\lib\Release\$(Platform);$(LibraryPath)</LibraryPath>
|
<LibraryPath>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)</LibraryPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
<IncludePath>libs\glm;libs\glew-2.0.0\include;libs\stb;libs\tinyxml2;libs\yoga;libs\curl-win\include;libs\jpeg;libs\wacom;$(IncludePath)</IncludePath>
|
<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;$(IncludePath)</IncludePath>
|
||||||
<LibraryPath>libs\curl-win\lib\dll-$(Configuration)-$(PlatformShortName);libs\glew-2.0.0\lib\Release\$(Platform);$(LibraryPath)</LibraryPath>
|
<LibraryPath>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)</LibraryPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
<IncludePath>libs\glm;libs\glew-2.0.0\include;libs\stb;libs\tinyxml2;libs\yoga;libs\curl-win\include;libs\jpeg;libs\wacom;$(IncludePath)</IncludePath>
|
<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;$(IncludePath)</IncludePath>
|
||||||
<LibraryPath>libs\curl-win\lib\dll-$(Configuration)-$(PlatformShortName);libs\glew-2.0.0\lib\Release\$(Platform);$(LibraryPath)</LibraryPath>
|
<LibraryPath>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)</LibraryPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
<IncludePath>libs\glm;libs\glew-2.0.0\include;libs\stb;libs\tinyxml2;libs\yoga;libs\curl-win\include;libs\jpeg;libs\wacom;$(IncludePath)</IncludePath>
|
<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;$(IncludePath)</IncludePath>
|
||||||
<LibraryPath>libs\curl-win\lib\dll-$(Configuration)-$(PlatformShortName);libs\glew-2.0.0\lib\Release\$(Platform);$(LibraryPath)</LibraryPath>
|
<LibraryPath>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)</LibraryPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
@@ -124,6 +124,7 @@
|
|||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||||
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
@@ -141,6 +142,7 @@
|
|||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||||
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ void ActionManager::add(Action *action)
|
|||||||
{
|
{
|
||||||
I.m_actions.emplace(action);
|
I.m_actions.emplace(action);
|
||||||
I.m_memory += action->memory();
|
I.m_memory += action->memory();
|
||||||
LOG("History: %.2f KB", I.m_memory / 1024.f);
|
//LOG("History: %.2f KB", I.m_memory / 1024.f);
|
||||||
App::I.update_memory_usage(I.m_memory);
|
App::I.update_memory_usage(I.m_memory);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ void ActionManager::undo()
|
|||||||
I.m_actions.top()->undo();
|
I.m_actions.top()->undo();
|
||||||
I.m_memory -= I.m_actions.top()->memory();
|
I.m_memory -= I.m_actions.top()->memory();
|
||||||
I.m_actions.pop();
|
I.m_actions.pop();
|
||||||
LOG("History: %.2f KB", I.m_memory / 1024.f);
|
//LOG("History: %.2f KB", I.m_memory / 1024.f);
|
||||||
App::I.update_memory_usage(I.m_memory);
|
App::I.update_memory_usage(I.m_memory);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,6 +27,6 @@ void ActionManager::clear()
|
|||||||
while (!I.m_actions.empty())
|
while (!I.m_actions.empty())
|
||||||
I.m_actions.pop();
|
I.m_actions.pop();
|
||||||
I.m_memory = 0;
|
I.m_memory = 0;
|
||||||
LOG("History: %.2f KB", I.m_memory / 1024.f);
|
//LOG("History: %.2f KB", I.m_memory / 1024.f);
|
||||||
App::I.update_memory_usage(I.m_memory);
|
App::I.update_memory_usage(I.m_memory);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ void App::initAssets()
|
|||||||
void App::initLog()
|
void App::initLog()
|
||||||
{
|
{
|
||||||
LogRemote::I.start();
|
LogRemote::I.start();
|
||||||
|
LogRemote::I.file_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
void App::init()
|
void App::init()
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ public:
|
|||||||
const uint16_t main_id = const_hash("main");
|
const uint16_t main_id = const_hash("main");
|
||||||
float width;
|
float width;
|
||||||
float height;
|
float height;
|
||||||
|
bool keys[256];
|
||||||
glm::vec2 gesture_p0;
|
glm::vec2 gesture_p0;
|
||||||
glm::vec2 gesture_p1;
|
glm::vec2 gesture_p1;
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ bool App::gesture_end()
|
|||||||
}
|
}
|
||||||
bool App::key_down(kKey key)
|
bool App::key_down(kKey key)
|
||||||
{
|
{
|
||||||
|
keys[(int)key] = true;
|
||||||
KeyEvent e;
|
KeyEvent e;
|
||||||
e.m_type = kEventType::KeyDown;
|
e.m_type = kEventType::KeyDown;
|
||||||
e.m_key = key;
|
e.m_key = key;
|
||||||
@@ -104,6 +105,7 @@ bool App::key_down(kKey key)
|
|||||||
}
|
}
|
||||||
bool App::key_up(kKey key)
|
bool App::key_up(kKey key)
|
||||||
{
|
{
|
||||||
|
keys[(int)key] = false;
|
||||||
KeyEvent e;
|
KeyEvent e;
|
||||||
e.m_type = kEventType::KeyUp;
|
e.m_type = kEventType::KeyUp;
|
||||||
e.m_key = key;
|
e.m_key = key;
|
||||||
|
|||||||
@@ -399,6 +399,15 @@ void ui::Canvas::stroke_update(glm::vec2 point, float pressure)
|
|||||||
}
|
}
|
||||||
void ui::Canvas::stroke_start(glm::vec2 point, float pressure, const ui::Brush& brush)
|
void ui::Canvas::stroke_start(glm::vec2 point, float pressure, const ui::Brush& brush)
|
||||||
{
|
{
|
||||||
|
// need to commit this now before starting a new stroke
|
||||||
|
if (m_current_stroke && m_commit_delayed)
|
||||||
|
{
|
||||||
|
stroke_commit();
|
||||||
|
m_current_stroke = nullptr;
|
||||||
|
m_show_tmp = false;
|
||||||
|
m_commit_delayed = false;
|
||||||
|
}
|
||||||
|
|
||||||
m_current_stroke = std::make_unique<Stroke>();
|
m_current_stroke = std::make_unique<Stroke>();
|
||||||
m_current_stroke->m_camera = { m_cam_rot, m_cam_fov };
|
m_current_stroke->m_camera = { m_cam_rot, m_cam_fov };
|
||||||
m_current_stroke->start(brush);
|
m_current_stroke->start(brush);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include "canvas.h"
|
#include "canvas.h"
|
||||||
#include "shader.h"
|
#include "shader.h"
|
||||||
#include "node_canvas.h"
|
#include "node_canvas.h"
|
||||||
|
#include "app.h"
|
||||||
|
|
||||||
NodeCanvas* CanvasMode::node;
|
NodeCanvas* CanvasMode::node;
|
||||||
ui::Canvas* CanvasMode::canvas;
|
ui::Canvas* CanvasMode::canvas;
|
||||||
@@ -71,23 +72,65 @@ void CanvasModePen::on_MouseEvent(MouseEvent* me, glm::vec2& loc)
|
|||||||
switch (me->m_type)
|
switch (me->m_type)
|
||||||
{
|
{
|
||||||
case kEventType::MouseDownL:
|
case kEventType::MouseDownL:
|
||||||
canvas->stroke_start(loc, me->m_pressure, node->m_brush);
|
if (App::I.keys[(int)kKey::KeyAlt])
|
||||||
m_dragging = true;
|
{
|
||||||
|
m_picking = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
canvas->stroke_start(loc, me->m_pressure, node->m_brush);
|
||||||
|
m_dragging = true;
|
||||||
|
}
|
||||||
node->mouse_capture();
|
node->mouse_capture();
|
||||||
break;
|
break;
|
||||||
case kEventType::MouseUpL:
|
case kEventType::MouseUpL:
|
||||||
canvas->stroke_end();
|
if (m_dragging)
|
||||||
m_dragging = false;
|
{
|
||||||
node->mouse_release();
|
canvas->stroke_end();
|
||||||
|
m_dragging = false;
|
||||||
|
node->mouse_release();
|
||||||
|
}
|
||||||
|
if (m_picking)
|
||||||
|
{
|
||||||
|
m_picking = false;
|
||||||
|
node->mouse_release();
|
||||||
|
int x = me->m_pos.x;
|
||||||
|
int y = App::I.height - me->m_pos.y - 1;
|
||||||
|
float pix[3];
|
||||||
|
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||||
|
glReadPixels(x, y, 1, 1, GL_RGB, GL_FLOAT, pix);
|
||||||
|
auto hsv = convert_rgb2hsv(glm::vec3(pix[0], pix[1], pix[2]));
|
||||||
|
App::I.color->m_hue->set_value(hsv.x);
|
||||||
|
App::I.color->m_quad->set_value(1.f - hsv.y, 1.f - hsv.z);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case kEventType::MouseMove:
|
case kEventType::MouseMove:
|
||||||
if (m_dragging)
|
if (m_dragging)
|
||||||
canvas->stroke_update(loc, me->m_pressure);
|
canvas->stroke_update(loc, me->m_pressure);
|
||||||
|
if (m_picking)
|
||||||
|
{
|
||||||
|
int x = me->m_pos.x;
|
||||||
|
int y = App::I.height - me->m_pos.y - 1;
|
||||||
|
float pix[3];
|
||||||
|
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||||
|
glReadPixels(x, y, 1, 1, GL_RGB, GL_FLOAT, pix);
|
||||||
|
auto hsv = convert_rgb2hsv(glm::vec3(pix[0], pix[1], pix[2]));
|
||||||
|
App::I.color->m_hue->set_value(hsv.x);
|
||||||
|
App::I.color->m_quad->set_value(1.f - hsv.y, 1.f - hsv.z);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case kEventType::MouseCancel:
|
case kEventType::MouseCancel:
|
||||||
canvas->stroke_cancel();
|
if (m_dragging)
|
||||||
m_dragging = false;
|
{
|
||||||
node->mouse_release();
|
canvas->stroke_cancel();
|
||||||
|
m_dragging = false;
|
||||||
|
node->mouse_release();
|
||||||
|
}
|
||||||
|
if (m_picking)
|
||||||
|
{
|
||||||
|
m_picking = false;
|
||||||
|
node->mouse_release();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ public:
|
|||||||
class CanvasModePen : public CanvasMode
|
class CanvasModePen : public CanvasMode
|
||||||
{
|
{
|
||||||
bool m_dragging = false;
|
bool m_dragging = false;
|
||||||
|
bool m_picking = false;
|
||||||
glm::vec2 m_pan_start;
|
glm::vec2 m_pan_start;
|
||||||
float m_camera_fov;
|
float m_camera_fov;
|
||||||
float m_zoom_canvas = 1.f;
|
float m_zoom_canvas = 1.f;
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ enum class kKey : uint8_t
|
|||||||
AndroidBack,
|
AndroidBack,
|
||||||
KeySpacebar,
|
KeySpacebar,
|
||||||
KeyE,
|
KeyE,
|
||||||
|
KeyAlt
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class kEventResult : uint8_t
|
enum class kEventResult : uint8_t
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ kKey convert_key(int key)
|
|||||||
CASE(VK_RETURN, kKey::Unknown);
|
CASE(VK_RETURN, kKey::Unknown);
|
||||||
CASE(VK_SHIFT, kKey::Unknown);
|
CASE(VK_SHIFT, kKey::Unknown);
|
||||||
CASE(VK_CONTROL, kKey::Unknown);
|
CASE(VK_CONTROL, kKey::Unknown);
|
||||||
CASE(VK_MENU, kKey::Unknown);
|
CASE(VK_MENU, kKey::KeyAlt);
|
||||||
CASE(VK_PAUSE, kKey::Unknown);
|
CASE(VK_PAUSE, kKey::Unknown);
|
||||||
CASE(VK_CAPITAL, kKey::Unknown);
|
CASE(VK_CAPITAL, kKey::Unknown);
|
||||||
CASE(VK_KANA, kKey::Unknown);
|
CASE(VK_KANA, kKey::Unknown);
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ void LogRemote::start()
|
|||||||
|
|
||||||
m_running = true;
|
m_running = true;
|
||||||
m_thread = std::thread([&] {
|
m_thread = std::thread([&] {
|
||||||
|
BT_SetTerminate();
|
||||||
net_init();
|
net_init();
|
||||||
auto session_string = net_request("/start");
|
auto session_string = net_request("/start");
|
||||||
m_session = atoi(session_string.c_str());
|
m_session = atoi(session_string.c_str());
|
||||||
@@ -65,6 +66,16 @@ void LogRemote::net_close()
|
|||||||
curl = nullptr;
|
curl = nullptr;
|
||||||
m_running = false;
|
m_running = false;
|
||||||
}
|
}
|
||||||
|
void LogRemote::file_init()
|
||||||
|
{
|
||||||
|
if (!m_logfile.is_open())
|
||||||
|
m_logfile.open("log.txt");
|
||||||
|
}
|
||||||
|
void LogRemote::file_close()
|
||||||
|
{
|
||||||
|
if (!m_logfile.is_open())
|
||||||
|
m_logfile.close();
|
||||||
|
}
|
||||||
void LogRemote::log(const char* format, ...)
|
void LogRemote::log(const char* format, ...)
|
||||||
{
|
{
|
||||||
static char buffer[4096];
|
static char buffer[4096];
|
||||||
@@ -73,6 +84,12 @@ void LogRemote::log(const char* format, ...)
|
|||||||
int n = vsnprintf(buffer, sizeof(buffer), format, arglist);
|
int n = vsnprintf(buffer, sizeof(buffer), format, arglist);
|
||||||
va_end(arglist);
|
va_end(arglist);
|
||||||
m_mq.Post(std::string(buffer, n));
|
m_mq.Post(std::string(buffer, n));
|
||||||
|
if (m_logfile.is_open())
|
||||||
|
{
|
||||||
|
auto line = std::string(buffer, n) + "\n";
|
||||||
|
m_logfile.write(line.data(), line.size());
|
||||||
|
m_logfile.flush();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void LogRemote::log(const wchar_t* format, ...)
|
void LogRemote::log(const wchar_t* format, ...)
|
||||||
{
|
{
|
||||||
@@ -98,6 +115,12 @@ void LogRemote::log(const wchar_t* format, ...)
|
|||||||
//std::string converted_str = converter.to_bytes(string_to_convert);
|
//std::string converted_str = converter.to_bytes(string_to_convert);
|
||||||
|
|
||||||
m_mq.Post(std::move(converted));
|
m_mq.Post(std::move(converted));
|
||||||
|
if (m_logfile.is_open())
|
||||||
|
{
|
||||||
|
auto line = converted + "\n";
|
||||||
|
m_logfile.write(line.data(), line.size());
|
||||||
|
m_logfile.flush();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
LogRemote::~LogRemote()
|
LogRemote::~LogRemote()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,11 +23,14 @@ public:
|
|||||||
std::string readBuffer;
|
std::string readBuffer;
|
||||||
std::string m_url = "http://omigamedev.ddns.net:8083";
|
std::string m_url = "http://omigamedev.ddns.net:8083";
|
||||||
int m_session;
|
int m_session;
|
||||||
|
std::ofstream m_logfile;
|
||||||
|
|
||||||
void start();
|
void start();
|
||||||
void net_init();
|
void net_init();
|
||||||
std::string net_request(std::string cmd, std::string data = "");
|
std::string net_request(std::string cmd, std::string data = "");
|
||||||
void net_close();
|
void net_close();
|
||||||
|
void file_init();
|
||||||
|
void file_close();
|
||||||
void log(const char* format, ...);
|
void log(const char* format, ...);
|
||||||
void log(const wchar_t* format, ...);
|
void log(const wchar_t* format, ...);
|
||||||
~LogRemote();
|
~LogRemote();
|
||||||
|
|||||||
@@ -478,6 +478,42 @@ int read_WMI_info()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
INT_PTR g_iLogHandle = -1;
|
||||||
|
static void SetupExceptionHandler()
|
||||||
|
{
|
||||||
|
// Setup exception handler
|
||||||
|
BT_SetAppName(_T("PanoPainter"));
|
||||||
|
//BT_SetSupportEMail(_T("your@email.com"));
|
||||||
|
BT_SetFlags(BTF_DETAILEDMODE | BTF_ATTACHREPORT | BTF_SCREENCAPTURE);
|
||||||
|
|
||||||
|
// = BugTrapServer ===========================================
|
||||||
|
BT_SetSupportServer(_T("omigamedev.ddns.net"), 8088);
|
||||||
|
// - or -
|
||||||
|
//BT_SetSupportServer(_T("127.0.0.1"), 9999);
|
||||||
|
|
||||||
|
// = BugTrapWebServer ========================================
|
||||||
|
//BT_SetSupportServer(_T("http://localhost/BugTrapWebServer/RequestHandler.aspx"), BUGTRAP_HTTP_PORT);
|
||||||
|
//BT_SetSupportServer(_T("http://omigamedev.ddns.net:8088/source/Server/BugTrapWebServer/RequestHandler.aspx"), BUGTRAP_HTTP_PORT);
|
||||||
|
|
||||||
|
// required for VS 2005 & 2008
|
||||||
|
BT_InstallSehFilter();
|
||||||
|
|
||||||
|
// Add custom log file using default name
|
||||||
|
// g_iLogHandle = BT_OpenLogFile(NULL, BTLF_TEXT);
|
||||||
|
// BT_SetLogSizeInEntries(g_iLogHandle, 100);
|
||||||
|
// BT_SetLogFlags(g_iLogHandle, BTLF_SHOWTIMESTAMP);
|
||||||
|
// BT_SetLogEchoMode(g_iLogHandle, BTLE_STDERR | BTLE_DBGOUT);
|
||||||
|
//
|
||||||
|
// PCTSTR pszLogFileName = BT_GetLogFileName(g_iLogHandle);
|
||||||
|
TCHAR wpath[1024];
|
||||||
|
GetFullPathNameW(L"log.txt", 1024, wpath, nullptr);
|
||||||
|
BT_AddLogFile(wpath);
|
||||||
|
|
||||||
|
BT_SetPreErrHandler([](INT_PTR){
|
||||||
|
LogRemote::I.file_close();
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
WNDCLASS wc;
|
WNDCLASS wc;
|
||||||
@@ -485,6 +521,9 @@ int main()
|
|||||||
|
|
||||||
App::I.initLog();
|
App::I.initLog();
|
||||||
|
|
||||||
|
SetupExceptionHandler();
|
||||||
|
BT_SetTerminate();
|
||||||
|
|
||||||
read_WMI_info();
|
read_WMI_info();
|
||||||
|
|
||||||
App::I.create();
|
App::I.create();
|
||||||
@@ -629,6 +668,9 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
|
|||||||
{
|
{
|
||||||
switch (msg)
|
switch (msg)
|
||||||
{
|
{
|
||||||
|
case WM_CREATE:
|
||||||
|
BT_SetTerminate();
|
||||||
|
break;
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
PostQuitMessage(0);
|
PostQuitMessage(0);
|
||||||
break;
|
break;
|
||||||
@@ -647,10 +689,12 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
|
|||||||
case WT_PACKET:
|
case WT_PACKET:
|
||||||
WacomTablet::I.handle_message(hWnd, msg, wp, lp);
|
WacomTablet::I.handle_message(hWnd, msg, wp, lp);
|
||||||
break;
|
break;
|
||||||
|
case WM_SYSKEYDOWN:
|
||||||
case WM_KEYDOWN:
|
case WM_KEYDOWN:
|
||||||
keys[wp] = true;
|
keys[wp] = true;
|
||||||
App::I.key_down(convert_key((int)wp));
|
App::I.key_down(convert_key((int)wp));
|
||||||
break;
|
break;
|
||||||
|
case WM_SYSKEYUP:
|
||||||
case WM_KEYUP:
|
case WM_KEYUP:
|
||||||
keys[wp] = false;
|
keys[wp] = false;
|
||||||
App::I.key_up(convert_key((int)wp));
|
App::I.key_up(convert_key((int)wp));
|
||||||
@@ -666,6 +710,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
|
|||||||
SetCapture(hWnd);
|
SetCapture(hWnd);
|
||||||
break;
|
break;
|
||||||
case WM_LBUTTONUP:
|
case WM_LBUTTONUP:
|
||||||
|
WacomTablet::I.reset_pressure();
|
||||||
App::I.mouse_up(0, (float)GET_X_LPARAM(lp), (float)GET_Y_LPARAM(lp));
|
App::I.mouse_up(0, (float)GET_X_LPARAM(lp), (float)GET_Y_LPARAM(lp));
|
||||||
ReleaseCapture();
|
ReleaseCapture();
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -156,6 +156,7 @@ void NodeCanvas::handle_resize(glm::vec2 old_size, glm::vec2 new_size)
|
|||||||
|
|
||||||
kEventResult NodeCanvas::handle_event(Event* e)
|
kEventResult NodeCanvas::handle_event(Event* e)
|
||||||
{
|
{
|
||||||
|
static std::vector<CanvasMode>* old_mode = nullptr;
|
||||||
Node::handle_event(e);
|
Node::handle_event(e);
|
||||||
MouseEvent* me = static_cast<MouseEvent*>(e);
|
MouseEvent* me = static_cast<MouseEvent*>(e);
|
||||||
KeyEvent* ke = static_cast<KeyEvent*>(e);
|
KeyEvent* ke = static_cast<KeyEvent*>(e);
|
||||||
@@ -186,6 +187,7 @@ kEventResult NodeCanvas::handle_event(Event* e)
|
|||||||
if (ke->m_key == kKey::AndroidBack)
|
if (ke->m_key == kKey::AndroidBack)
|
||||||
if (!ActionManager::empty())
|
if (!ActionManager::empty())
|
||||||
ActionManager::undo();
|
ActionManager::undo();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case kEventType::KeyUp:
|
case kEventType::KeyUp:
|
||||||
// if (ke->m_key == kKey::KeyE)
|
// if (ke->m_key == kKey::KeyE)
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ void NodeColorQuad::set_value(float x, float y)
|
|||||||
{
|
{
|
||||||
auto sz = GetSize();
|
auto sz = GetSize();
|
||||||
auto pos = glm::clamp(glm::vec2(x, y) * sz, { 0, 0 }, sz);
|
auto pos = glm::clamp(glm::vec2(x, y) * sz, { 0, 0 }, sz);
|
||||||
m_picker->SetPosition(pos.x, pos.y);
|
m_picker->SetPosition(pos - m_picker->GetSize() * .5f);
|
||||||
m_value = pos / glm::max({ 1,1 }, sz); // avoid div0
|
m_value = pos / glm::max({ 1,1 }, sz); // avoid div0
|
||||||
if (on_value_changed)
|
if (on_value_changed)
|
||||||
on_value_changed(this, m_value);
|
on_value_changed(this, m_value);
|
||||||
@@ -45,8 +45,8 @@ kEventResult NodeColorQuad::handle_event(Event* e)
|
|||||||
dragging = true;
|
dragging = true;
|
||||||
mouse_capture();
|
mouse_capture();
|
||||||
auto sz = GetSize();
|
auto sz = GetSize();
|
||||||
auto pos = glm::clamp(((MouseEvent*)e)->m_pos - m_pos, { 0, 0 }, sz) - m_picker->GetSize() * .5f;
|
auto pos = glm::clamp(((MouseEvent*)e)->m_pos - m_pos, { 0, 0 }, sz);
|
||||||
m_picker->SetPosition(pos.x, pos.y);
|
m_picker->SetPosition(pos - m_picker->GetSize() * .5f);
|
||||||
m_value = pos / glm::max({ 1,1 }, sz); // avoid div0
|
m_value = pos / glm::max({ 1,1 }, sz); // avoid div0
|
||||||
if (on_value_changed)
|
if (on_value_changed)
|
||||||
on_value_changed(this, m_value);
|
on_value_changed(this, m_value);
|
||||||
@@ -60,8 +60,8 @@ kEventResult NodeColorQuad::handle_event(Event* e)
|
|||||||
if (dragging)
|
if (dragging)
|
||||||
{
|
{
|
||||||
auto sz = GetSize();
|
auto sz = GetSize();
|
||||||
auto pos = glm::clamp(((MouseEvent*)e)->m_pos - m_pos, { 0, 0 }, sz) - m_picker->GetSize() * .5f;
|
auto pos = glm::clamp(((MouseEvent*)e)->m_pos - m_pos, { 0, 0 }, sz);
|
||||||
m_picker->SetPosition(pos.x, pos.y);
|
m_picker->SetPosition(pos - m_picker->GetSize() * .5f);
|
||||||
m_value = pos / glm::max({ 1,1 }, sz); // avoid div0
|
m_value = pos / glm::max({ 1,1 }, sz); // avoid div0
|
||||||
if (on_value_changed)
|
if (on_value_changed)
|
||||||
on_value_changed(this, m_value);
|
on_value_changed(this, m_value);
|
||||||
|
|||||||
@@ -13,3 +13,6 @@
|
|||||||
#pragma comment (lib, "libcurl.lib")
|
#pragma comment (lib, "libcurl.lib")
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#pragma comment(lib, "BugTrapU-x64.lib")
|
||||||
|
#endif // _WIN32
|
||||||
|
|||||||
@@ -45,9 +45,11 @@
|
|||||||
#define _SCL_SECURE_NO_WARNINGS
|
#define _SCL_SECURE_NO_WARNINGS
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <windowsx.h>
|
#include <windowsx.h>
|
||||||
|
#include <tchar.h>
|
||||||
#include <gl\glew.h>
|
#include <gl\glew.h>
|
||||||
#include <gl\wglew.h>
|
#include <gl\wglew.h>
|
||||||
#include <gl\GL.h>
|
#include <gl\GL.h>
|
||||||
|
#include <BugTrap.h>
|
||||||
|
|
||||||
#define SHADER_VERSION "#version 150\n"
|
#define SHADER_VERSION "#version 150\n"
|
||||||
|
|
||||||
@@ -68,6 +70,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <random>
|
#include <random>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|||||||
@@ -178,5 +178,9 @@ void WacomTablet::handle_message(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lPar
|
|||||||
|
|
||||||
float WacomTablet::get_pressure() const
|
float WacomTablet::get_pressure() const
|
||||||
{
|
{
|
||||||
return m_pen_down ? m_pen_pres : 1.f;
|
return m_pen_pres;
|
||||||
}
|
}
|
||||||
|
void WacomTablet::reset_pressure()
|
||||||
|
{
|
||||||
|
m_pen_pres = 1.f;
|
||||||
|
}
|
||||||
@@ -26,4 +26,5 @@ public:
|
|||||||
void handle_message(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
void handle_message(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
||||||
void set_focus(int activate);
|
void set_focus(int activate);
|
||||||
float get_pressure() const;
|
float get_pressure() const;
|
||||||
|
void reset_pressure();
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user