hid_to_vpad/src/gui/VPadController.h
Maschell e48fc17615 Now using devkitpro r29, fixed bug with configs, improved logging and changed datatypes
- Finally switching to r29
- Modifed the travis and .pl script to download r29 of devkit pro
- Improved the logging (more information)
- Fixed the bug when you have too many config files on the sd card
(maximum now 24)
- Changed all int to s32
- Some more general code cleanup
2017-04-10 11:07:50 +02:00

64 lines
1.9 KiB
C++

/****************************************************************************
* Copyright (C) 2015 Dimok
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#ifndef VPAD_CONTROLLER_H_
#define VPAD_CONTROLLER_H_
#include "GuiController.h"
#include "dynamic_libs/vpad_functions.h"
class VPadController : public GuiController
{
public:
//!Constructor
VPadController(s32 channel)
: GuiController(channel)
{
memset(&vpad, 0, sizeof(vpad));
}
//!Destructor
virtual ~VPadController() {}
bool update(s32 width, s32 height)
{
lastData = data;
s32 vpadError = -1;
VPADRead(0, &vpad, 1, &vpadError);
if(vpadError == 0)
{
data.buttons_r = vpad.btns_r;
data.buttons_h = vpad.btns_h;
data.buttons_d = vpad.btns_d;
data.validPointer = !vpad.tpdata.invalid;
data.touched = vpad.tpdata.touched;
//! calculate the screen offsets
data.x = -(width >> 1) + ((s32)(vpad.tpdata1.x * ((width)/1211.0f)*width) >> 12)-30;
data.y = -(height >> 1) + ((s32)(vpad.tpdata1.y * ((height)/653.0f)*height) >> 12)-35;
return true;
}
return false;
}
private:
VPADData vpad;
};
#endif