summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorLoïc Blot <nerzhul@users.noreply.github.com>2017-05-13 11:05:16 +0200
committerGitHub <noreply@github.com>2017-05-13 11:05:16 +0200
commit9b8ca3a746cdb9478a46939d36c30484a97255e1 (patch)
treec754605c7c955440a1d66d413a80f994d6b83006 /src/game.cpp
parent5cb7f6a9b7268ee6bfa5eae4f8af9613403f9965 (diff)
downloadminetest-9b8ca3a746cdb9478a46939d36c30484a97255e1.tar.gz
minetest-9b8ca3a746cdb9478a46939d36c30484a97255e1.tar.bz2
minetest-9b8ca3a746cdb9478a46939d36c30484a97255e1.zip
Move KeyList & InputHandler from game.h to client/inputhandler.h (#5752)
* Move KeyList & InputHandler from game.h to client/inputhandler.h We have a header for inputs, move inputhandler class & related keylist object to it Also introduce a cpp file for MyEventReceiver::OnEvent function in inputhandler.h because a so huge function doesn't needs to be inlined * Pass clang-format on inputhandler.{cpp,h} (compatible)
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp25
1 files changed, 7 insertions, 18 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 2b7d50eb5..ab8eb5c70 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -22,6 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <iomanip>
#include "camera.h"
#include "client.h"
+#include "client/inputhandler.h"
#include "client/tile.h" // For TextureSource
#include "client/keys.h"
#include "client/joystick_controller.h"
@@ -50,7 +51,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "quicktune_shortcutter.h"
#include "server.h"
#include "settings.h"
-#include "shader.h" // For ShaderSource
#include "sky.h"
#include "subgame.h"
#include "tool.h"
@@ -59,20 +59,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "util/pointedthing.h"
#include "irrlicht_changes/static_text.h"
#include "version.h"
-#include "minimap.h"
-#include "mapblock_mesh.h"
#include "script/scripting_client.h"
-#include "sound.h"
-
#if USE_SOUND
#include "sound_openal.h"
#endif
-#ifdef HAVE_TOUCHSCREENGUI
- #include "touchscreengui.h"
-#endif
-
extern Settings *g_settings;
extern Profiler *g_profiler;
@@ -2434,7 +2426,7 @@ void Game::updateStats(RunStats *stats, const FpsControl &draw_times,
void Game::processUserInput(f32 dtime)
{
// Reset input if window not active or some menu is active
- if (!device->isWindowActive() || !noMenuActive() || guienv->hasFocus(gui_chat_console)) {
+ if (!device->isWindowActive() || isMenuActive() || guienv->hasFocus(gui_chat_console)) {
input->clear();
#ifdef HAVE_TOUCHSCREENGUI
g_touchscreengui->hide();
@@ -2964,7 +2956,7 @@ void Game::toggleFullViewRange()
void Game::updateCameraDirection(CameraOrientation *cam, float dtime)
{
- if ((device->isWindowActive() && noMenuActive()) || random_input) {
+ if ((device->isWindowActive() && !isMenuActive()) || random_input) {
#ifndef __ANDROID__
if (!random_input) {
@@ -3709,12 +3701,9 @@ PointedThing Game::updatePointedThing(
float sin_r = 0.08 * sin(timerf);
float sin_g = 0.08 * sin(timerf + irr::core::PI * 0.5);
float sin_b = 0.08 * sin(timerf + irr::core::PI);
- c.setRed(
- core::clamp(core::round32(c.getRed() * (0.8 + sin_r)), 0, 255));
- c.setGreen(
- core::clamp(core::round32(c.getGreen() * (0.8 + sin_g)), 0, 255));
- c.setBlue(
- core::clamp(core::round32(c.getBlue() * (0.8 + sin_b)), 0, 255));
+ c.setRed(core::clamp(core::round32(c.getRed() * (0.8 + sin_r)), 0, 255));
+ c.setGreen(core::clamp(core::round32(c.getGreen() * (0.8 + sin_g)), 0, 255));
+ c.setBlue(core::clamp(core::round32(c.getBlue() * (0.8 + sin_b)), 0, 255));
// Set mesh final color
hud->setSelectionMeshColor(c);
@@ -4183,7 +4172,7 @@ void Game::updateFrame(ProfilerGraph *graph, RunStats *stats, f32 dtime,
if (current_formspec->getReferenceCount() == 1) {
current_formspec->drop();
current_formspec = NULL;
- } else if (!noMenuActive()) {
+ } else if (isMenuActive()) {
guiroot->bringToFront(current_formspec);
}
}