#ifndef DEMO_H
#define DEMO_H

#include <G3D/G3DAll.h>
#include <GLG3D/GLG3D.h>
#include "ImageAnalogy.h"

class Demo : public GApplet {
public:

    class Settings {
    public:
        ImageAnalogy::Settings          analogy;

        // Filenames
        std::string                     A;
        std::string                     A2;
        std::string                     B;


        Settings(){}
        void deserialize(TextInput& t);
    };

private:

    class App*                          app;
    
    Image3Ref                           resultImage;
    
    TextureRef                          resultTexture;
    
    GConsoleRef                         console;

    /**
       Updates texture from image.
     */
    static void updateTexture(Image3Ref source, TextureRef& dest);

    Settings                            settings;
public:

    Demo(App* app, const Settings&);

    virtual ~Demo() {}

    virtual void onInit();

    virtual void onGraphics(RenderDevice* rd);

    virtual void onUserInput(UserInput* ui);

    virtual void onCleanup();

    virtual void onConsoleCommand(const std::string& command);

private:

    /** Print console command help */
    void printHelp();

    static void staticConsoleCallback(const std::string& command, void* me) {
        ((Demo*)me)->onConsoleCommand(command);
    }
};

#endif
