mirror of
https://github.com/minetest/minetest.git
synced 2024-11-30 03:23:45 +01:00
pause menu added
This commit is contained in:
parent
c951ce3b7c
commit
451f46f623
2
Makefile
2
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
|
||||
|
28
src/main.cpp
28
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;
|
||||
@ -1260,6 +1262,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
scene::ISceneManager* smgr = device->getSceneManager();
|
||||
|
||||
// Pause menu
|
||||
guiPauseMenu pauseMenu(device, &receiver);
|
||||
|
||||
gui::IGUIEnvironment* guienv = device->getGUIEnvironment();
|
||||
gui::IGUISkin* skin = guienv->getSkin();
|
||||
gui::IGUIFont* font = guienv->getFont("../data/fontlucida.png");
|
||||
@ -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);
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user