]> git.tdb.fi Git - libs/gltk.git/blob - source/resources.h
Adjust things to conform to changes in other libraries
[libs/gltk.git] / source / resources.h
1 #ifndef MSP_GLTK_RESOURCES_H_
2 #define MSP_GLTK_RESOURCES_H_
3
4 #include <msp/gl/font.h>
5 #include <msp/gl/module.h>
6 #include <msp/gl/program.h>
7 #include <msp/gl/sampler.h>
8 #include <msp/gl/texture.h>
9 #include <msp/datafile/collection.h>
10 #include <msp/datafile/directorysource.h>
11 #include <msp/fs/path.h>
12 #include "graphic.h"
13 #include "style.h"
14
15 namespace Msp {
16 namespace GLtk {
17
18 /**
19 Stores resources such as styles and graphics.  All widgets require a Resources
20 instance in constructor.
21 */
22 class Resources: public DataFile::Collection
23 {
24 public:
25         class Loader: public Collection::Loader
26         {
27         private:
28                 Resources &res;
29
30         public:
31                 Loader(Resources &);
32         private:
33                 void default_font(const std::string &);
34                 void font(const std::string &);
35         };
36
37 private:
38         FS::Path path;
39         GL::Font *default_font;
40         DataFile::DirectorySource *dir_src;
41
42 public:
43         Resources();
44         Resources(const FS::Path &);
45 private:
46         void init();
47 public:
48         ~Resources();
49
50         const GL::Font &get_default_font() const;
51         const GL::Sampler &get_default_sampler() const;
52
53 private:
54         GL::Module *create_module(const std::string &);
55         GL::Program *create_program(const std::string &);
56         GL::Sampler *create_sampler(const std::string &);
57         GL::Texture2D *create_texture(const std::string &);
58 };
59
60 } // namespace GLtk
61 } // namespace Msp
62
63 #endif