return _canvas_mgr;
}
+ //----------------------------------------------------------------------------
+ bool Canvas::isInit() const
+ {
+ return _texture.serviceable();
+ }
+
+ //----------------------------------------------------------------------------
+ void Canvas::destroy()
+ {
+ // TODO check if really not in use anymore
+ getProps()->getParent()
+ ->removeChild( getProps()->getName(),
+ getProps()->getIndex(),
+ false );
+ }
+
//----------------------------------------------------------------------------
void Canvas::addParentCanvas(const CanvasWeakPtr& canvas)
{
);
}
+ //----------------------------------------------------------------------------
+ GroupPtr Canvas::getRootGroup()
+ {
+ return _root_group;
+ }
+
//----------------------------------------------------------------------------
void Canvas::enableRendering(bool force)
{
return _texture.getViewSize().y();
}
+ //----------------------------------------------------------------------------
+ SGRect<int> Canvas::getViewport() const
+ {
+ return SGRect<int>(0, 0, getViewWidth(), getViewHeight());
+ }
+
//----------------------------------------------------------------------------
bool Canvas::handleMouseEvent(const MouseEventPtr& event)
{
#include "ODGauge.hxx"
#include <simgear/canvas/elements/CanvasGroup.hxx>
+#include <simgear/math/SGRect.hxx>
#include <simgear/props/PropertyBasedElement.hxx>
#include <simgear/props/propertyObject.hxx>
#include <osg/NodeCallback>
void setCanvasMgr(CanvasMgr* canvas_mgr);
CanvasMgr* getCanvasMgr() const;
+ bool isInit() const;
+ void destroy();
+
/**
* Add a canvas which should be marked as dirty upon any change to this
* canvas.
void removeChildCanvas(const CanvasWeakPtr& canvas);
GroupPtr createGroup(const std::string& name = "");
+ GroupPtr getRootGroup();
/**
* Enable rendering for the next frame
int getViewWidth() const;
int getViewHeight() const;
+ SGRect<int> getViewport() const;
bool handleMouseEvent(const MouseEventPtr& event);
}
//----------------------------------------------------------------------------
- bool ODGauge::serviceable(void)
+ bool ODGauge::serviceable() const
{
return _flags & AVAILABLE;
}
* Say if we can render to a texture.
* @return true if rtt is available
*/
- bool serviceable(void);
+ bool serviceable() const;
/**
* Get the OSG camera for drawing this gauge.
#define OVG_SH_blend_dst_atop 1
VG_API_CALL VGboolean vgCreateContextSH(VGint width, VGint height);
+VG_API_CALL VGboolean vgHasContextSH();
VG_API_CALL void vgResizeSurfaceSH(VGint width, VGint height);
VG_API_CALL void vgDestroyContextSH(void);
return VG_TRUE;
}
+VG_API_CALL VGboolean vgHasContextSH()
+{
+ return g_context != NULL;
+}
+
VG_API_CALL void vgResizeSurfaceSH(VGint width, VGint height)
{
VG_GETCONTEXT(VG_NO_RETVAL);
*/
void update()
{
+ if( !vgHasContextSH() )
+ return;
+
if( _attributes_dirty & PATH )
{
const VGbitfield caps = VG_PATH_CAPABILITY_APPEND_TO
#include <simgear/canvas/Canvas.hxx>
#include <simgear/canvas/CanvasSystemAdapter.hxx>
#include <simgear/scene/util/parse_color.hxx>
+#include <simgear/structure/OSGVersion.hxx>
#include <osgText/Text>
namespace simgear
if( !bb.valid() )
return bb;
+#if SG_OSG_VERSION_LESS_THAN(3,1,0)
// TODO bounding box still doesn't seem always right (eg. with center
// horizontal alignment not completely accurate)
bb._min.y() += _offset.y();
bb._max.y() += _offset.y();
+#endif
_text_element->setBoundingBox(bb);
#include <simgear/props/props.hxx>
+#include <boost/call_traits.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/weak_ptr.hpp>
SGConstPropertyNode_ptr getProps() const;
SGPropertyNode_ptr getProps();
+ template<class T>
+ void set( const std::string& name,
+ typename boost::call_traits<T>::param_type val )
+ {
+ setValue(_node->getNode(name, true), val);
+ }
+
virtual void setSelf(const PropertyBasedElementPtr& self);
protected: