X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fstandalone%2FMasterState.cpp;h=68e49a966fc607e07e84f6d65c17d2e62eb84da6;hb=04531ab5fc3d82ba5b5d456bcc277fe6499e1150;hp=ced107d1a85573c2462defb16c48e7d2eaf47aba;hpb=9240fdf2e68ee014da0d0a89a7fb2f29ebf28e2d;p=blank.git diff --git a/src/standalone/MasterState.cpp b/src/standalone/MasterState.cpp index ced107d..68e49a9 100644 --- a/src/standalone/MasterState.cpp +++ b/src/standalone/MasterState.cpp @@ -26,6 +26,7 @@ MasterState::MasterState( , world(block_types, wc) , spawn_index(world.Chunks().MakeIndex(wc.spawn, 3)) , player(*world.AddPlayer(config.player.name)) +, spawn_player(false) , hud(env, config, player) , manip(env, player.GetEntity()) , input(world, player, manip) @@ -49,7 +50,7 @@ MasterState::MasterState( if (save.Exists(player)) { save.Read(player); } else { - // TODO: spawn + spawn_player = true; } } @@ -58,9 +59,21 @@ MasterState::~MasterState() { } -void MasterState::OnEnter() { - env.state.Push(&preload); - env.window.GrabMouse(); +void MasterState::OnResume() { + if (spawn_index.MissingChunks() > 0) { + env.state.Push(&preload); + } + if (config.input.mouse) { + env.window.GrabMouse(); + } + if (spawn_player) { + // TODO: spawn + spawn_player = false; + } +} + +void MasterState::OnPause() { + env.window.ReleaseMouse(); }