summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/Makefile.am2
-rw-r--r--src/defaults.cpp2
-rw-r--r--src/gui/setup.cpp4
-rw-r--r--src/gui/setup_input.cpp6
-rw-r--r--src/gui/setup_input.h2
-rw-r--r--src/gui/setup_other.h4
-rw-r--r--src/gui/setup_touch.cpp52
-rw-r--r--src/gui/setup_touch.h43
-rw-r--r--src/touchmanager.cpp3
10 files changed, 109 insertions, 11 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 3cbf014a9..0b00f7143 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -321,6 +321,8 @@ SET(SRCS
gui/setup_other.h
gui/setup_theme.cpp
gui/setup_theme.h
+ gui/setup_touch.cpp
+ gui/setup_touch.h
gui/setup_chat.cpp
gui/setup_chat.h
gui/setup_input.cpp
diff --git a/src/Makefile.am b/src/Makefile.am
index a02c5da69..3af39acc2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -321,6 +321,8 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \
gui/setup_other.h \
gui/setup_theme.cpp \
gui/setup_theme.h \
+ gui/setup_touch.cpp \
+ gui/setup_touch.h \
gui/setup_chat.cpp \
gui/setup_chat.h \
gui/setup_input.cpp \
diff --git a/src/defaults.cpp b/src/defaults.cpp
index a384fabc2..37bfab0c1 100644
--- a/src/defaults.cpp
+++ b/src/defaults.cpp
@@ -108,12 +108,14 @@ DefaultsData* getConfigDefaults()
AddDEF("screenwidth", 0);
AddDEF("screenheight", 0);
AddDEF("showScreenJoystick", true);
+ AddDEF("showScreenButtons", true);
AddDEF("showBeingPopup", false);
AddDEF("mouseDirectionMove", true);
#else
AddDEF("screenwidth", defaultScreenWidth);
AddDEF("screenheight", defaultScreenHeight);
AddDEF("showScreenJoystick", false);
+ AddDEF("showScreenButtons", false);
AddDEF("showBeingPopup", true);
AddDEF("mouseDirectionMove", false);
#endif
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp
index 92900cffc..9677e052a 100644
--- a/src/gui/setup.cpp
+++ b/src/gui/setup.cpp
@@ -37,6 +37,7 @@
#include "gui/setup_perfomance.h"
#include "gui/setup_players.h"
#include "gui/setup_relations.h"
+#include "gui/setup_touch.h"
#include "gui/setup_video.h"
#include "gui/setup_visual.h"
@@ -97,8 +98,9 @@ Setup::Setup():
mTabs.push_back(new Setup_Visual(this));
mTabs.push_back(new Setup_Audio(this));
mTabs.push_back(new Setup_Perfomance(this));
- mTabs.push_back(new Setup_Joystick(this));
+ mTabs.push_back(new Setup_Touch(this));
mTabs.push_back(new Setup_Input(this));
+ mTabs.push_back(new Setup_Joystick(this));
mTabs.push_back(new Setup_Colors(this));
mTabs.push_back(new Setup_Chat(this));
mTabs.push_back(new Setup_Players(this));
diff --git a/src/gui/setup_input.cpp b/src/gui/setup_input.cpp
index ff3c1f49b..31743dd7e 100644
--- a/src/gui/setup_input.cpp
+++ b/src/gui/setup_input.cpp
@@ -99,9 +99,6 @@ Setup_Input::Setup_Input(const Widget2 *const widget) :
mDefaultButton(new Button(this, _("Default"), "default", this)),
mResetKeysButton(new Button(this, _("Reset all keys"), "resetkeys", this)),
mTabs(new TabStrip(this, config.getIntValue("fontSize") + 10)),
- mShowJoystick(config.getBoolValue("showScreenJoystick")),
- mJoystickCheckBox(new CheckBox(this,
- _("Show onscreen joystick"), mShowJoystick)),
mKeySetting(false),
mActionDataSize(new int [9])
{
@@ -159,7 +156,6 @@ Setup_Input::Setup_Input(const Widget2 *const widget) :
place(2, 6, mAssignKeyButton);
place(3, 6, mUnassignKeyButton);
place(4, 6, mDefaultButton);
- place(0, 7, mJoystickCheckBox);
int width = 600;
if (config.getIntValue("screenwidth") >= 730)
@@ -200,8 +196,6 @@ void Setup_Input::apply()
"Resolve them, or gameplay may result in strange behaviour."),
gettext(str1.c_str()), gettext(str2.c_str())), DIALOG_ERROR);
}
- mShowJoystick = mJoystickCheckBox->isSelected();
- config.setValue("showScreenJoystick", mShowJoystick);
keyboard.setEnabled(true);
inputManager.store();
}
diff --git a/src/gui/setup_input.h b/src/gui/setup_input.h
index 6accafe27..157c99cf2 100644
--- a/src/gui/setup_input.h
+++ b/src/gui/setup_input.h
@@ -98,8 +98,6 @@ class Setup_Input final : public SetupTab
Button *mDefaultButton;
Button *mResetKeysButton;
TabStrip *mTabs;
- bool mShowJoystick;
- CheckBox *mJoystickCheckBox;
bool mKeySetting; /**< flag to check if key being set. */
diff --git a/src/gui/setup_other.h b/src/gui/setup_other.h
index 940fcbfc6..37e79e974 100644
--- a/src/gui/setup_other.h
+++ b/src/gui/setup_other.h
@@ -20,8 +20,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef GUI_Setup_Other_H
-#define GUI_Setup_Other_H
+#ifndef GUI_SETYP_OTHER_H
+#define GUI_SETUP_OTHER_H
#include "gui/widgets/setupitem.h"
diff --git a/src/gui/setup_touch.cpp b/src/gui/setup_touch.cpp
new file mode 100644
index 000000000..e46ff0d73
--- /dev/null
+++ b/src/gui/setup_touch.cpp
@@ -0,0 +1,52 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2011-2012 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * 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 2 of the License, or
+ * 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/>.
+ */
+
+#include "gui/setup_touch.h"
+
+#include "gui/widgets/layouthelper.h"
+#include "gui/widgets/scrollarea.h"
+
+#include "configuration.h"
+
+#include "utils/gettext.h"
+
+#include "debug.h"
+
+Setup_Touch::Setup_Touch(const Widget2 *const widget) :
+ SetupTabScroll(widget)
+{
+ setName(_("Touch"));
+
+ LayoutHelper h(this);
+ ContainerPlacer place = h.getPlacer(0, 0);
+ place(0, 0, mScroll, 10, 10);
+
+ new SetupItemCheckBox(_("Show on screen buttons"), "",
+ "showScreenButtons", this, "showScreenButtonsEvent");
+
+ new SetupItemCheckBox(_("Show on screen joystick"), "",
+ "showScreenJoystick", this, "showScreenJoystickEvent");
+
+ setDimension(gcn::Rectangle(0, 0, 550, 350));
+}
+
+Setup_Touch::~Setup_Touch()
+{
+}
diff --git a/src/gui/setup_touch.h b/src/gui/setup_touch.h
new file mode 100644
index 000000000..ef677f214
--- /dev/null
+++ b/src/gui/setup_touch.h
@@ -0,0 +1,43 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2011-2012 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * 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 2 of the License, or
+ * 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_SETUP_TOUCH_H
+#define GUI_SETUP_TOUCH_H
+
+#include "gui/widgets/setupitem.h"
+
+#include <guichan/actionlistener.hpp>
+
+class EditDialog;
+class TextField;
+
+class Setup_Touch final : public SetupTabScroll
+{
+ public:
+ Setup_Touch(const Widget2 *const widget);
+
+ A_DELETE_COPY(Setup_Touch)
+
+ ~Setup_Touch();
+
+ protected:
+};
+
+#endif
diff --git a/src/touchmanager.cpp b/src/touchmanager.cpp
index 96a083872..5b04b2023 100644
--- a/src/touchmanager.cpp
+++ b/src/touchmanager.cpp
@@ -63,6 +63,9 @@ void TouchManager::init()
{
loadTouchItem(&mPad, "dpad.xml", 100, 100, LEFT,
&padEvents, &padClick, &padUp, &padOut);
+ }
+ if (config.getBoolValue("showScreenButtons"))
+ {
loadTouchItem(&mAttack, "dpad_attack.xml", 60, 60, RIGHT,
nullptr, &attackClick, nullptr, nullptr);
loadTouchItem(&mCancel, "dpad_cancel.xml", 60, 60, RIGHT,