PreloadState::PreloadState(Environment &env, ChunkLoader &loader)
: env(env)
, loader(loader)
-, font(env.assets.LoadFont("DejaVuSans", 24))
-, progress(font)
+, progress(env.assets.large_ui_font)
, total(loader.ToLoad())
, per_update(64) {
progress.Position(glm::vec3(0.0f), Gravity::CENTER);
UnloadState::UnloadState(Environment &env, ChunkLoader &loader)
: env(env)
, loader(loader)
-, font(env.assets.LoadFont("DejaVuSans", 24))
-, progress(font)
+, progress(env.assets.large_ui_font)
, cur(loader.Loaded().begin())
, end(loader.Loaded().end())
, done(0)
Assets::Assets(const string &base)
: fonts(base + "fonts/")
, sounds(base + "sounds/")
-, textures(base + "textures/") {
+, textures(base + "textures/")
+, large_ui_font(LoadFont("DejaVuSans", 24))
+, small_ui_font(LoadFont("DejaVuSans", 16)) {
}
#include "../app/FPSController.hpp"
#include "../app/IntervalTimer.hpp"
#include "../audio/Sound.hpp"
-#include "../graphics/Font.hpp"
#include "../model/geometry.hpp"
#include "../model/OutlineModel.hpp"
#include "../world/Block.hpp"
#include <string>
#include <glm/glm.hpp>
+#include <SDL.h>
namespace blank {
Environment &env;
World &world;
FPSController ctrl;
- Font font;
HUD hud;
Ray aim;
: env(env)
, world(world)
, ctrl(world.Player())
-, font(env.assets.LoadFont("DejaVuSans", 16))
-, hud(world.BlockTypes(), font)
+, hud(world.BlockTypes(), env.assets.small_ui_font)
, aim{{ 0, 0, 0 }, { 0, 0, -1 }}
, aim_chunk(nullptr)
, aim_block(0)
, outline()
, outline_transform(1.0f)
, counter_text()
-, messages(font)
+, messages(env.assets.small_ui_font)
, msg_timer(5000)
, config(config)
, place_timer(256)
counter_text.Foreground(glm::vec4(1.0f));
counter_text.Background(glm::vec4(0.5f));
position_text.Hide();
- position_text.Position(glm::vec3(-25.0f, 25.0f + font.LineSkip(), 0.0f), Gravity::NORTH_EAST);
+ position_text.Position(glm::vec3(-25.0f, 25.0f + env.assets.small_ui_font.LineSkip(), 0.0f), Gravity::NORTH_EAST);
position_text.Foreground(glm::vec4(1.0f));
position_text.Background(glm::vec4(0.5f));
messages.Position(glm::vec3(25.0f, -25.0f, 0.0f), Gravity::SOUTH_WEST);
"avg: " << env.counter.Average().running << "ms, "
"peak: " << env.counter.Peak().running << "ms";
std::string text = s.str();
- counter_text.Set(font, text);
+ counter_text.Set(env.assets.small_ui_font, text);
}
void Interface::UpdatePosition() {
std::stringstream s;
s << std::setprecision(3) << "pos: " << ctrl.Controlled().AbsolutePosition();
- position_text.Set(font, s.str());
+ position_text.Set(env.assets.small_ui_font, s.str());
}