]> git.tdb.fi Git - libs/demoscene.git/commitdiff
Make the default constructor of Resources protected
authorMikko Rasa <tdb@tdb.fi>
Fri, 21 Jun 2019 14:48:32 +0000 (17:48 +0300)
committerMikko Rasa <tdb@tdb.fi>
Fri, 21 Jun 2019 14:48:32 +0000 (17:48 +0300)
... instead of private.  This enables derived classes to call the default
constructor and then add their own types before initializing the sources.

source/resources.cpp
source/resources.h

index f44d8c1985d05ef1e45c3651bcaa0a8b77cb4d1f..c70e0a11308aee38929e053983bfa285ab51c04c 100644 (file)
@@ -12,16 +12,17 @@ void init_data(DataFile::BuiltinSource &);
 
 Resources::Resources()
 {
-       add_source(get_builtin_source());
+       init();
 }
 
-Resources::Resources(const string &pack_name):
-       ui_font(0),
-       ui_text_technique(0)
+Resources::Resources(const string &pack_name)
 {
-       set_default_texture_anisotropy(8);
-       set_srgb_conversion(true);
+       init();
+       init_sources(pack_name);
+}
 
+void Resources::init_sources(const string &pack_name)
+{
        FS::Path data_dir = "data";
        if(FS::exists(data_dir))
        {
@@ -35,6 +36,15 @@ Resources::Resources(const string &pack_name):
                pack_source.add_pack_file(pack_name);
                add_source(pack_source);
        }
+}
+
+void Resources::init()
+{
+       ui_font = 0;
+       ui_text_technique = 0;
+
+       set_default_texture_anisotropy(8);
+       set_srgb_conversion(true);
 
        add_source(get_builtin_source());
 }
index fc7e7d2818c9abd8c27945712ee03770e48a8791..ed0323bb97b8c089a9027d6745d9aa3fa1b8bfe4 100644 (file)
@@ -19,11 +19,15 @@ private:
        const Msp::GL::Font *ui_font;
        const Msp::GL::Technique *ui_text_technique;
 
+protected:
        Resources();
 public:
        Resources(const std::string &);
 
+protected:
+       void init_sources(const std::string &);
 private:
+       void init();
        static const DataFile::CollectionSource &get_builtin_source();
 public:
        static Resources &get_builtins();