F1 hud toggle + old worlds load fix
This commit is contained in:
parent
d75d75eeb8
commit
3e98526a24
@ -426,7 +426,7 @@ bool WorldFiles::readOldWorldInfo(World* world) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
bool WorldFiles::readOldPlayer(Player* player) {
|
||||
size_t length = 0;
|
||||
@ -471,7 +471,7 @@ bool WorldFiles::readWorldInfo(World* world) {
|
||||
// TODO: remove in v0.16
|
||||
file = getOldWorldFile();
|
||||
if (fs::is_regular_file(file)) {
|
||||
readOldWorldInfo(world);
|
||||
return readOldWorldInfo(world);
|
||||
}
|
||||
std::cerr << "warning: world.json does not exists" << std::endl;
|
||||
return false;
|
||||
|
||||
@ -125,6 +125,9 @@ void LevelScreen::updateHotkeys() {
|
||||
if (Events::jpressed(keycode::O)) {
|
||||
settings.graphics.frustumCulling = !settings.graphics.frustumCulling;
|
||||
}
|
||||
if (Events::jpressed(keycode::F1)) {
|
||||
hudVisible = !hudVisible;
|
||||
}
|
||||
if (Events::jpressed(keycode::F3)) {
|
||||
level->player->debug = !level->player->debug;
|
||||
}
|
||||
@ -172,7 +175,8 @@ void LevelScreen::update(float delta) {
|
||||
level->world->updateTimers(delta);
|
||||
}
|
||||
controller->update(delta, !inputLocked, hud->isPause());
|
||||
hud->update();
|
||||
if (hudVisible)
|
||||
hud->update();
|
||||
}
|
||||
|
||||
void LevelScreen::draw(float delta) {
|
||||
@ -182,8 +186,11 @@ void LevelScreen::draw(float delta) {
|
||||
GfxContext ctx(nullptr, viewport, nullptr);
|
||||
|
||||
worldRenderer->draw(ctx, camera);
|
||||
hud->draw(ctx);
|
||||
if (level->player->debug) {
|
||||
hud->drawDebug(1 / delta);
|
||||
|
||||
if (hudVisible) {
|
||||
hud->draw(ctx);
|
||||
if (level->player->debug) {
|
||||
hud->drawDebug(1 / delta);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,6 +42,7 @@ class LevelScreen : public Screen {
|
||||
WorldRenderer* worldRenderer;
|
||||
HudRenderer* hud;
|
||||
ContentGfxCache* cache;
|
||||
bool hudVisible = true;
|
||||
void updateHotkeys();
|
||||
public:
|
||||
LevelScreen(Engine* engine, Level* level);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user