namespace canvas
{
- struct Event
+ class Event
{
public:
namespace canvas
{
- struct MouseEvent:
+ class MouseEvent:
public Event
{
- MouseEvent():
- button(-1),
- state(-1),
- mod(-1)
- {}
-
- osg::Vec2f getPos() const { return pos; }
- osg::Vec3f getPos3() const { return osg::Vec3f(pos, 0); }
- osg::Vec2f getDelta() const { return delta; }
-
- osg::Vec2f pos,
- delta;
- int button, //<! Button for this event
- state, //<! Current button state
- mod; //<! Keyboard modifier state
+ public:
+ MouseEvent():
+ button(-1),
+ state(-1),
+ mod(-1)
+ {}
+
+ osg::Vec2f getPos() const { return pos; }
+ osg::Vec3f getPos3() const { return osg::Vec3f(pos, 0); }
+ osg::Vec2f getDelta() const { return delta; }
+
+ osg::Vec2f pos,
+ delta;
+ int button, //<! Button for this event
+ state, //<! Current button state
+ mod; //<! Keyboard modifier state
};
} // namespace canvas
typedef boost::shared_ptr<DoubleDerived2> DoubleDerived2Ptr;
naRef member(Derived&, const nasal::CallContext&) { return naNil(); }
-naRef member(DerivedPtr&, const nasal::CallContext&) { return naNil(); }
int main(int argc, char* argv[])
{
/**
* Convert a Nasal vector to a std::vector
*/
- template<class Vector>
- typename boost::enable_if< boost::is_same
- < Vector,
- std::vector<typename Vector::value_type>
- >,
- Vector
- >::type
- from_nasal_helper(naContext c, naRef ref, Vector*)
+ template<class T>
+ std::vector<T> from_nasal_helper(naContext c, naRef ref, std::vector<T>*)
{
if( !naIsVector(ref) )
throw bad_nasal_cast("Not a vector");
int size = naVec_size(ref);
- Vector vec(size);
+ std::vector<T> vec(size);
for(int i = 0; i < size; ++i)
- vec[i] = from_nasal_helper
- (
- c,
- naVec_get(ref, i),
- static_cast<typename Vector::value_type*>(0)
- );
+ vec[i] = from_nasal_helper(c, naVec_get(ref, i), static_cast<T*>(0));
return vec;
}