Simulant  21.12-1197
A portable game engine for Windows, OSX, Linux, Dreamcast, and PSP
fnt_loader.h
1 #pragma once
2 
3 #include "../loader.h"
4 
5 namespace smlt {
6 namespace loaders {
7 
8 class FNTLoader : public Loader {
9 public:
10  FNTLoader(const Path& filename, std::shared_ptr<std::istream> data):
11  Loader(filename, data) {}
12 
13  void into(Loadable& resource, const LoaderOptions& options = LoaderOptions());
14 
15 private:
16  void read_binary(Font* font, std::istream& data, const LoaderOptions &options);
17  void read_text(Font* font, std::istream& data, const LoaderOptions &options);
18 
19  void prepare_texture(Font* font, const std::string& texture_file);
20 };
21 
22 class FNTLoaderType : public LoaderType {
23 public:
24  const char* name() override { return "fnt_font"; }
25  bool supports(const Path& filename) const override {
26  return filename.ext() == ".fnt";
27  }
28 
29  Loader::ptr loader_for(const Path& filename, std::shared_ptr<std::istream> data) const override {
30  return Loader::ptr(new FNTLoader(filename, data));
31  }
32 };
33 
34 }
35 }
smlt::Font
Definition: font.h:74
smlt::loaders::FNTLoaderType
Definition: fnt_loader.h:22
smlt
Definition: animation.cpp:25
smlt::LoaderType
Definition: loader.h:111
smlt::Loader
Definition: loader.h:66
smlt::loaders::FNTLoader
Definition: fnt_loader.h:8
smlt::Path
Definition: path.h:7
smlt::Loadable
Definition: loadable.h:26