]> Dogcows Code - chaz/yoink/blobdiff - src/Main.cc
testing new non-autotools build system
[chaz/yoink] / src / Main.cc
index bb6b35bc1fd30ecde0c4b3dfb06108a4269c76ef..2df3f1e93da9e96cf114f998df45b5e063c7d03e 100644 (file)
@@ -27,9 +27,6 @@
 #include "Main.hh"
 #include "TitleLayer.hh"
 
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
 #include "version.h"
 
 
@@ -128,7 +125,7 @@ std::string Main::getConfigPath()
        // 4. YOINKRC (environment)
 
        std::string path("yoinkrc");
-       moof::resource::find_path(path);
+       moof::resource::find(path);
 
 #if !defined(_WIN32)
        path += ":/etc/yoinkrc";
@@ -245,6 +242,10 @@ void Main::printInfo(int argc, char* argv[])
                          << "-"
 #endif
                          << "gtk "
+#ifndef USE_HOTLOADING
+                         << "-"
+#endif
+                         << "hotloading "
 #ifndef PROFILING_ENABLED
                          << "-"
 #endif
@@ -278,8 +279,111 @@ void goodbye()
 
 #include <moof/socket.hh>
 
+#include <fstream>
+
+class MyAsset
+{
+public:
+       MyAsset(const std::string& path)
+       {
+               moof::log_info("MyAsset loading:", path);
+
+               char buffer[1024];
+
+               std::ifstream stream(path.c_str());
+               stream.getline(buffer, sizeof(buffer));
+               str = buffer;
+               stream.close();
+
+               cool();
+       }
+
+       void cool()
+       {
+               moof::log_info("MyAsset COOL:", str);
+       }
+
+       void groovy()
+       {
+               moof::log_info("MyAsset GROOVY!!!!", str);
+       }
+
+       std::string str;
+};
+
+typedef moof::resource_handle<MyAsset> MyAsset_handle;
+
+class AnotherAsset
+{
+public:
+       AnotherAsset(const std::string& path, double d = 5.0)
+       {
+               moof::log_info("AnotherAsset loading:", path);
+               dude = d;
+       }
+
+
+       void cool()
+       {
+               moof::log_info("AnotherAsset cool", dude);
+       }
+
+       void groovy()
+       {
+               moof::log_info("AnotherAsset GROOVY!!!!", dude);
+       }
+
+       double dude;
+};
+
+
 int main(int argc, char* argv[])
 {
+       moof::resource::register_type<MyAsset>("mine");
+       //moof::resource::add_type<AnotherAsset>("k");
+       
+       //{
+       //moof::resource_ptr myAsset = moof::resource::load(assetName,
+                       //"prefix", "mine");
+
+       //MyAsset_handle aCopy = myAsset;
+
+       //MyAsset_handle copy2 = moof::resource::load(assetName, "asdfas", "mine");
+
+       ////if (myAsset->check<MyAsset>()) myAsset->get<AnotherAsset>()->cool();
+       //myAsset->get<MyAsset>()->cool();
+       ////myAsset->get<AnotherAsset>()->groovy();
+       
+       //aCopy.get()->cool();
+       //copy2.get()->cool();
+
+       //log_info("rsrc ptr:", moof::resource::load(assetName, "", "mine"));
+       //}
+       //log_info("rsrc ptr:", moof::resource::load(assetName, "", "k"));
+       //moof::resource::load(assetName, "", "mine")->get<MyAsset>()->cool();
+
+       ////if (myAsset) myAsset.get()->cool();
+       ////else moof::log_error("asset not obtained...");
+       
+       MyAsset_handle myAsset = moof::resource::load("/home/chaz/meh.mine");
+       MyAsset* asset = myAsset.get();
+       if (asset) asset->cool();
+       else moof::log_warning("no asset obtained!!");
+
+       moof::timer reloadTimer(
+                       boost::bind(&moof::resource::reload_as_needed),
+                       SCALAR(2.0),
+                       moof::timer::repeat);
+
+       //for (;;)
+       //{
+               //myAsset.get()->cool();
+               //moof::resource::reload_as_needed();
+               //sleep(1);
+       //}
+
+       //return 0;
+
        moof::resolver_task task("4950", "lappy");
        task.run();
 
@@ -344,7 +448,7 @@ int main(int argc, char* argv[])
 
 
        //return 0;
-
+       
 
        if (argc > 1)
        {
@@ -375,7 +479,7 @@ int main(int argc, char* argv[])
        try
        {
                std::string iconPath(PACKAGE".png");
-               moof::resource::find_path(iconPath);
+               moof::resource::find(iconPath);
                moof::image icon(iconPath);
                icon.set_as_icon();
 
This page took 0.020486 seconds and 4 git commands to generate.