Files
vba10/virtualcontrollerinput.h

134 lines
3.1 KiB
C
Raw Permalink Normal View History

#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;
struct PointerInfo
{
Windows::UI::Input::PointerPoint^ point;
bool IsMoved;
Platform::String^ description;
};
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);
void GetTurboRectangle(RECT *rect);
void GetComboRectangle(RECT *rect);
void GetLRectangle(RECT *rect);
void GetRRectangle(RECT *rect);
void Update(void);
2015-09-01 04:15:23 +00:00
void EnterEditMode();
2015-09-01 04:15:23 +00:00
bool IsEditMode();
void LeaveEditMode(bool accept);
private:
static VirtualControllerInput *instance;
float physicalWidth, physicalHeight; //in inch
std::map<unsigned int, PointerInfo*> *pointers;
bool stickFingerDown;
int stickFingerID;
Windows::Foundation::Point stickPos;
Windows::Foundation::Point stickOffset;
2015-06-10 03:26:40 +00:00
Windows::Foundation::Point ptest;
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;
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;
Windows::Foundation::Rect lRect;
Windows::Foundation::Rect rRect;
Windows::Foundation::Rect aRect;
Windows::Foundation::Rect bRect;
2015-07-09 12:50:40 +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;
int LCenterY;
2015-07-09 12:50:40 +00:00
int rRight;
int RCenterY;
2015-07-09 12:50:40 +00:00
float hscale, vscale;
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);
bool isEditMode;
};
}