aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2010-12-14 03:07:13 +0200
committerPerttu Ahola <celeron55@gmail.com>2010-12-14 03:07:13 +0200
commit451f46f623f7e7e957cbf9d973ec2dceb74a56dc (patch)
treec77798c72d2caf0d374335522e1cdacb3f275e1b
parentc951ce3b7cd80b27f09c02e71e63e1ba57b8c0dd (diff)
downloadminetest-451f46f623f7e7e957cbf9d973ec2dceb74a56dc.tar.gz
minetest-451f46f623f7e7e957cbf9d973ec2dceb74a56dc.tar.bz2
minetest-451f46f623f7e7e957cbf9d973ec2dceb74a56dc.zip
pause menu added
-rw-r--r--Makefile2
-rw-r--r--src/main.cpp28
2 files changed, 19 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index 2bdc9c3f0..dfe180573 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@
# It's usually sufficient to change just the target name and source file list
# and be sure that CXX is set to a valid compiler
TARGET = test
-SOURCE_FILES = mapnode.cpp tile.cpp voxel.cpp mapblockobject.cpp inventory.cpp debug.cpp serialization.cpp light.cpp filesys.cpp connection.cpp environment.cpp client.cpp server.cpp socket.cpp mapblock.cpp mapsector.cpp heightmap.cpp map.cpp player.cpp utility.cpp main.cpp test.cpp
+SOURCE_FILES = guiPauseMenu.cpp mapnode.cpp tile.cpp voxel.cpp mapblockobject.cpp inventory.cpp debug.cpp serialization.cpp light.cpp filesys.cpp connection.cpp environment.cpp client.cpp server.cpp socket.cpp mapblock.cpp mapsector.cpp heightmap.cpp map.cpp player.cpp utility.cpp main.cpp test.cpp
SOURCES = $(addprefix src/, $(SOURCE_FILES))
OBJECTS = $(SOURCES:.cpp=.o)
FASTTARGET = fasttest
diff --git a/src/main.cpp b/src/main.cpp
index 8420ca9e0..31901ae70 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -236,6 +236,7 @@ Doing now:
#include <fstream>
#include <time.h>
#include <jmutexautolock.h>
+#include <locale.h>
#include "common_irrlicht.h"
#include "debug.h"
#include "map.h"
@@ -249,7 +250,7 @@ Doing now:
#include "constants.h"
#include "strfnd.h"
#include "porting.h"
-#include <locale.h>
+#include "guiPauseMenu.h"
IrrlichtDevice *g_device = NULL;
@@ -431,6 +432,7 @@ public:
if(event.KeyInput.Key == irr::KEY_ESCAPE)
{
+ //TODO: Not used anymore?
if(g_game_focused == true)
{
dstream<<DTIME<<"ESC pressed"<<std::endl;
@@ -1259,6 +1261,9 @@ int main(int argc, char *argv[])
//driver->setMinHardwareBufferVertexCount(1);
scene::ISceneManager* smgr = device->getSceneManager();
+
+ // Pause menu
+ guiPauseMenu pauseMenu(device, &receiver);
gui::IGUIEnvironment* guienv = device->getGUIEnvironment();
gui::IGUISkin* skin = guienv->getSkin();
@@ -1543,6 +1548,12 @@ int main(int argc, char *argv[])
while(device->run())
{
+ /*
+ Random calculations
+ */
+ v2u32 screensize = driver->getScreenSize();
+ core::vector2d<s32> displaycenter(screensize.X/2,screensize.Y/2);
+
// Hilight boxes collected during the loop and displayed
core::list< core::aabbox3d<f32> > hilightboxes;
@@ -1695,10 +1706,10 @@ int main(int argc, char *argv[])
/*
Special keys
*/
- if(g_esc_pressed)
+ /*if(g_esc_pressed)
{
break;
- }
+ }*/
/*
Player speed control
@@ -1758,7 +1769,7 @@ int main(int argc, char *argv[])
Mouse and camera control
*/
- if(device->isWindowActive() && g_game_focused)
+ if(device->isWindowActive() && g_game_focused && !pauseMenu.isVisible())
{
device->getCursorControl()->setVisible(false);
@@ -1767,15 +1778,15 @@ int main(int argc, char *argv[])
first_loop_after_window_activation = false;
}
else{
- s32 dx = g_input->getMousePos().X - 320;
- s32 dy = g_input->getMousePos().Y - 240;
+ s32 dx = g_input->getMousePos().X - displaycenter.X;
+ s32 dy = g_input->getMousePos().Y - displaycenter.Y;
//std::cout<<"window active, pos difference "<<dx<<","<<dy<<std::endl;
camera_yaw -= dx*0.2;
camera_pitch += dy*0.2;
if(camera_pitch < -89.5) camera_pitch = -89.5;
if(camera_pitch > 89.5) camera_pitch = 89.5;
}
- g_input->setMousePos(320, 240);
+ g_input->setMousePos(displaycenter.X, displaycenter.Y);
}
else{
device->getCursorControl()->setVisible(true);
@@ -2076,9 +2087,6 @@ int main(int argc, char *argv[])
Calculate stuff for drawing
*/
- v2u32 screensize = driver->getScreenSize();
- core::vector2d<s32> displaycenter(screensize.X/2,screensize.Y/2);
-
camera->setAspectRatio((f32)screensize.X / (f32)screensize.Y);
/*