ManaPlus
|
#include <touchmanager.h>
Public Types | |
enum | Types { NORMAL = 0 , LEFT = 1 , RIGHT = 2 } |
Public Member Functions | |
TouchManager () | |
~TouchManager () | |
void | init () |
void | loadTouchItem (TouchItem **item, const std::string &name, const std::string &imageName, const std::string &text, int x, int y, const int width, const int height, const int type, const std::string &eventPressed, const std::string &eventReleased, const TouchFuncPtr fAll, const TouchFuncPtr fPressed, const TouchFuncPtr fReleased, const TouchFuncPtr fOut) |
void | clear () |
void | draw () |
void | safeDraw () |
void | drawText () |
bool | processEvent (const MouseInput &mouseInput) |
bool | isActionActive (const InputActionT index) const |
void | setActionActive (const InputActionT index, const bool value) |
void | resize (const int width, const int height) |
void | unloadTouchItem (TouchItem **unloadItem) |
void | optionChanged (const std::string &value) |
void | loadPad () |
void | loadButtons () |
void | loadKeyboard () |
int | getPadSize () const |
void | setInGame (const bool b) |
void | setTempHide (const bool b) |
void | shutdown () |
Public Member Functions inherited from ConfigListener | |
ConfigListener () | |
virtual | ~ConfigListener () |
Static Public Member Functions | |
static void | unload (TouchItem *const item) |
static void | executeAction (const std::string &event) |
Private Attributes | |
TouchItem * | mKeyboard |
TouchItem * | mPad |
TouchItem * | mButtons [buttonsCount] |
TouchItemVector | mObjects |
ImageCollection * | mVertexes |
bool | mActions [actionsSize] |
bool | mRedraw |
bool | mShowJoystick |
bool | mShowButtons |
bool | mShowKeyboard |
int | mButtonsSize |
int | mJoystickSize |
int | mButtonsFormat |
int | mWidth |
int | mHeight |
bool | mShow |
bool | mInGame |
bool | mTempHideButtons |
Definition at line 102 of file touchmanager.h.
enum TouchManager::Types |
TouchManager::TouchManager | ( | ) |
Definition at line 54 of file touchmanager.cpp.
References actionsSize, buttonsCount, mActions, and mButtons.
TouchManager::~TouchManager | ( | ) |
void TouchManager::clear | ( | ) |
Definition at line 199 of file touchmanager.cpp.
References delete2, FOR_EACH, mObjects, mRedraw, mVertexes, and unload().
Referenced by Client::gameClear(), and ~TouchManager().
void TouchManager::draw | ( | ) |
Definition at line 208 of file touchmanager.cpp.
References Graphics::calcTileCollection(), Graphics::calcWindow(), ImageCollection::clear(), drawText(), Graphics::drawTileCollection(), Graphics::finalize(), FOR_EACH, TouchItem::height, TouchItem::icon, TouchItem::images, mainGraphics, mKeyboard, mObjects, mRedraw, mShow, mShowKeyboard, mVertexes, TouchItem::width, TouchItem::x, and TouchItem::y.
Referenced by Gui::draw().
void TouchManager::drawText | ( | ) |
Definition at line 259 of file touchmanager.cpp.
References boldFont, Font::drawString(), FOR_EACH, Theme::getColor(), Font::getHeight(), Font::getWidth(), gui, Rect::height, mainGraphics, mObjects, mShow, TouchItem::rect, QuestType::TEXT, TouchItem::text, theme, Rect::width, TouchItem::x, and TouchItem::y.
Referenced by draw(), and safeDraw().
|
static |
Definition at line 755 of file touchmanager.cpp.
References config, InputManager::executeAction(), Configuration::getIntValue(), and inputManager.
|
inline |
void TouchManager::init | ( | ) |
Definition at line 89 of file touchmanager.cpp.
References Configuration::addListener(), config, Configuration::getBoolValue(), Configuration::getIntValue(), getPadSize(), loadButtons(), loadKeyboard(), loadPad(), mainGraphics, mButtonsFormat, mButtonsSize, mHeight, Graphics::mHeight, mJoystickSize, mShowButtons, mShowJoystick, mShowKeyboard, mVertexes, mWidth, Graphics::mWidth, and setHalfJoyPad().
Referenced by Client::gameInit().
bool TouchManager::isActionActive | ( | const InputActionT | index | ) | const |
Definition at line 343 of file touchmanager.cpp.
References actionsSize, CAST_S32, and CAST_SIZE.
Referenced by InputManager::isActionActive0().
void TouchManager::loadButtons | ( | ) |
Definition at line 430 of file touchmanager.cpp.
References Skin::getOption(), Skin::getPadding(), Theme::getThemePath(), Theme::load(), loadTouchItem(), mButtons, mButtonsFormat, mButtonsSize, RIGHT, theme, Theme::unload(), x, and y.
Referenced by init().
void TouchManager::loadKeyboard | ( | ) |
Definition at line 656 of file touchmanager.cpp.
References loadTouchItem(), mKeyboard, and NORMAL.
Referenced by init().
void TouchManager::loadPad | ( | ) |
Definition at line 423 of file touchmanager.cpp.
References LEFT, loadTouchItem(), mJoystickSize, mPad, padClick(), padEvents(), padOut(), and padUp().
Referenced by init().
void TouchManager::loadTouchItem | ( | TouchItem ** | item, |
const std::string & | name, | ||
const std::string & | imageName, | ||
const std::string & | text, | ||
int | x, | ||
int | y, | ||
const int | width, | ||
const int | height, | ||
const int | type, | ||
const std::string & | eventPressed, | ||
const std::string & | eventReleased, | ||
const TouchFuncPtr | fAll, | ||
const TouchFuncPtr | fPressed, | ||
const TouchFuncPtr | fReleased, | ||
const TouchFuncPtr | fOut | ||
) |
Definition at line 120 of file touchmanager.cpp.
References Theme::getImageFromThemeXml(), Skin::getOption(), Skin::getPadding(), ImageRect::grid, if(), BeingDirection::LEFT, Theme::loadSkinRect(), mainGraphics, Graphics::mHeight, Graphics::mWidth, TargetCursorType::NORMAL, BeingDirection::RIGHT, theme, Theme::unload(), x, and y.
Referenced by loadButtons(), loadKeyboard(), and loadPad().
|
virtual |
Called when an option changed. The config listener will have to be registered to the option name first.
Implements ConfigListener.
Definition at line 663 of file touchmanager.cpp.
References buttonsCount, config, Configuration::getBoolValue(), Configuration::getIntValue(), and setHalfJoyPad().
bool TouchManager::processEvent | ( | const MouseInput & | mouseInput | ) |
Definition at line 286 of file touchmanager.cpp.
References MouseEventType::CLICKED, MouseEventType::DRAGGED, MouseEventType::ENTERED, TouchItem::eventPressed, TouchItem::eventReleased, MouseEventType::EXITED, FOR_EACH, TouchItem::funcAll, TouchItem::funcOut, TouchItem::funcPressed, TouchItem::funcReleased, Rect::isPointInRect(), MouseEventType::MOVED, MouseEventType::PRESSED, TouchItem::rect, MouseEventType::RELEASED, MouseEventType::RELEASED2, MouseInput::setX(), MouseEventType::WHEEL_MOVED_DOWN, MouseEventType::WHEEL_MOVED_UP, TouchItem::x, x, TouchItem::y, and y.
Referenced by Gui::handleMouseInput().
void TouchManager::resize | ( | const int | width, |
const int | height | ||
) |
Definition at line 353 of file touchmanager.cpp.
References FOR_EACH, TouchItem::height, BeingDirection::LEFT, mainGraphics, Graphics::mHeight, Graphics::mWidth, TargetCursorType::NORMAL, TouchItem::rect, BeingDirection::RIGHT, TouchItem::type, Rect::x, TouchItem::x, Rect::y, and TouchItem::y.
Referenced by WindowManager::resizeVideo().
void TouchManager::safeDraw | ( | ) |
Definition at line 237 of file touchmanager.cpp.
References Graphics::drawImage(), Graphics::drawImageRect(), drawText(), FOR_EACH, TouchItem::height, TouchItem::icon, TouchItem::images, mainGraphics, mKeyboard, mObjects, mShow, mShowKeyboard, TouchItem::width, TouchItem::x, and TouchItem::y.
Referenced by Gui::draw().
|
inline |
Definition at line 147 of file touchmanager.h.
References actionsSize, CAST_S32, and CAST_SIZE.
Referenced by moveChar().
void TouchManager::setInGame | ( | const bool | b | ) |
Definition at line 741 of file touchmanager.cpp.
Referenced by Game::Game(), and Game::~Game().
void TouchManager::setTempHide | ( | const bool | b | ) |
Definition at line 748 of file touchmanager.cpp.
Referenced by SetupWindow::setVisible().
void TouchManager::shutdown | ( | ) |
Definition at line 84 of file touchmanager.cpp.
References config, and Configuration::removeListeners().
Referenced by Client::gameClear().
|
static |
Definition at line 391 of file touchmanager.cpp.
References delete2, and Theme::unloadRect().
Referenced by clear().
void TouchManager::unloadTouchItem | ( | TouchItem ** | unloadItem | ) |
|
private |
Definition at line 188 of file touchmanager.h.
Referenced by TouchManager().
|
private |
Definition at line 185 of file touchmanager.h.
Referenced by loadButtons(), and TouchManager().
|
private |
Definition at line 195 of file touchmanager.h.
Referenced by init(), and loadButtons().
|
private |
Definition at line 193 of file touchmanager.h.
Referenced by init(), and loadButtons().
|
private |
Definition at line 197 of file touchmanager.h.
Referenced by init().
|
private |
Definition at line 199 of file touchmanager.h.
|
private |
Definition at line 194 of file touchmanager.h.
|
private |
Definition at line 183 of file touchmanager.h.
Referenced by draw(), loadKeyboard(), and safeDraw().
|
private |
Definition at line 186 of file touchmanager.h.
Referenced by clear(), draw(), drawText(), and safeDraw().
|
private |
Definition at line 184 of file touchmanager.h.
Referenced by loadPad().
|
private |
Definition at line 189 of file touchmanager.h.
|
private |
Definition at line 198 of file touchmanager.h.
Referenced by draw(), drawText(), and safeDraw().
|
private |
Definition at line 191 of file touchmanager.h.
Referenced by init().
|
private |
Definition at line 190 of file touchmanager.h.
Referenced by init().
|
private |
Definition at line 192 of file touchmanager.h.
Referenced by draw(), init(), and safeDraw().
|
private |
Definition at line 200 of file touchmanager.h.
|
private |
Definition at line 187 of file touchmanager.h.
|
private |
Definition at line 196 of file touchmanager.h.
Referenced by init().