add command line interface handler and implement convert command from pano to jpg

This commit is contained in:
2017-11-04 16:04:22 +00:00
parent b49414bcd6
commit 2baaff10cc
9 changed files with 142 additions and 56 deletions

View File

@@ -333,10 +333,23 @@ int main(int argc, char** argv)
}
else
{
// If not supported, go fuck yourself we are not gonna use that shit
// If not supported, go fuck yourself we are not gonna support your shitty device
return -1; // A negative number because you are a negative one
}
if (argc > 1)
{
switch (const_hash(argv[1]))
{
case const_hash("convert"):
App::I.initShaders();
App::I.cmd_convert(argv[2], argv[3]);
return 0;
default:
break;
}
}
App::I.init();
ShowWindow(hWnd, SW_NORMAL);
@@ -402,7 +415,6 @@ int main(int argc, char** argv)
LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
{
async_locker lock;
static bool leftDown = false;
static DWORD lastTime;
static POINT lastPoint;
@@ -420,6 +432,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
auto h = (float)HIWORD(lp);
if (h != 0)
{
async_locker lock;
App::I.resize(w, h);
App::I.clear();
App::I.redraw = true;
@@ -439,18 +452,25 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
break;
case WM_SYSKEYDOWN:
case WM_KEYDOWN:
async_lock();
keys[wp] = true;
App::I.key_down(convert_key((int)wp));
async_unlock();
break;
case WM_SYSKEYUP:
case WM_KEYUP:
async_lock();
keys[wp] = false;
App::I.key_up(convert_key((int)wp));
async_unlock();
break;
case WM_CHAR:
async_lock();
App::I.key_char((int)wp);
async_unlock();
break;
case WM_MOUSEMOVE:
async_lock();
//TODO: find a way to check if event is mouse/stylus. For now use Mouse for all
if (0 && leftDown)
{
@@ -500,32 +520,42 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
{
App::I.mouse_move((float)GET_X_LPARAM(lp), (float)GET_Y_LPARAM(lp), WacomTablet::I.get_pressure(), kEventSource::Mouse);
}
async_unlock();
break;
case WM_LBUTTONDOWN:
//TODO: find a way to check if event is mouse/stylus. For now use Mouse for all
async_lock();
leftDown = true;
SetCapture(hWnd);
lastTime = GetMessageTime();
lastPoint = { GET_X_LPARAM(lp), GET_Y_LPARAM(lp) };
App::I.mouse_down(0, (float)GET_X_LPARAM(lp), (float)GET_Y_LPARAM(lp), WacomTablet::I.get_pressure(), kEventSource::Mouse);
async_unlock();
break;
case WM_LBUTTONUP:
async_lock();
WacomTablet::I.reset_pressure();
//TODO: find a way to check if event is mouse/stylus. For now use Mouse for all
App::I.mouse_up(0, (float)GET_X_LPARAM(lp), (float)GET_Y_LPARAM(lp), kEventSource::Mouse);
ReleaseCapture();
leftDown = false;
async_unlock();
break;
case WM_RBUTTONDOWN:
async_lock();
App::I.mouse_down(1, (float)GET_X_LPARAM(lp), (float)GET_Y_LPARAM(lp), 1.f, kEventSource::Mouse);
SetCapture(hWnd);
async_unlock();
break;
case WM_RBUTTONUP:
async_lock();
App::I.mouse_up(1, (float)GET_X_LPARAM(lp), (float)GET_Y_LPARAM(lp), kEventSource::Mouse);
ReleaseCapture();
async_unlock();
break;
case WM_MOUSEWHEEL:
{
async_locker lock;
POINT pt;
pt.x = GET_X_LPARAM(lp);
pt.y = GET_Y_LPARAM(lp);