X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=demos%2Fforestpond%2Fsource%2Fforestpond.cpp;fp=demos%2Fforestpond%2Fsource%2Fforestpond.cpp;h=e480d209582d6568119e7362e16c94ca65305ed3;hb=35fbb952c5a932cd1b77111da42d5608b51caa4c;hp=0000000000000000000000000000000000000000;hpb=d9c437291135255422c71918cd0cab8a735848af;p=libs%2Fgl.git diff --git a/demos/forestpond/source/forestpond.cpp b/demos/forestpond/source/forestpond.cpp new file mode 100644 index 00000000..e480d209 --- /dev/null +++ b/demos/forestpond/source/forestpond.cpp @@ -0,0 +1,50 @@ +#include +#include +#include "forestpond.h" + +using namespace std; +using namespace Msp; + +ForestPond::ForestPond(int, char **): + window(display, 1920, 1080), + gl_device(window), + /* TODO InstanceArray is not compatible with ResourceManager at the moment, + because it requires Mesh to have its vertex format ready. */ + resources(nullptr), + view(window), + camera(resources.get("Camera.camera")) +{ + window.set_title("Forest Pond"); + window.signal_close.connect(sigc::bind(sigc::mem_fun(this, &DesertPillars::exit), 0)); + + GL::SequenceBuilder seq_bld(resources.get("Forest.seq")); + seq_bld.set_debug_name("Main sequence"); + sequence.reset(seq_bld.build(view)); + + view.set_content(sequence.get()); + view.set_camera(&camera); +} + +int ForestPond::main() +{ + window.show(); + return Application::main(); +} + +void ForestPond::tick() +{ + display.tick(); + view.render(); +} + + +ForestPond::Resources::Resources(GL::ResourceManager *rm) +{ + FS::Path base_dir = FS::get_sys_data_dir()/"demos"/"forestpond"/"data"; + source.add_directory(base_dir); + source.add_directory(base_dir/"textures"); + source.add_directory(base_dir/"exported"); + add_source(source); + + set_resource_manager(rm); +}