]> git.tdb.fi Git - libs/gl.git/blobdiff - demos/desertpillars/source/desertpillars.cpp
Create a Device class to hold the graphics context
[libs/gl.git] / demos / desertpillars / source / desertpillars.cpp
index 542ade3b0a8164cb668926e8312bfc90121c67e2..532a94990120d98f4eb3fc55edfca8eb899de5d6 100644 (file)
@@ -23,9 +23,10 @@ DesertPillars::Options::Options()
 
 DesertPillars::DesertPillars(int, char **):
        window(display, opts.wnd_opts),
-       gl_ctx(window, opts.gl_opts),
+       gl_device(window, opts.gl_opts),
        keyboard(window),
-       view(window, gl_ctx),
+       resources(&res_mgr),
+       view(window),
        camera(resources.get<GL::Camera>("Camera.camera")),
        lighting(resources.get<GL::Lighting>("Desert.lightn")),
        sphere(resources.get<GL::Object>("Sphere.object")),
@@ -123,6 +124,7 @@ void DesertPillars::tick()
        flare.set_matrix(GL::Matrix::translation(p));
 
        display.tick();
+       res_mgr.tick();
        view.render();
 }
 
@@ -139,13 +141,15 @@ void DesertPillars::key_press(unsigned key)
 }
 
 
-DesertPillars::Resources::Resources()
+DesertPillars::Resources::Resources(GL::ResourceManager *rm)
 {
        FS::Path base_dir = FS::get_sys_data_dir()/"demos"/"desertpillars"/"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);
 }