
// mouse.hpp - mouse interaction interface for "hairline" stroking algorithm testbed

#include <Cg/vector.hpp>
#include <Cg/matrix.hpp>

using namespace Cg;

struct MouseState {
    /* Scaling and rotation state. */
    float2 anchor;
    /* Anchor for rotation and scaling. */
    int scale_y, 
        rotate_x;  /* Prior (x,y) location for scaling (vertical) or rotation (horizontal)? */
    int zooming;  /* Are we zooming currently? */
    int scaling;  /* Are we scaling (zooming) currently? */

    /* Sliding (translation) state. */
    float slide_x,
        slide_y,   /* Prior (x,y) location for sliding. */
        slide_scale;
    int sliding;  /* Are we sliding currently? */

    bool x_sliding,
        y_sliding;

    float3x3 view, inverse_view;
    float3x3 win2view, view2win;

    float window_width, window_height, aspect_ratio;

    float3x3 projection;
    float view_width, view_height;

    MouseState()
        : anchor(float2(0))
        , scale_y(0)
        , rotate_x(0)
        , zooming(0)
        , scaling(0)
        , slide_x(0)
        , slide_y(0)
        , slide_scale(1)
        , sliding(0)
        , x_sliding(false)
        , y_sliding(false)
    {
    }
};
