, chunk_renderer(player.GetChunks())
, spawner(world, res.models, env.rng)
, sky(env.loader.LoadCubeMap("skybox"))
+, cli(world)
, preload(env, chunk_loader, chunk_renderer)
, unload(env, world.Chunks(), save)
, chat(env, *this, *this) {
case SDL_KEYDOWN:
// TODO: move to interface
if (event.key.keysym.sym == SDLK_RETURN) {
+ chat.Clear();
+ env.state.Push(&chat);
+ hud.KeepMessages(true);
+ } else if (event.key.keysym.sym == SDLK_SLASH) {
+ chat.Preset("/");
env.state.Push(&chat);
hud.KeepMessages(true);
} else {
}
void MasterState::Update(int dt) {
- input.Update(dt);
+ spawner.Update(dt);
+ world.Update(dt);
if (input.BlockFocus()) {
hud.FocusBlock(input.BlockFocus().GetChunk(), input.BlockFocus().block);
} else if (input.EntityFocus()) {
}
hud.Display(res.block_types[player.GetInventorySlot() + 1]);
hud.Update(dt);
- spawner.Update(dt);
- world.Update(dt);
chunk_loader.Update(dt);
chunk_renderer.Update(dt);
}
void MasterState::OnLineSubmit(const std::string &line) {
- if (!line.empty()) {
+ if (line.empty()) {
+ return;
+ }
+ if (line[0] == '/' && line.size() > 1 && line[1] != '/') {
+ cli.Execute(player, line.substr(1));
+ } else {
hud.PostMessage(line);
}
}