2014-02-21 11:43:05 +01:00
|
|
|
#include <atomic>
|
|
|
|
#include <vector>
|
|
|
|
#include <iostream>
|
|
|
|
#include <chrono>
|
|
|
|
#include <ctime>
|
|
|
|
#include <map>
|
|
|
|
#include <thread>
|
|
|
|
#include <chrono>
|
|
|
|
#include <iomanip>
|
|
|
|
#include <mutex>
|
|
|
|
#include <bitset>
|
|
|
|
#include <Windows.h>
|
|
|
|
|
|
|
|
#include "Include\Input.h"
|
2014-02-24 16:27:43 +01:00
|
|
|
#include "WindowShell.h"
|
2014-02-21 11:43:05 +01:00
|
|
|
|
|
|
|
using namespace std;
|
2014-02-24 16:27:43 +01:00
|
|
|
using namespace Input;
|
|
|
|
using namespace Input::Enum;
|
2014-02-21 11:43:05 +01:00
|
|
|
|
2014-02-24 16:27:43 +01:00
|
|
|
Input::Keyboard* keyboard = 0;
|
|
|
|
Input::Mouse* mouse = 0;
|
|
|
|
|
|
|
|
void KeyPress(Input::Enum::SAKI key, Input::Keyboard* sender)
|
2013-11-06 22:52:00 +01:00
|
|
|
{
|
2014-02-24 16:27:43 +01:00
|
|
|
if(key == SAKI_A)
|
|
|
|
{
|
|
|
|
if(mouse->IsActive()) mouse->Deactivate();
|
|
|
|
else mouse->Activate();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void MouseVelocity(Input::Struct::SAIPointInt2D vel, Input::Mouse* sender)
|
|
|
|
{
|
|
|
|
int i = vel.Length();
|
|
|
|
if(abs(i) > 2)
|
|
|
|
i = 0;
|
|
|
|
}
|
2014-02-21 11:43:05 +01:00
|
|
|
|
2014-02-24 16:27:43 +01:00
|
|
|
int WINAPI WinMain( HINSTANCE hinst, HINSTANCE prevInst, PSTR cmdLine, int cmdShow)
|
|
|
|
{
|
2014-02-21 11:43:05 +01:00
|
|
|
std::wstring text;
|
2014-02-24 16:27:43 +01:00
|
|
|
|
|
|
|
WindowShell::CreateWin(WindowShell::WINDOW_INIT_DESC());
|
|
|
|
WindowShell::CreateConsoleWindow();
|
|
|
|
keyboard = Input::InputManager::Instance()->CreateKeyboardDevice(WindowShell::GetHWND());
|
|
|
|
mouse = Input::InputManager::Instance()->CreateMouseDevice(WindowShell::GetHWND());
|
|
|
|
|
|
|
|
mouse->AddOnMouseMoveVelocityCallback(MouseVelocity);
|
|
|
|
keyboard->BindTextTarget( &text );
|
|
|
|
keyboard->AddOnKeyPressCallback(KeyPress);
|
|
|
|
|
2014-02-21 11:43:05 +01:00
|
|
|
int oldLen = 0;
|
|
|
|
|
|
|
|
while (WindowShell::Frame())
|
|
|
|
{
|
|
|
|
if(text.length() != oldLen)
|
|
|
|
{
|
|
|
|
wprintf(text.c_str());
|
2014-02-24 16:27:43 +01:00
|
|
|
oldLen =text.length();
|
2014-02-21 11:43:05 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
system("pause");
|
2014-02-24 16:27:43 +01:00
|
|
|
|
|
|
|
return cmdShow;
|
2013-11-06 22:52:00 +01:00
|
|
|
}
|