mirror of
https://github.com/minetest/minetest.git
synced 2024-11-30 03:23:45 +01:00
small fix
This commit is contained in:
parent
9d09103e48
commit
4f44cabe1c
238
doc/README.txt
Normal file
238
doc/README.txt
Normal file
@ -0,0 +1,238 @@
|
|||||||
|
Minetest-c55
|
||||||
|
---------------
|
||||||
|
An InfiniMiner/Minecraft inspired game.
|
||||||
|
Copyright (c) 2010-2011 Perttu Ahola <celeron55@gmail.com>
|
||||||
|
|
||||||
|
Further documentation:
|
||||||
|
----------------------
|
||||||
|
- Website: http://celeron.55.lt/~celeron55/minetest/
|
||||||
|
- Wiki: http://celeron.55.lt/~celeron55/minetest/wiki/
|
||||||
|
- Forum: http://celeron.55.lt/~celeron55/minetest/forum/
|
||||||
|
|
||||||
|
This is a development version:
|
||||||
|
------------------------------
|
||||||
|
- Don't expect it to work as well as a finished game will.
|
||||||
|
- Please report any bugs to me. That way I can fix them to the next release.
|
||||||
|
- debug.txt is useful when the game crashes.
|
||||||
|
|
||||||
|
Controls:
|
||||||
|
---------
|
||||||
|
- See the in-game pause menu
|
||||||
|
- Settable in the configuration file, see the section below.
|
||||||
|
|
||||||
|
Map directory:
|
||||||
|
--------------
|
||||||
|
- Map is stored in a directory, which can be removed to generate a new map.
|
||||||
|
- There is a command-line option for it: --map-dir
|
||||||
|
- For a RUN_IN_PLACE build, it is located in:
|
||||||
|
../map
|
||||||
|
- Otherwise something like this:
|
||||||
|
Windows: C:\Documents and Settings\user\Application Data\minetest\map
|
||||||
|
Linux: ~/.minetest/map
|
||||||
|
OS X: ~/Library/Application Support/minetest/map
|
||||||
|
|
||||||
|
Configuration file:
|
||||||
|
-------------------
|
||||||
|
- An optional configuration file can be used. See minetest.conf.example.
|
||||||
|
- Path to file can be passed as a parameter to the executable:
|
||||||
|
--config <path-to-file>
|
||||||
|
- Defaults:
|
||||||
|
- If built with -DRUN_IN_PLACE=1:
|
||||||
|
../minetest.conf
|
||||||
|
../../minetest.conf
|
||||||
|
- Otherwise something like this:
|
||||||
|
Windows: C:\Documents and Settings\user\Application Data\minetest\minetest.conf
|
||||||
|
Linux: ~/.minetest/minetest.conf
|
||||||
|
OS X: ~/Library/Application Support/minetest.conf
|
||||||
|
|
||||||
|
Command-line options:
|
||||||
|
---------------------
|
||||||
|
- Use --help
|
||||||
|
|
||||||
|
Compiling on GNU/Linux:
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
Install dependencies. Here's an example for Debian/Ubuntu:
|
||||||
|
$ apt-get install build-essential libirrlicht-dev cmake libbz2-dev libpng12-dev libjpeg8-dev libxxf86vm-dev libgl1-mesa-dev
|
||||||
|
|
||||||
|
Download source, extract (this is the URL to the latest of source repository, which might not work at all times):
|
||||||
|
$ wget https://bitbucket.org/celeron55/minetest/get/tip.tar.gz
|
||||||
|
$ tar xf tip.tar.gz
|
||||||
|
$ cd minetest
|
||||||
|
|
||||||
|
Build a version that runs directly from the source directory:
|
||||||
|
$ cmake . -DRUN_IN_PLACE=1
|
||||||
|
$ make -j2
|
||||||
|
|
||||||
|
Run it:
|
||||||
|
$ cd bin
|
||||||
|
$ ./minetest
|
||||||
|
|
||||||
|
- Use cmake . -LH to see all CMake options and their current state
|
||||||
|
- If you want to install it system-wide (or are making a distribution package), you will want to use -DRUN_IN_PLACE=0
|
||||||
|
- You can build a bare server or a bare client by specifying -DBUILD_CLIENT=0 or -DBUILD_SERVER=0
|
||||||
|
- You can select between Release and Debug build by -DCMAKE_BUILD_TYPE=<Debug or Release>
|
||||||
|
- Note that the Debug build is considerably slower
|
||||||
|
|
||||||
|
Compiling on Windows:
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
- You need:
|
||||||
|
* CMake:
|
||||||
|
http://www.cmake.org/cmake/resources/software.html
|
||||||
|
* MinGW or Visual Studio
|
||||||
|
http://www.mingw.org/
|
||||||
|
http://msdn.microsoft.com/en-us/vstudio/default
|
||||||
|
* Irrlicht SDK 1.7:
|
||||||
|
http://irrlicht.sourceforge.net/downloads.html
|
||||||
|
* Zlib headers (zlib125.zip)
|
||||||
|
http://www.winimage.com/zLibDll/index.html
|
||||||
|
* Zlib library (zlibwapi.lib and zlibwapi.dll from zlib125dll.zip):
|
||||||
|
http://www.winimage.com/zLibDll/index.html
|
||||||
|
* And, of course, Minetest-c55:
|
||||||
|
http://celeron.55.lt/~celeron55/minetest/download
|
||||||
|
- Steps:
|
||||||
|
- Select a directory called DIR hereafter in which you will operate.
|
||||||
|
- Make sure you have CMake and a compiler installed.
|
||||||
|
- Download all the other stuff to DIR and extract them into there. All those
|
||||||
|
packages contain a nice base directory in them, which should end up being
|
||||||
|
the direct subdirectories of DIR.
|
||||||
|
- You will end up with a directory structure like this (+=dir, -=file):
|
||||||
|
-----------------
|
||||||
|
+ DIR
|
||||||
|
- zlib-1.2.5.tar.gz
|
||||||
|
- zlib125dll.zip
|
||||||
|
- irrlicht-1.7.1.zip
|
||||||
|
- 110214175330.zip (or whatever, this is the minetest source)
|
||||||
|
+ zlib-1.2.5
|
||||||
|
- zlib.h
|
||||||
|
+ win32
|
||||||
|
...
|
||||||
|
+ zlib125dll
|
||||||
|
- readme.txt
|
||||||
|
+ dll32
|
||||||
|
...
|
||||||
|
+ irrlicht-1.7.1
|
||||||
|
+ lib
|
||||||
|
+ include
|
||||||
|
...
|
||||||
|
+ minetest
|
||||||
|
+ src
|
||||||
|
+ doc
|
||||||
|
- CMakeLists.txt
|
||||||
|
...
|
||||||
|
-----------------
|
||||||
|
- Start up the CMake GUI
|
||||||
|
- Select "Browse Source..." and select DIR/minetest
|
||||||
|
- Now, if using MSVC:
|
||||||
|
- Select "Browse Build..." and select DIR/minetest-build
|
||||||
|
- Else if using MinGW:
|
||||||
|
- Select "Browse Build..." and select DIR/minetest
|
||||||
|
- Select "Configure"
|
||||||
|
- Select your compiler
|
||||||
|
- It will warn about missing stuff, ignore that at this point. (later don't)
|
||||||
|
- Make sure the configuration is as follows
|
||||||
|
(note that the versions may differ for you):
|
||||||
|
-----------------
|
||||||
|
BUILD_CLIENT [X]
|
||||||
|
BUILD_SERVER [ ]
|
||||||
|
CMAKE_BUILD_TYPE Release
|
||||||
|
CMAKE_INSTALL_PREFIX DIR/minetest-install
|
||||||
|
IRRLICHT_SOURCE_DIR DIR/irrlicht-1.7.1
|
||||||
|
RUN_IN_PLACE [X]
|
||||||
|
WARN_ALL [ ]
|
||||||
|
ZLIB_DLL DIR/zlib125dll/dll32/zlibwapi.dll
|
||||||
|
ZLIB_INCLUDE_DIR DIR/zlib-1.2.5
|
||||||
|
ZLIB_LIBRARIES DIR/zlib125dll/dll32/zlibwapi.lib
|
||||||
|
-----------------
|
||||||
|
- Hit "Configure"
|
||||||
|
- Hit "Generate"
|
||||||
|
If using MSVC:
|
||||||
|
- Open the generated minetest.sln
|
||||||
|
- The project defaults to the "Debug" configuration. Make very sure to
|
||||||
|
select "Release", unless you want to debug some stuff (it's slower)
|
||||||
|
- Build the ALL_BUILD project
|
||||||
|
- Build the INSTALL project
|
||||||
|
- You should now have a working game with the executable in
|
||||||
|
DIR/minetest-install/bin/minetest.exe
|
||||||
|
- Additionally you may create a zip package by building the PACKAGE
|
||||||
|
project.
|
||||||
|
If using MinGW:
|
||||||
|
- Using the command line, browse to the build directory and run 'make'
|
||||||
|
(or mingw32-make or whatever it happens to be)
|
||||||
|
- You should now have a working game with the executable in
|
||||||
|
DIR/minetest/bin/minetest.exe
|
||||||
|
|
||||||
|
License of Minetest-c55
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
Minetest-c55
|
||||||
|
Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||||
|
|
||||||
|
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
|
||||||
|
(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, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
|
Irrlicht
|
||||||
|
---------------
|
||||||
|
|
||||||
|
This program uses the Irrlicht Engine. http://irrlicht.sourceforge.net/
|
||||||
|
|
||||||
|
The Irrlicht Engine License
|
||||||
|
|
||||||
|
Copyright © 2002-2005 Nikolaus Gebhardt
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute
|
||||||
|
it freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you
|
||||||
|
must not claim that you wrote the original software. If you use
|
||||||
|
this software in a product, an acknowledgment in the product
|
||||||
|
documentation would be appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must
|
||||||
|
not be misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source
|
||||||
|
distribution.
|
||||||
|
|
||||||
|
|
||||||
|
JThread
|
||||||
|
---------------
|
||||||
|
|
||||||
|
This program uses the JThread library. License for JThread follows:
|
||||||
|
|
||||||
|
Copyright (c) 2000-2006 Jori Liesenborgs (jori.liesenborgs@gmail.com)
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
to deal in the Software without restriction, including without limitation
|
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included
|
||||||
|
in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
IN THE SOFTWARE.
|
||||||
|
|
||||||
|
|
63
makepackage_binary.sh
Executable file
63
makepackage_binary.sh
Executable file
@ -0,0 +1,63 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
PACKAGEDIR=../minetest-packages
|
||||||
|
PACKAGENAME=minetest-c55-binary-`date +%y%m%d%H%M%S`
|
||||||
|
PACKAGEPATH=$PACKAGEDIR/$PACKAGENAME
|
||||||
|
|
||||||
|
mkdir -p $PACKAGEPATH
|
||||||
|
mkdir -p $PACKAGEPATH/bin
|
||||||
|
mkdir -p $PACKAGEPATH/data
|
||||||
|
mkdir -p $PACKAGEPATH/doc
|
||||||
|
|
||||||
|
cp minetest.conf.example $PACKAGEPATH/
|
||||||
|
|
||||||
|
cp bin/minetest.exe $PACKAGEPATH/bin/
|
||||||
|
cp bin/Irrlicht.dll $PACKAGEPATH/bin/
|
||||||
|
cp bin/zlibwapi.dll $PACKAGEPATH/bin/
|
||||||
|
#cp bin/test $PACKAGEPATH/bin/
|
||||||
|
#cp bin/fasttest $PACKAGEPATH/bin/
|
||||||
|
#cp bin/server $PACKAGEPATH/bin/
|
||||||
|
#cp ../irrlicht/irrlicht-1.7.1/lib/Linux/libIrrlicht.a $PACKAGEPATH/bin/
|
||||||
|
#cp ../jthread/jthread-1.2.1/src/.libs/libjthread-1.2.1.so $PACKAGEPATH/bin/
|
||||||
|
|
||||||
|
cp -r data/fontlucida.png $PACKAGEPATH/data/
|
||||||
|
cp -r data/player.png $PACKAGEPATH/data/
|
||||||
|
cp -r data/player_back.png $PACKAGEPATH/data/
|
||||||
|
cp -r data/stone.png $PACKAGEPATH/data/
|
||||||
|
cp -r data/grass.png $PACKAGEPATH/data/
|
||||||
|
cp -r data/grass_footsteps.png $PACKAGEPATH/data/
|
||||||
|
cp -r data/water.png $PACKAGEPATH/data/
|
||||||
|
cp -r data/tree.png $PACKAGEPATH/data/
|
||||||
|
cp -r data/leaves.png $PACKAGEPATH/data/
|
||||||
|
cp -r data/mese.png $PACKAGEPATH/data/
|
||||||
|
cp -r data/cloud.png $PACKAGEPATH/data/
|
||||||
|
cp -r data/sign.png $PACKAGEPATH/data/
|
||||||
|
cp -r data/sign_back.png $PACKAGEPATH/data/
|
||||||
|
cp -r data/rat.png $PACKAGEPATH/data/
|
||||||
|
cp -r data/mud.png $PACKAGEPATH/data/
|
||||||
|
cp -r data/torch.png $PACKAGEPATH/data/
|
||||||
|
cp -r data/torch_on_floor.png $PACKAGEPATH/data/
|
||||||
|
cp -r data/torch_on_ceiling.png $PACKAGEPATH/data/
|
||||||
|
cp -r data/tree_top.png $PACKAGEPATH/data/
|
||||||
|
cp -r data/coalstone.png $PACKAGEPATH/data/
|
||||||
|
cp -r data/crack.png $PACKAGEPATH/data/
|
||||||
|
cp -r data/wood.png $PACKAGEPATH/data/
|
||||||
|
cp -r data/stick.png $PACKAGEPATH/data/
|
||||||
|
cp -r data/tool_wpick.png $PACKAGEPATH/data/
|
||||||
|
cp -r data/tool_stpick.png $PACKAGEPATH/data/
|
||||||
|
cp -r data/tool_mesepick.png $PACKAGEPATH/data/
|
||||||
|
cp -r data/grass_side.png $PACKAGEPATH/data/
|
||||||
|
cp -r data/lump_of_coal.png $PACKAGEPATH/data/
|
||||||
|
cp -r data/lump_of_iron.png $PACKAGEPATH/data/
|
||||||
|
cp -r data/mineral_coal.png $PACKAGEPATH/data/
|
||||||
|
cp -r data/mineral_iron.png $PACKAGEPATH/data/
|
||||||
|
cp -r data/sand.png $PACKAGEPATH/data/
|
||||||
|
|
||||||
|
#cp -r data/pauseMenu.gui $PACKAGEPATH/data/
|
||||||
|
|
||||||
|
cp -r doc/README.txt $PACKAGEPATH/doc/README.txt
|
||||||
|
|
||||||
|
cd $PACKAGEDIR
|
||||||
|
rm $PACKAGENAME.zip
|
||||||
|
zip -r $PACKAGENAME.zip $PACKAGENAME
|
||||||
|
|
598
src/guiKeyChangeMenu.cpp
Normal file
598
src/guiKeyChangeMenu.cpp
Normal file
@ -0,0 +1,598 @@
|
|||||||
|
/*
|
||||||
|
Minetest-delta
|
||||||
|
Copyright (C) 2010-11 celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||||
|
Copyright (C) 2011 Ciaran Gultnieks <ciaran@ciarang.com>
|
||||||
|
Copyright (C) 2011 teddydestodes <derkomtur@schattengang.net>
|
||||||
|
|
||||||
|
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
|
||||||
|
(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, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "guiKeyChangeMenu.h"
|
||||||
|
#include "debug.h"
|
||||||
|
#include "serialization.h"
|
||||||
|
#include "keycode.h"
|
||||||
|
#include "main.h"
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
GUIKeyChangeMenu::GUIKeyChangeMenu(gui::IGUIEnvironment* env,
|
||||||
|
gui::IGUIElement* parent, s32 id, IMenuManager *menumgr) :
|
||||||
|
GUIModalMenu(env, parent, id, menumgr)
|
||||||
|
{
|
||||||
|
activeKey = -1;
|
||||||
|
init_keys();
|
||||||
|
}
|
||||||
|
|
||||||
|
GUIKeyChangeMenu::~GUIKeyChangeMenu()
|
||||||
|
{
|
||||||
|
removeChildren();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GUIKeyChangeMenu::removeChildren()
|
||||||
|
{
|
||||||
|
const core::list<gui::IGUIElement*> &children = getChildren();
|
||||||
|
core::list<gui::IGUIElement*> children_copy;
|
||||||
|
for (core::list<gui::IGUIElement*>::ConstIterator i = children.begin(); i
|
||||||
|
!= children.end(); i++)
|
||||||
|
{
|
||||||
|
children_copy.push_back(*i);
|
||||||
|
}
|
||||||
|
for (core::list<gui::IGUIElement*>::Iterator i = children_copy.begin(); i
|
||||||
|
!= children_copy.end(); i++)
|
||||||
|
{
|
||||||
|
(*i)->remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GUIKeyChangeMenu::regenerateGui(v2u32 screensize)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
Remove stuff
|
||||||
|
*/
|
||||||
|
removeChildren();
|
||||||
|
|
||||||
|
/*
|
||||||
|
Calculate new sizes and positions
|
||||||
|
*/
|
||||||
|
|
||||||
|
v2s32 size(620, 430);
|
||||||
|
|
||||||
|
core::rect < s32 > rect(screensize.X / 2 - size.X / 2,
|
||||||
|
screensize.Y / 2 - size.Y / 2, screensize.X / 2 + size.X / 2,
|
||||||
|
screensize.Y / 2 + size.Y / 2);
|
||||||
|
|
||||||
|
DesiredRect = rect;
|
||||||
|
recalculateAbsolutePosition(false);
|
||||||
|
|
||||||
|
v2s32 topleft(0, 0);
|
||||||
|
|
||||||
|
{
|
||||||
|
core::rect < s32 > rect(0, 0, 125, 20);
|
||||||
|
rect += topleft + v2s32(25, 3);
|
||||||
|
const wchar_t *text = L"KEYBINDINGS";
|
||||||
|
//gui::IGUIStaticText *t =
|
||||||
|
Environment->addStaticText(text, rect, false, true, this, -1);
|
||||||
|
//t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
|
||||||
|
}
|
||||||
|
v2s32 offset(25, 40);
|
||||||
|
// buttons
|
||||||
|
|
||||||
|
{
|
||||||
|
core::rect < s32 > rect(0, 0, 100, 20);
|
||||||
|
rect += topleft + v2s32(offset.X, offset.Y);
|
||||||
|
const wchar_t *text = L"Forward";
|
||||||
|
Environment->addStaticText(text, rect, false, true, this, -1);
|
||||||
|
//t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
core::rect < s32 > rect(0, 0, 100, 30);
|
||||||
|
rect += topleft + v2s32(offset.X + 105, offset.Y - 5);
|
||||||
|
this->forward = Environment->addButton(rect, this,
|
||||||
|
GUI_ID_KEY_FORWARD_BUTTON,
|
||||||
|
narrow_to_wide(KeyNames[key_forward]).c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
offset += v2s32(0, 25);
|
||||||
|
{
|
||||||
|
core::rect < s32 > rect(0, 0, 100, 20);
|
||||||
|
rect += topleft + v2s32(offset.X, offset.Y);
|
||||||
|
const wchar_t *text = L"Backward";
|
||||||
|
Environment->addStaticText(text, rect, false, true, this, -1);
|
||||||
|
//t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
core::rect < s32 > rect(0, 0, 100, 30);
|
||||||
|
rect += topleft + v2s32(offset.X + 105, offset.Y - 5);
|
||||||
|
this->backward = Environment->addButton(rect, this,
|
||||||
|
GUI_ID_KEY_BACKWARD_BUTTON,
|
||||||
|
narrow_to_wide(KeyNames[key_backward]).c_str());
|
||||||
|
}
|
||||||
|
offset += v2s32(0, 25);
|
||||||
|
{
|
||||||
|
core::rect < s32 > rect(0, 0, 100, 20);
|
||||||
|
rect += topleft + v2s32(offset.X, offset.Y);
|
||||||
|
const wchar_t *text = L"Left";
|
||||||
|
Environment->addStaticText(text, rect, false, true, this, -1);
|
||||||
|
//t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
core::rect < s32 > rect(0, 0, 100, 30);
|
||||||
|
rect += topleft + v2s32(offset.X + 105, offset.Y - 5);
|
||||||
|
this->left = Environment->addButton(rect, this, GUI_ID_KEY_LEFT_BUTTON,
|
||||||
|
narrow_to_wide(KeyNames[key_left]).c_str());
|
||||||
|
}
|
||||||
|
offset += v2s32(0, 25);
|
||||||
|
{
|
||||||
|
core::rect < s32 > rect(0, 0, 100, 20);
|
||||||
|
rect += topleft + v2s32(offset.X, offset.Y);
|
||||||
|
const wchar_t *text = L"Right";
|
||||||
|
Environment->addStaticText(text, rect, false, true, this, -1);
|
||||||
|
//t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
core::rect < s32 > rect(0, 0, 100, 30);
|
||||||
|
rect += topleft + v2s32(offset.X + 105, offset.Y - 5);
|
||||||
|
this->right = Environment->addButton(rect, this,
|
||||||
|
GUI_ID_KEY_RIGHT_BUTTON,
|
||||||
|
narrow_to_wide(KeyNames[key_right]).c_str());
|
||||||
|
}
|
||||||
|
offset += v2s32(0, 25);
|
||||||
|
{
|
||||||
|
core::rect < s32 > rect(0, 0, 100, 20);
|
||||||
|
rect += topleft + v2s32(offset.X, offset.Y);
|
||||||
|
const wchar_t *text = L"Use";
|
||||||
|
Environment->addStaticText(text, rect, false, true, this, -1);
|
||||||
|
//t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
core::rect < s32 > rect(0, 0, 100, 30);
|
||||||
|
rect += topleft + v2s32(offset.X + 105, offset.Y - 5);
|
||||||
|
this->use = Environment->addButton(rect, this, GUI_ID_KEY_USE_BUTTON,
|
||||||
|
narrow_to_wide(KeyNames[key_use]).c_str());
|
||||||
|
}
|
||||||
|
offset += v2s32(0, 25);
|
||||||
|
{
|
||||||
|
core::rect < s32 > rect(0, 0, 100, 20);
|
||||||
|
rect += topleft + v2s32(offset.X, offset.Y);
|
||||||
|
const wchar_t *text = L"Sneak";
|
||||||
|
Environment->addStaticText(text, rect, false, true, this, -1);
|
||||||
|
//t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
core::rect < s32 > rect(0, 0, 100, 30);
|
||||||
|
rect += topleft + v2s32(offset.X + 105, offset.Y - 5);
|
||||||
|
this->sneak = Environment->addButton(rect, this,
|
||||||
|
GUI_ID_KEY_SNEAK_BUTTON,
|
||||||
|
narrow_to_wide(KeyNames[key_sneak]).c_str());
|
||||||
|
}
|
||||||
|
offset += v2s32(0, 25);
|
||||||
|
{
|
||||||
|
core::rect < s32 > rect(0, 0, 100, 20);
|
||||||
|
rect += topleft + v2s32(offset.X, offset.Y);
|
||||||
|
const wchar_t *text = L"Jump";
|
||||||
|
Environment->addStaticText(text, rect, false, true, this, -1);
|
||||||
|
//t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
core::rect < s32 > rect(0, 0, 100, 30);
|
||||||
|
rect += topleft + v2s32(offset.X + 105, offset.Y - 5);
|
||||||
|
this->jump = Environment->addButton(rect, this, GUI_ID_KEY_JUMP_BUTTON,
|
||||||
|
narrow_to_wide(KeyNames[key_jump]).c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
offset += v2s32(0, 25);
|
||||||
|
{
|
||||||
|
core::rect < s32 > rect(0, 0, 100, 20);
|
||||||
|
rect += topleft + v2s32(offset.X, offset.Y);
|
||||||
|
const wchar_t *text = L"Inventory";
|
||||||
|
Environment->addStaticText(text, rect, false, true, this, -1);
|
||||||
|
//t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
core::rect < s32 > rect(0, 0, 100, 30);
|
||||||
|
rect += topleft + v2s32(offset.X + 105, offset.Y - 5);
|
||||||
|
this->inventory = Environment->addButton(rect, this,
|
||||||
|
GUI_ID_KEY_INVENTORY_BUTTON,
|
||||||
|
narrow_to_wide(KeyNames[key_inventory]).c_str());
|
||||||
|
}
|
||||||
|
offset += v2s32(0, 25);
|
||||||
|
{
|
||||||
|
core::rect < s32 > rect(0, 0, 100, 20);
|
||||||
|
rect += topleft + v2s32(offset.X, offset.Y);
|
||||||
|
const wchar_t *text = L"Chat";
|
||||||
|
Environment->addStaticText(text, rect, false, true, this, -1);
|
||||||
|
//t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
core::rect < s32 > rect(0, 0, 100, 30);
|
||||||
|
rect += topleft + v2s32(offset.X + 105, offset.Y - 5);
|
||||||
|
this->chat = Environment->addButton(rect, this, GUI_ID_KEY_CHAT_BUTTON,
|
||||||
|
narrow_to_wide(KeyNames[key_chat]).c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
//next col
|
||||||
|
offset = v2s32(250, 40);
|
||||||
|
{
|
||||||
|
core::rect < s32 > rect(0, 0, 100, 20);
|
||||||
|
rect += topleft + v2s32(offset.X, offset.Y);
|
||||||
|
const wchar_t *text = L"Toggle fly";
|
||||||
|
Environment->addStaticText(text, rect, false, true, this, -1);
|
||||||
|
//t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
core::rect < s32 > rect(0, 0, 100, 30);
|
||||||
|
rect += topleft + v2s32(offset.X + 105, offset.Y - 5);
|
||||||
|
this->fly = Environment->addButton(rect, this, GUI_ID_KEY_FLY_BUTTON,
|
||||||
|
narrow_to_wide(KeyNames[key_fly]).c_str());
|
||||||
|
}
|
||||||
|
offset += v2s32(0, 25);
|
||||||
|
{
|
||||||
|
core::rect < s32 > rect(0, 0, 100, 20);
|
||||||
|
rect += topleft + v2s32(offset.X, offset.Y);
|
||||||
|
const wchar_t *text = L"Toggle fast";
|
||||||
|
Environment->addStaticText(text, rect, false, true, this, -1);
|
||||||
|
//t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
core::rect < s32 > rect(0, 0, 100, 30);
|
||||||
|
rect += topleft + v2s32(offset.X + 105, offset.Y - 5);
|
||||||
|
this->fast = Environment->addButton(rect, this, GUI_ID_KEY_FAST_BUTTON,
|
||||||
|
narrow_to_wide(KeyNames[key_fast]).c_str());
|
||||||
|
}
|
||||||
|
offset += v2s32(0, 25);
|
||||||
|
{
|
||||||
|
core::rect < s32 > rect(0, 0, 100, 20);
|
||||||
|
rect += topleft + v2s32(offset.X, offset.Y);
|
||||||
|
const wchar_t *text = L"Range select";
|
||||||
|
Environment->addStaticText(text, rect, false, true, this, -1);
|
||||||
|
//t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
core::rect < s32 > rect(0, 0, 100, 30);
|
||||||
|
rect += topleft + v2s32(offset.X + 105, offset.Y - 5);
|
||||||
|
this->range = Environment->addButton(rect, this,
|
||||||
|
GUI_ID_KEY_RANGE_BUTTON,
|
||||||
|
narrow_to_wide(KeyNames[key_range]).c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
offset += v2s32(0, 25);
|
||||||
|
{
|
||||||
|
core::rect < s32 > rect(0, 0, 100, 20);
|
||||||
|
rect += topleft + v2s32(offset.X, offset.Y);
|
||||||
|
const wchar_t *text = L"Print stacks";
|
||||||
|
Environment->addStaticText(text, rect, false, true, this, -1);
|
||||||
|
//t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
core::rect < s32 > rect(0, 0, 100, 30);
|
||||||
|
rect += topleft + v2s32(offset.X + 105, offset.Y - 5);
|
||||||
|
this->dump = Environment->addButton(rect, this, GUI_ID_KEY_DUMP_BUTTON,
|
||||||
|
narrow_to_wide(KeyNames[key_dump]).c_str());
|
||||||
|
}
|
||||||
|
{
|
||||||
|
core::rect < s32 > rect(0, 0, 100, 30);
|
||||||
|
rect += topleft + v2s32(size.X - 100 - 20, size.Y - 40);
|
||||||
|
Environment->addButton(rect, this, GUI_ID_BACK_BUTTON, L"Save");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
core::rect < s32 > rect(0, 0, 100, 30);
|
||||||
|
rect += topleft + v2s32(size.X - 100 - 20 - 100 - 20, size.Y - 40);
|
||||||
|
Environment->addButton(rect, this, GUI_ID_ABORT_BUTTON, L"Cancel");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GUIKeyChangeMenu::drawMenu()
|
||||||
|
{
|
||||||
|
gui::IGUISkin* skin = Environment->getSkin();
|
||||||
|
if (!skin)
|
||||||
|
return;
|
||||||
|
video::IVideoDriver* driver = Environment->getVideoDriver();
|
||||||
|
|
||||||
|
video::SColor bgcolor(140, 0, 0, 0);
|
||||||
|
|
||||||
|
{
|
||||||
|
core::rect < s32 > rect(0, 0, 620, 620);
|
||||||
|
rect += AbsoluteRect.UpperLeftCorner;
|
||||||
|
driver->draw2DRectangle(bgcolor, rect, &AbsoluteClippingRect);
|
||||||
|
}
|
||||||
|
|
||||||
|
gui::IGUIElement::draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GUIKeyChangeMenu::acceptInput()
|
||||||
|
{
|
||||||
|
g_settings.set("keymap_forward", keycode_to_keyname(key_forward));
|
||||||
|
g_settings.set("keymap_backward", keycode_to_keyname(key_backward));
|
||||||
|
g_settings.set("keymap_left", keycode_to_keyname(key_left));
|
||||||
|
g_settings.set("keymap_right", keycode_to_keyname(key_right));
|
||||||
|
g_settings.set("keymap_jump", keycode_to_keyname(key_jump));
|
||||||
|
g_settings.set("keymap_sneak", keycode_to_keyname(key_sneak));
|
||||||
|
g_settings.set("keymap_inventory", keycode_to_keyname(key_inventory));
|
||||||
|
g_settings.set("keymap_chat", keycode_to_keyname(key_chat));
|
||||||
|
g_settings.set("keymap_rangeselect", keycode_to_keyname(key_range));
|
||||||
|
g_settings.set("keymap_freemove", keycode_to_keyname(key_fly));
|
||||||
|
g_settings.set("keymap_fastmove", keycode_to_keyname(key_fast));
|
||||||
|
g_settings.set("keymap_special1", keycode_to_keyname(key_use));
|
||||||
|
g_settings.set("keymap_print_debug_stacks", keycode_to_keyname(key_dump));
|
||||||
|
//clearKeyCache(); Y U NO SCOPE?!
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
void GUIKeyChangeMenu::init_keys()
|
||||||
|
{
|
||||||
|
key_forward = getKeySetting("keymap_forward");
|
||||||
|
key_backward = getKeySetting("keymap_backward");
|
||||||
|
key_left = getKeySetting("keymap_left");
|
||||||
|
key_right = getKeySetting("keymap_right");
|
||||||
|
key_jump = getKeySetting("keymap_jump");
|
||||||
|
key_sneak = getKeySetting("keymap_sneak");
|
||||||
|
key_inventory = getKeySetting("keymap_inventory");
|
||||||
|
key_chat = getKeySetting("keymap_chat");
|
||||||
|
key_range = getKeySetting("keymap_rangeselect");
|
||||||
|
key_fly = getKeySetting("keymap_freemove");
|
||||||
|
key_fast = getKeySetting("keymap_fastmove");
|
||||||
|
key_use = getKeySetting("keymap_special1");
|
||||||
|
key_dump = getKeySetting("keymap_print_debug_stacks");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GUIKeyChangeMenu::resetMenu()
|
||||||
|
{
|
||||||
|
if (activeKey >= 0)
|
||||||
|
{
|
||||||
|
switch (activeKey)
|
||||||
|
{
|
||||||
|
case GUI_ID_KEY_FORWARD_BUTTON:
|
||||||
|
this->forward->setText(
|
||||||
|
narrow_to_wide(KeyNames[key_forward]).c_str());
|
||||||
|
break;
|
||||||
|
case GUI_ID_KEY_BACKWARD_BUTTON:
|
||||||
|
this->backward->setText(
|
||||||
|
narrow_to_wide(KeyNames[key_backward]).c_str());
|
||||||
|
break;
|
||||||
|
case GUI_ID_KEY_LEFT_BUTTON:
|
||||||
|
this->left->setText(narrow_to_wide(KeyNames[key_left]).c_str());
|
||||||
|
break;
|
||||||
|
case GUI_ID_KEY_RIGHT_BUTTON:
|
||||||
|
this->right->setText(narrow_to_wide(KeyNames[key_right]).c_str());
|
||||||
|
break;
|
||||||
|
case GUI_ID_KEY_JUMP_BUTTON:
|
||||||
|
this->jump->setText(narrow_to_wide(KeyNames[key_jump]).c_str());
|
||||||
|
break;
|
||||||
|
case GUI_ID_KEY_SNEAK_BUTTON:
|
||||||
|
this->sneak->setText(narrow_to_wide(KeyNames[key_sneak]).c_str());
|
||||||
|
break;
|
||||||
|
case GUI_ID_KEY_INVENTORY_BUTTON:
|
||||||
|
this->inventory->setText(
|
||||||
|
narrow_to_wide(KeyNames[key_inventory]).c_str());
|
||||||
|
break;
|
||||||
|
case GUI_ID_KEY_CHAT_BUTTON:
|
||||||
|
this->chat->setText(narrow_to_wide(KeyNames[key_chat]).c_str());
|
||||||
|
break;
|
||||||
|
case GUI_ID_KEY_RANGE_BUTTON:
|
||||||
|
this->range->setText(narrow_to_wide(KeyNames[key_range]).c_str());
|
||||||
|
break;
|
||||||
|
case GUI_ID_KEY_FLY_BUTTON:
|
||||||
|
this->fly->setText(narrow_to_wide(KeyNames[key_fly]).c_str());
|
||||||
|
break;
|
||||||
|
case GUI_ID_KEY_FAST_BUTTON:
|
||||||
|
this->fast->setText(narrow_to_wide(KeyNames[key_fast]).c_str());
|
||||||
|
break;
|
||||||
|
case GUI_ID_KEY_USE_BUTTON:
|
||||||
|
this->use->setText(narrow_to_wide(KeyNames[key_use]).c_str());
|
||||||
|
break;
|
||||||
|
case GUI_ID_KEY_DUMP_BUTTON:
|
||||||
|
this->dump->setText(narrow_to_wide(KeyNames[key_dump]).c_str());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
activeKey = -1;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
bool GUIKeyChangeMenu::OnEvent(const SEvent& event)
|
||||||
|
{
|
||||||
|
if (event.EventType == EET_KEY_INPUT_EVENT && activeKey >= 0
|
||||||
|
&& event.KeyInput.PressedDown)
|
||||||
|
{
|
||||||
|
if (activeKey == GUI_ID_KEY_FORWARD_BUTTON)
|
||||||
|
{
|
||||||
|
this->forward->setText(
|
||||||
|
narrow_to_wide(KeyNames[event.KeyInput.Key]).c_str());
|
||||||
|
this->key_forward = event.KeyInput.Key;
|
||||||
|
}
|
||||||
|
else if (activeKey == GUI_ID_KEY_BACKWARD_BUTTON)
|
||||||
|
{
|
||||||
|
this->backward->setText(
|
||||||
|
narrow_to_wide(KeyNames[event.KeyInput.Key]).c_str());
|
||||||
|
this->key_backward = event.KeyInput.Key;
|
||||||
|
}
|
||||||
|
else if (activeKey == GUI_ID_KEY_LEFT_BUTTON)
|
||||||
|
{
|
||||||
|
this->left->setText(
|
||||||
|
narrow_to_wide(KeyNames[event.KeyInput.Key]).c_str());
|
||||||
|
this->key_left = event.KeyInput.Key;
|
||||||
|
}
|
||||||
|
else if (activeKey == GUI_ID_KEY_RIGHT_BUTTON)
|
||||||
|
{
|
||||||
|
this->right->setText(
|
||||||
|
narrow_to_wide(KeyNames[event.KeyInput.Key]).c_str());
|
||||||
|
this->key_right = event.KeyInput.Key;
|
||||||
|
}
|
||||||
|
else if (activeKey == GUI_ID_KEY_JUMP_BUTTON)
|
||||||
|
{
|
||||||
|
this->jump->setText(
|
||||||
|
narrow_to_wide(KeyNames[event.KeyInput.Key]).c_str());
|
||||||
|
this->key_jump = event.KeyInput.Key;
|
||||||
|
}
|
||||||
|
else if (activeKey == GUI_ID_KEY_SNEAK_BUTTON)
|
||||||
|
{
|
||||||
|
this->sneak->setText(
|
||||||
|
narrow_to_wide(KeyNames[event.KeyInput.Key]).c_str());
|
||||||
|
this->key_sneak = event.KeyInput.Key;
|
||||||
|
}
|
||||||
|
else if (activeKey == GUI_ID_KEY_INVENTORY_BUTTON)
|
||||||
|
{
|
||||||
|
this->inventory->setText(
|
||||||
|
narrow_to_wide(KeyNames[event.KeyInput.Key]).c_str());
|
||||||
|
this->key_inventory = event.KeyInput.Key;
|
||||||
|
}
|
||||||
|
else if (activeKey == GUI_ID_KEY_CHAT_BUTTON)
|
||||||
|
{
|
||||||
|
this->chat->setText(
|
||||||
|
narrow_to_wide(KeyNames[event.KeyInput.Key]).c_str());
|
||||||
|
this->key_chat = event.KeyInput.Key;
|
||||||
|
}
|
||||||
|
else if (activeKey == GUI_ID_KEY_RANGE_BUTTON)
|
||||||
|
{
|
||||||
|
this->range->setText(
|
||||||
|
narrow_to_wide(KeyNames[event.KeyInput.Key]).c_str());
|
||||||
|
this->key_range = event.KeyInput.Key;
|
||||||
|
}
|
||||||
|
else if (activeKey == GUI_ID_KEY_FLY_BUTTON)
|
||||||
|
{
|
||||||
|
this->fly->setText(
|
||||||
|
narrow_to_wide(KeyNames[event.KeyInput.Key]).c_str());
|
||||||
|
this->key_fly = event.KeyInput.Key;
|
||||||
|
}
|
||||||
|
else if (activeKey == GUI_ID_KEY_FAST_BUTTON)
|
||||||
|
{
|
||||||
|
this->fast->setText(
|
||||||
|
narrow_to_wide(KeyNames[event.KeyInput.Key]).c_str());
|
||||||
|
this->key_fast = event.KeyInput.Key;
|
||||||
|
}
|
||||||
|
else if (activeKey == GUI_ID_KEY_USE_BUTTON)
|
||||||
|
{
|
||||||
|
this->use->setText(
|
||||||
|
narrow_to_wide(KeyNames[event.KeyInput.Key]).c_str());
|
||||||
|
this->key_use = event.KeyInput.Key;
|
||||||
|
}
|
||||||
|
else if (activeKey == GUI_ID_KEY_DUMP_BUTTON)
|
||||||
|
{
|
||||||
|
this->dump->setText(
|
||||||
|
narrow_to_wide(KeyNames[event.KeyInput.Key]).c_str());
|
||||||
|
this->key_dump = event.KeyInput.Key;
|
||||||
|
}
|
||||||
|
|
||||||
|
activeKey = -1;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (event.EventType == EET_GUI_EVENT)
|
||||||
|
{
|
||||||
|
if (event.GUIEvent.EventType == gui::EGET_ELEMENT_FOCUS_LOST
|
||||||
|
&& isVisible())
|
||||||
|
{
|
||||||
|
if (!canTakeFocus(event.GUIEvent.Element))
|
||||||
|
{
|
||||||
|
dstream << "GUIMainMenu: Not allowing focus change."
|
||||||
|
<< std::endl;
|
||||||
|
// Returning true disables focus change
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (event.GUIEvent.EventType == gui::EGET_BUTTON_CLICKED)
|
||||||
|
{
|
||||||
|
switch (event.GUIEvent.Caller->getID())
|
||||||
|
{
|
||||||
|
case GUI_ID_BACK_BUTTON: //back
|
||||||
|
acceptInput();
|
||||||
|
quitMenu();
|
||||||
|
return true;
|
||||||
|
case GUI_ID_ABORT_BUTTON: //abort
|
||||||
|
quitMenu();
|
||||||
|
return true;
|
||||||
|
case GUI_ID_KEY_FORWARD_BUTTON:
|
||||||
|
resetMenu();
|
||||||
|
activeKey = event.GUIEvent.Caller->getID();
|
||||||
|
this->forward->setText(L"press Key");
|
||||||
|
break;
|
||||||
|
case GUI_ID_KEY_BACKWARD_BUTTON:
|
||||||
|
resetMenu();
|
||||||
|
activeKey = event.GUIEvent.Caller->getID();
|
||||||
|
this->backward->setText(L"press Key");
|
||||||
|
break;
|
||||||
|
case GUI_ID_KEY_LEFT_BUTTON:
|
||||||
|
resetMenu();
|
||||||
|
activeKey = event.GUIEvent.Caller->getID();
|
||||||
|
this->left->setText(L"press Key");
|
||||||
|
break;
|
||||||
|
case GUI_ID_KEY_RIGHT_BUTTON:
|
||||||
|
resetMenu();
|
||||||
|
activeKey = event.GUIEvent.Caller->getID();
|
||||||
|
this->right->setText(L"press Key");
|
||||||
|
break;
|
||||||
|
case GUI_ID_KEY_USE_BUTTON:
|
||||||
|
resetMenu();
|
||||||
|
activeKey = event.GUIEvent.Caller->getID();
|
||||||
|
this->use->setText(L"press Key");
|
||||||
|
break;
|
||||||
|
case GUI_ID_KEY_FLY_BUTTON:
|
||||||
|
resetMenu();
|
||||||
|
activeKey = event.GUIEvent.Caller->getID();
|
||||||
|
this->fly->setText(L"press Key");
|
||||||
|
break;
|
||||||
|
case GUI_ID_KEY_FAST_BUTTON:
|
||||||
|
resetMenu();
|
||||||
|
activeKey = event.GUIEvent.Caller->getID();
|
||||||
|
this->fast->setText(L"press Key");
|
||||||
|
break;
|
||||||
|
case GUI_ID_KEY_JUMP_BUTTON:
|
||||||
|
resetMenu();
|
||||||
|
activeKey = event.GUIEvent.Caller->getID();
|
||||||
|
this->jump->setText(L"press Key");
|
||||||
|
break;
|
||||||
|
case GUI_ID_KEY_CHAT_BUTTON:
|
||||||
|
resetMenu();
|
||||||
|
activeKey = event.GUIEvent.Caller->getID();
|
||||||
|
this->chat->setText(L"press Key");
|
||||||
|
break;
|
||||||
|
case GUI_ID_KEY_SNEAK_BUTTON:
|
||||||
|
resetMenu();
|
||||||
|
activeKey = event.GUIEvent.Caller->getID();
|
||||||
|
this->sneak->setText(L"press Key");
|
||||||
|
break;
|
||||||
|
case GUI_ID_KEY_INVENTORY_BUTTON:
|
||||||
|
resetMenu();
|
||||||
|
activeKey = event.GUIEvent.Caller->getID();
|
||||||
|
this->inventory->setText(L"press Key");
|
||||||
|
break;
|
||||||
|
case GUI_ID_KEY_DUMP_BUTTON:
|
||||||
|
resetMenu();
|
||||||
|
activeKey = event.GUIEvent.Caller->getID();
|
||||||
|
this->dump->setText(L"press Key");
|
||||||
|
break;
|
||||||
|
case GUI_ID_KEY_RANGE_BUTTON:
|
||||||
|
resetMenu();
|
||||||
|
activeKey = event.GUIEvent.Caller->getID();
|
||||||
|
this->range->setText(L"press Key");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//Buttons
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Parent ? Parent->OnEvent(event) : false;
|
||||||
|
}
|
||||||
|
|
133
src/guiKeyChangeMenu.h
Normal file
133
src/guiKeyChangeMenu.h
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
/*
|
||||||
|
Minetest-delta
|
||||||
|
Copyright (C) 2010-11 celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||||
|
Copyright (C) 2011 Ciaran Gultnieks <ciaran@ciarang.com>
|
||||||
|
Copyright (C) 2011 teddydestodes <derkomtur@schattengang.net>
|
||||||
|
|
||||||
|
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
|
||||||
|
(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, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef GUIKEYCHANGEMENU_HEADER
|
||||||
|
#define GUIKEYCHANGEMENU_HEADER
|
||||||
|
|
||||||
|
#include "common_irrlicht.h"
|
||||||
|
#include "utility.h"
|
||||||
|
#include "modalMenu.h"
|
||||||
|
#include "client.h"
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
static const char *KeyNames[] =
|
||||||
|
{ "-", "Left Button", "Right Button", "Cancel", "Middle Button", "X Button 1",
|
||||||
|
"X Button 2", "-", "Back", "Tab", "-", "-", "Clear", "Return", "-",
|
||||||
|
"-", "Shift", "Control", "Menu", "Pause", "Capital", "Kana", "-",
|
||||||
|
"Junja", "Final", "Kanji", "-", "Escape", "Convert", "Nonconvert",
|
||||||
|
"Accept", "Mode Change", "Space", "Priot", "Next", "End", "Home",
|
||||||
|
"Left", "Up", "Right", "Down", "Select", "Print", "Execute",
|
||||||
|
"Snapshot", "Insert", "Delete", "Help", "0", "1", "2", "3", "4", "5",
|
||||||
|
"6", "7", "8", "9", "-", "-", "-", "-", "-", "-", "-", "A", "B", "C",
|
||||||
|
"D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q",
|
||||||
|
"R", "S", "T", "U", "V", "W", "X", "Y", "Z", "Left Windows",
|
||||||
|
"Right Windows", "Apps", "-", "Sleep", "Numpad 0", "Numpad 1",
|
||||||
|
"Numpad 2", "Numpad 3", "Numpad 4", "Numpad 5", "Numpad 6", "Numpad 7",
|
||||||
|
"Numpad 8", "Numpad 9", "Numpad *", "Numpad +", "Numpad /", "Numpad -",
|
||||||
|
"Numpad .", "Numpad /", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8",
|
||||||
|
"F9", "F10", "F11", "F12", "F13", "F14", "F15", "F16", "F17", "F18",
|
||||||
|
"F19", "F20", "F21", "F22", "F23", "F24", "-", "-", "-", "-", "-", "-",
|
||||||
|
"-", "-", "Num Lock", "Scroll Lock", "-", "-", "-", "-", "-", "-", "-",
|
||||||
|
"-", "-", "-", "-", "-", "-", "-", "Left Shift", "Right Shight",
|
||||||
|
"Left Control", "Right Control", "Left Menu", "Right Menu", "-", "-",
|
||||||
|
"-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-",
|
||||||
|
"-", "-", "-", "-", "-", "Plus", "Comma", "Minus", "Period", "-", "-",
|
||||||
|
"-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-",
|
||||||
|
"-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-",
|
||||||
|
"-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-",
|
||||||
|
"-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "Attn", "CrSel",
|
||||||
|
"ExSel", "Erase OEF", "Play", "Zoom", "PA1", "OEM Clear", "-" };
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
GUI_ID_BACK_BUTTON = 101, GUI_ID_ABORT_BUTTON, GUI_ID_SCROLL_BAR,
|
||||||
|
//buttons
|
||||||
|
GUI_ID_KEY_FORWARD_BUTTON,
|
||||||
|
GUI_ID_KEY_BACKWARD_BUTTON,
|
||||||
|
GUI_ID_KEY_LEFT_BUTTON,
|
||||||
|
GUI_ID_KEY_RIGHT_BUTTON,
|
||||||
|
GUI_ID_KEY_USE_BUTTON,
|
||||||
|
GUI_ID_KEY_FLY_BUTTON,
|
||||||
|
GUI_ID_KEY_FAST_BUTTON,
|
||||||
|
GUI_ID_KEY_JUMP_BUTTON,
|
||||||
|
GUI_ID_KEY_CHAT_BUTTON,
|
||||||
|
GUI_ID_KEY_SNEAK_BUTTON,
|
||||||
|
GUI_ID_KEY_INVENTORY_BUTTON,
|
||||||
|
GUI_ID_KEY_DUMP_BUTTON,
|
||||||
|
GUI_ID_KEY_RANGE_BUTTON
|
||||||
|
};
|
||||||
|
|
||||||
|
class GUIKeyChangeMenu: public GUIModalMenu
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GUIKeyChangeMenu(gui::IGUIEnvironment* env, gui::IGUIElement* parent,
|
||||||
|
s32 id, IMenuManager *menumgr);
|
||||||
|
~GUIKeyChangeMenu();
|
||||||
|
|
||||||
|
void removeChildren();
|
||||||
|
/*
|
||||||
|
Remove and re-add (or reposition) stuff
|
||||||
|
*/
|
||||||
|
void regenerateGui(v2u32 screensize);
|
||||||
|
|
||||||
|
void drawMenu();
|
||||||
|
|
||||||
|
bool acceptInput();
|
||||||
|
|
||||||
|
bool OnEvent(const SEvent& event);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
void init_keys();
|
||||||
|
|
||||||
|
bool resetMenu();
|
||||||
|
|
||||||
|
gui::IGUIButton *forward;
|
||||||
|
gui::IGUIButton *backward;
|
||||||
|
gui::IGUIButton *left;
|
||||||
|
gui::IGUIButton *right;
|
||||||
|
gui::IGUIButton *use;
|
||||||
|
gui::IGUIButton *sneak;
|
||||||
|
gui::IGUIButton *jump;
|
||||||
|
gui::IGUIButton *inventory;
|
||||||
|
gui::IGUIButton *fly;
|
||||||
|
gui::IGUIButton *fast;
|
||||||
|
gui::IGUIButton *range;
|
||||||
|
gui::IGUIButton *dump;
|
||||||
|
gui::IGUIButton *chat;
|
||||||
|
|
||||||
|
u32 activeKey;
|
||||||
|
u32 key_forward;
|
||||||
|
u32 key_backward;
|
||||||
|
u32 key_left;
|
||||||
|
u32 key_right;
|
||||||
|
u32 key_use;
|
||||||
|
u32 key_sneak;
|
||||||
|
u32 key_jump;
|
||||||
|
u32 key_inventory;
|
||||||
|
u32 key_fly;
|
||||||
|
u32 key_fast;
|
||||||
|
u32 key_range;
|
||||||
|
u32 key_chat;
|
||||||
|
u32 key_dump;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue
Block a user