Simplify/Make VS happy

This commit is contained in:
Thomas Geymayer
2012-11-27 15:14:54 +01:00
parent 77946585b1
commit c19585e22a
4 changed files with 20 additions and 31 deletions

View File

@@ -26,7 +26,7 @@ namespace simgear
namespace canvas
{
struct Event
class Event
{
public:

View File

@@ -27,24 +27,25 @@ namespace simgear
namespace canvas
{
struct MouseEvent:
class MouseEvent:
public Event
{
MouseEvent():
button(-1),
state(-1),
mod(-1)
{}
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 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
osg::Vec2f pos,
delta;
int button, //<! Button for this event
state, //<! Current button state
mod; //<! Keyboard modifier state
};
} // namespace canvas

View File

@@ -42,7 +42,6 @@ typedef boost::shared_ptr<DoubleDerived> DoubleDerivedPtr;
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[])
{

View File

@@ -97,28 +97,17 @@ namespace nasal
/**
* 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;
}