}
-#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 (;;)
- {
- if (myAsset) myAsset.get()->cool();
- moof::resource::reload_as_needed();
- sleep(1);
- }
-
+ moof::timer reloadTimer(boost::bind(&moof::resource::reload_as_needed),
+ SCALAR(2.0),
+ moof::timer::repeat);
if (argc > 1)
{