X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMain.cc;h=2df3f1e93da9e96cf114f998df45b5e063c7d03e;hp=bb6b35bc1fd30ecde0c4b3dfb06108a4269c76ef;hb=6b0a0d0efafe34d48ab344fca3b479553bd4e62c;hpb=85783316365181491a3e3c0c63659972477cebba diff --git a/src/Main.cc b/src/Main.cc index bb6b35b..2df3f1e 100644 --- a/src/Main.cc +++ b/src/Main.cc @@ -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 +#include + +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_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("mine"); + //moof::resource::add_type("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->get()->cool(); + //myAsset->get()->cool(); + ////myAsset->get()->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()->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();