]> git.localhorst.tv Git - blobs.git/blobdiff - src/app/app.cpp
basic info box
[blobs.git] / src / app / app.cpp
index ccccd9a6c15c5b2590e8a27b0274c74541c1451e..0ec22b02c16607d189cda86107140d14ccde643f 100644 (file)
@@ -173,8 +173,14 @@ void State::OnQuit() {
 Assets::Assets()
 : path("assets/")
 , data_path(path + "data/")
+, font_path(path + "fonts/")
 , skin_path(path + "skins/")
-, tile_path(path + "tiles/") {
+, tile_path(path + "tiles/")
+, fonts{
+       graphics::Font(font_path + "DejaVuSans.ttf", 32),
+       graphics::Font(font_path + "DejaVuSans.ttf", 24),
+       graphics::Font(font_path + "DejaVuSans.ttf", 16)
+} {
        {
                std::ifstream resource_file(data_path + "resources");
                io::TokenStreamReader resource_reader(resource_file);
@@ -187,6 +193,7 @@ Assets::Assets()
                ReadTileTypes(tile_reader);
        }
 
+
        graphics::Format format;
        textures.tiles.Bind();
        textures.tiles.Reserve(256, 256, 14, format);
@@ -242,6 +249,19 @@ void Assets::ReadResources(io::TokenStreamReader &in) {
                        in.Skip(io::Token::EQUALS);
                        if (name == "label") {
                                in.ReadString(data.resources[id].label);
+                       } else if (name == "state") {
+                               in.ReadIdentifier(name);
+                               if (name == "solid") {
+                                       data.resources[id].state = world::Resource::SOLID;
+                               } else if (name == "liquid") {
+                                       data.resources[id].state = world::Resource::LIQUID;
+                               } else if (name == "gas") {
+                                       data.resources[id].state = world::Resource::GAS;
+                               } else if (name == "plasma") {
+                                       data.resources[id].state = world::Resource::PLASMA;
+                               } else {
+                                       throw std::runtime_error("unknown resource state '" + name + "'");
+                               }
                        } else {
                                throw std::runtime_error("unknown resource property '" + name + "'");
                        }