libgui/include/gui/GuiController.h

75 lines
2.0 KiB
C
Raw Normal View History

2017-10-29 10:28:14 +01:00
/****************************************************************************
* 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 GUI_CONTROLLER_H_
#define GUI_CONTROLLER_H_
#include <string.h>
2018-06-21 20:44:58 +02:00
#include <gui/GuiTrigger.h>
2017-10-29 10:28:14 +01:00
2018-06-21 20:44:58 +02:00
class GuiController {
2017-10-29 10:28:14 +01:00
public:
//!Constructor
2018-06-21 20:44:58 +02:00
GuiController(int32_t channel)
: chan(channel) {
2017-10-29 10:28:14 +01:00
memset(&lastData, 0, sizeof(lastData));
memset(&data, 0, sizeof(data));
2018-06-21 20:44:58 +02:00
switch(chan) {
2017-10-29 10:28:14 +01:00
default:
case GuiTrigger::CHANNEL_1:
chanIdx = 0;
break;
case GuiTrigger::CHANNEL_2:
chanIdx = 1;
break;
case GuiTrigger::CHANNEL_3:
chanIdx = 2;
break;
case GuiTrigger::CHANNEL_4:
chanIdx = 3;
break;
case GuiTrigger::CHANNEL_5:
chanIdx = 4;
break;
}
}
//!Destructor
virtual ~GuiController() {}
2018-06-21 20:44:58 +02:00
virtual bool update(int32_t width, int32_t height) = 0;
2017-10-29 10:28:14 +01:00
2018-06-21 20:44:58 +02:00
typedef struct {
uint32_t buttons_h;
uint32_t buttons_d;
uint32_t buttons_r;
2017-10-29 10:28:14 +01:00
bool validPointer;
bool touched;
float pointerAngle;
2018-06-21 20:44:58 +02:00
int32_t x;
int32_t y;
2017-10-29 10:28:14 +01:00
} PadData;
2018-06-21 20:44:58 +02:00
int32_t chan;
int32_t chanIdx;
2017-10-29 10:28:14 +01:00
PadData data;
PadData lastData;
};
#endif