2015-06-06 23:38:27 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "EmulatorInput.h"
|
|
|
|
|
#include <collection.h>
|
|
|
|
|
|
|
|
|
|
using namespace Windows::UI::Input;
|
|
|
|
|
using namespace Platform::Collections;
|
|
|
|
|
|
|
|
|
|
#define ARRAY_SIZE 1009
|
|
|
|
|
#define SMALL_ARRAY_SIZE 10
|
|
|
|
|
|
|
|
|
|
namespace VBA10
|
|
|
|
|
{
|
|
|
|
|
class EmulatorGame;
|
|
|
|
|
|
2015-08-29 17:49:22 +00:00
|
|
|
struct PointerInfo
|
|
|
|
|
{
|
|
|
|
|
Windows::UI::Input::PointerPoint^ point;
|
|
|
|
|
bool IsMoved;
|
|
|
|
|
Platform::String^ description;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-06-06 23:38:27 +00:00
|
|
|
class VirtualControllerInput
|
|
|
|
|
: public EmulatorInput
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
static VirtualControllerInput *GetInstance(void);
|
|
|
|
|
|
|
|
|
|
VirtualControllerInput(void);
|
|
|
|
|
~VirtualControllerInput(void);
|
|
|
|
|
|
|
|
|
|
const ControllerState *GetControllerState(void);
|
|
|
|
|
|
|
|
|
|
void GetStickRectangle(RECT *rect);
|
|
|
|
|
void GetStickCenterRectangle(RECT *rect);
|
|
|
|
|
bool StickFingerDown(void);
|
|
|
|
|
void Reset(void);
|
|
|
|
|
|
|
|
|
|
void PointerPressed(PointerPoint ^point);
|
|
|
|
|
void PointerMoved(PointerPoint ^point);
|
|
|
|
|
void PointerReleased(PointerPoint ^point);
|
|
|
|
|
|
|
|
|
|
void UpdateVirtualControllerRectangles(void);
|
|
|
|
|
|
|
|
|
|
void GetCrossRectangle(RECT *rect);
|
2015-07-09 13:28:56 +00:00
|
|
|
void GetARectangle(RECT *rect);
|
|
|
|
|
void GetBRectangle(RECT *rect);
|
|
|
|
|
void GetStartRectangle(RECT *rect);
|
|
|
|
|
void GetSelectRectangle(RECT *rect);
|
2015-07-11 20:59:39 +00:00
|
|
|
void GetTurboRectangle(RECT *rect);
|
|
|
|
|
void GetComboRectangle(RECT *rect);
|
2015-06-06 23:38:27 +00:00
|
|
|
void GetLRectangle(RECT *rect);
|
|
|
|
|
void GetRRectangle(RECT *rect);
|
|
|
|
|
void Update(void);
|
|
|
|
|
|
2015-09-01 04:15:23 +00:00
|
|
|
|
2015-08-29 17:49:22 +00:00
|
|
|
void EnterEditMode();
|
2015-09-01 04:15:23 +00:00
|
|
|
bool IsEditMode();
|
2015-08-29 17:49:22 +00:00
|
|
|
void LeaveEditMode(bool accept);
|
|
|
|
|
|
2015-06-06 23:38:27 +00:00
|
|
|
private:
|
|
|
|
|
static VirtualControllerInput *instance;
|
2015-07-10 16:48:30 +00:00
|
|
|
float physicalWidth, physicalHeight; //in inch
|
2015-06-06 23:38:27 +00:00
|
|
|
|
2015-08-29 17:49:22 +00:00
|
|
|
std::map<unsigned int, PointerInfo*> *pointers;
|
2015-06-06 23:38:27 +00:00
|
|
|
|
|
|
|
|
bool stickFingerDown;
|
|
|
|
|
int stickFingerID;
|
|
|
|
|
Windows::Foundation::Point stickPos;
|
|
|
|
|
Windows::Foundation::Point stickOffset;
|
2015-06-10 03:26:40 +00:00
|
|
|
Windows::Foundation::Point ptest;
|
2015-06-06 23:38:27 +00:00
|
|
|
POINT visibleStickPos;
|
|
|
|
|
POINT visibleStickOffset;
|
|
|
|
|
Windows::Foundation::Rect stickBoundaries;
|
|
|
|
|
|
|
|
|
|
CRITICAL_SECTION cs;
|
|
|
|
|
EmulatorGame *emulator;
|
|
|
|
|
ControllerState state;
|
|
|
|
|
|
|
|
|
|
RECT padCrossRectangle;
|
2015-07-09 12:50:40 +00:00
|
|
|
RECT startRectangle;
|
|
|
|
|
RECT selectRectangle;
|
|
|
|
|
RECT turboRectangle;
|
|
|
|
|
RECT comboRectangle;
|
|
|
|
|
RECT aRectangle;
|
|
|
|
|
RECT bRectangle;
|
2015-06-06 23:38:27 +00:00
|
|
|
RECT lRectangle;
|
|
|
|
|
RECT rRectangle;
|
|
|
|
|
|
|
|
|
|
Windows::Foundation::Rect leftRect;
|
|
|
|
|
Windows::Foundation::Rect upRect;
|
|
|
|
|
Windows::Foundation::Rect rightRect;
|
|
|
|
|
Windows::Foundation::Rect downRect;
|
|
|
|
|
Windows::Foundation::Rect startRect;
|
|
|
|
|
Windows::Foundation::Rect selectRect;
|
2015-07-09 12:50:40 +00:00
|
|
|
Windows::Foundation::Rect turboRect;
|
|
|
|
|
Windows::Foundation::Rect comboRect;
|
2015-06-06 23:38:27 +00:00
|
|
|
Windows::Foundation::Rect lRect;
|
|
|
|
|
Windows::Foundation::Rect rRect;
|
|
|
|
|
Windows::Foundation::Rect aRect;
|
|
|
|
|
Windows::Foundation::Rect bRect;
|
2015-07-09 12:50:40 +00:00
|
|
|
|
|
|
|
|
|
2015-07-11 20:59:39 +00:00
|
|
|
int PadLeft;
|
|
|
|
|
int PadBottom;
|
|
|
|
|
int ACenterX;
|
|
|
|
|
int ACenterY;
|
|
|
|
|
int BCenterX;
|
|
|
|
|
int BCenterY;
|
|
|
|
|
int startCenterX;
|
|
|
|
|
int startBottom;
|
|
|
|
|
int selectCenterX;
|
|
|
|
|
int selectBottom;
|
|
|
|
|
int TurboCenterX;
|
|
|
|
|
int TurboCenterY;
|
|
|
|
|
int ComboCenterX;
|
|
|
|
|
int ComboCenterY;
|
2015-07-09 12:50:40 +00:00
|
|
|
int lLeft;
|
2015-07-11 20:59:39 +00:00
|
|
|
int LCenterY;
|
2015-07-09 12:50:40 +00:00
|
|
|
int rRight;
|
2015-07-11 20:59:39 +00:00
|
|
|
int RCenterY;
|
2015-07-09 12:50:40 +00:00
|
|
|
|
2015-07-11 20:59:39 +00:00
|
|
|
float hscale, vscale;
|
2015-06-06 23:38:27 +00:00
|
|
|
|
2015-09-02 13:34:14 +00:00
|
|
|
void SaveControllerPositionSettings();
|
2015-09-01 04:15:23 +00:00
|
|
|
void SetControllerPositionFromSettings();
|
2015-07-09 12:50:40 +00:00
|
|
|
void CreateRenderRectangles(void);
|
|
|
|
|
void CreateTouchRectangles(void);
|
|
|
|
|
|
2015-08-29 17:49:22 +00:00
|
|
|
bool isEditMode;
|
2015-06-06 23:38:27 +00:00
|
|
|
};
|
|
|
|
|
}
|