Ejemplo n.º 1
0
UIDrawObjectCanvasTransitPtr Button::createTexturedDrawObjectCanvas(TextureObjChunk* const TheTexture, Vec2f Size)
{
    UIDrawObjectCanvasRefPtr DrawObjectCanvas = UIDrawObjectCanvas::create();
    TexturedQuadUIDrawObjectRefPtr TextureDrawObject = TexturedQuadUIDrawObject::create();

    Vec2f ImageSize;
    ImageSize.setValues(TheTexture->getImage()->getWidth(), TheTexture->getImage()->getHeight());

    if(Size.x() > 0.0f)
    {
        ImageSize[0] = Size.x();
    }
    if(Size.y() > 0.0f)
    {
        ImageSize[1] = Size.y();
    }

    TextureDrawObject->setPoint1(Pnt2f(0,0));
    TextureDrawObject->setPoint2(Pnt2f(ImageSize.x(),0));
    TextureDrawObject->setPoint3(Pnt2f(ImageSize.x(),ImageSize.y()));
    TextureDrawObject->setPoint4(Pnt2f(0,ImageSize.y()));

    TextureDrawObject->setTexCoord1(Vec2f(0.0,0.0));
    TextureDrawObject->setTexCoord2(Vec2f(1.0,0.0));
    TextureDrawObject->setTexCoord3(Vec2f(1.0,1.0));
    TextureDrawObject->setTexCoord4(Vec2f(0.0,1.0));

    TextureDrawObject->setTexture(TheTexture);

    TextureDrawObject->setOpacity(1.0);

    DrawObjectCanvas->pushToDrawObjects(TextureDrawObject);

    return UIDrawObjectCanvasTransitPtr(DrawObjectCanvas.get());
}
Ejemplo n.º 2
0
void GradientLayer::drawGradient(Graphics* const TheGraphics, const Pnt2f& Origin, const Vec2f& Size, const Vec2f& UAxis, const Real32& Start, const Real32& End, const Real32& Opacity) const
{
	glPushMatrix();
	Matrix Transformation;
	Transformation.setTransform(Vec3f(Origin.x()+Start*UAxis.x()*Size.x(), Origin.y()+Start*UAxis.y()*Size.x(),0.0f), Quaternion(Vec3f(1.0f,0.0f,0.0f),Vec3f(UAxis.x(), UAxis.y(), 0.0f)), Vec3f(Size.x()*(End-Start), Size.y(),0.0f));
	glMultMatrixf(Transformation.getValues());

	if (osgMin(getMFColors()->size(),getMFStops()->size()) > 1)
	{
		if(getMFColors()->size() != getMFStops()->size())
		{    
			SWARNING << "GradientLayer::drawGradient: The number of colors and the number of stops are not equal." << std::endl;
		}

		UInt32 NumStops = osgMin(getMFColors()->size(),getMFStops()->size());
		Real32 CurentRelaviteStop= 0.0f;
			
		for(UInt32 i(0) ; i<NumStops-1 ; ++i)
		{
			TheGraphics->drawQuad(Pnt2f(getStops(i),0.0f),
				                  Pnt2f(getStops(i+1),0.0f),
				                  Pnt2f(getStops(i+1),1.0f),
				                  Pnt2f(getStops(i),1.0f),
								  getColors(i),
								  getColors(i+1),
								  getColors(i+1),
								  getColors(i),
								  Opacity);
		}
	}
	glPopMatrix();
}
TriDistribution2DBase::TriDistribution2DBase(void) :
    Inherited(),
    _sfPoint1                 (Pnt2f(0.0,0.0)),
    _sfPoint2                 (Pnt2f(1.0,0.0)),
    _sfPoint3                 (Pnt2f(0.0,1.0)),
    _sfSurfaceOrEdge          (UInt32(TriDistribution2D::SURFACE))
{
}
LineUIDrawObjectBase::LineUIDrawObjectBase(void) :
    Inherited(),
    _sfTopLeft                (Pnt2f(0,0)),
    _sfBottomRight            (Pnt2f(0,0)),
    _sfWidth                  (Real32(1)),
    _sfColor                  (Color4f(1.0,1.0,1.0,1.0)),
    _sfOpacity                (Real32(1.0))
{
}
GradientLayerBase::GradientLayerBase(void) :
    Inherited(),
    _sfStartPosition          (Pnt2f(0.0,0.0)),
    _sfEndPosition            (Pnt2f(1.0,0.0)),
    _mfColors                 (),
    _mfStops                  (),
    _sfSpreadMethod           (UInt32(GradientLayer::SPREAD_PAD))
{
}
Ejemplo n.º 6
0
GlassLayerBase::GlassLayerBase(void) :
    Inherited(),
    _sfStartPosition          (Pnt2f(0.0f,1.0f)),
    _sfStartDirection         (Vec2f(0.0f,-1.0f)),
    _sfEndPosition            (Pnt2f(1.0f,0.0f)),
    _sfEndDirection           (Vec2f(1.0f,0.0f)),
    _sfCenterColor            (Color4f(1.0f,1.0f,1.0f,0.3f)),
    _sfEdgeColor              (Color4f(1.0f,1.0f,1.0f,0.5f)),
    _sfSegments               (UInt32(15))
{
}
Ejemplo n.º 7
0
void ComboBox::updateLayout(void)
{
    Pnt2f BorderTopLeft, BorderBottomRight;
    getInsideInsetsBounds(BorderTopLeft, BorderBottomRight);

    Vec2f Size;
    Pnt2f Pos;
    if(getExpandButton() != NULL)
    {
        //Place the Expand button on the Left
        Size = getExpandButton()->getPreferredSize();
        if(getExpandButton()->getSize() != Size)
        {
            getExpandButton()->setSize(Size);
        }

        Pos = calculateAlignment(BorderTopLeft, (BorderBottomRight-BorderTopLeft), getExpandButton()->getSize(),0.5, 1.0);
        if(getExpandButton()->getPosition() != Pos)
        {
            getExpandButton()->setPosition(Pos);
        }
    }

    //Editor
    if(getEditable() && getEditor() != NULL && getEditor()->getEditorComponent() != NULL)
    {
        Size = Vec2f(BorderBottomRight.x() - BorderTopLeft.x() - getExpandButton()->getSize().x(), getExpandButton()->getSize().y());
        if(getEditor()->getEditorComponent()->getSize() != Size)
        {
            getEditor()->getEditorComponent()->setSize(Size);
        }
        Pos = Pnt2f(BorderTopLeft.x(), getExpandButton()->getPosition().y());
        if(getEditor()->getEditorComponent()->getPosition() != Pos)
        {
            getEditor()->getEditorComponent()->setPosition(Pos);
        }
    }

    //Selected Item Component
    if(!getEditable() && getComponentGeneratorSelectedItem() != NULL)
    {
        Size = Vec2f(BorderBottomRight.x() - BorderTopLeft.x() - getExpandButton()->getSize().x(), getExpandButton()->getSize().y());
        if(getComponentGeneratorSelectedItem()->getSize() != Size)
        {
            getComponentGeneratorSelectedItem()->setSize(Size);
        }
        Pos = Pnt2f(BorderTopLeft.x(), getExpandButton()->getPosition().y());
        if(getComponentGeneratorSelectedItem()->getPosition() != Pos)
        {
            getComponentGeneratorSelectedItem()->setPosition(Pos);
        }
    }
}
Pnt2f FixedHeightLayoutManager::getEndXYPosition(UInt32 lineNumber) const
{
	PlainDocumentLeafElementRefPtr theElement = dynamic_cast<PlainDocumentLeafElement*>(rootElement->getElement(lineNumber));
	if(theElement)
	{
		Pnt2f topLeft,bottomRight;
		getParentTextDomArea()->getFont()->getBounds(theElement->getText(),topLeft,bottomRight);
		return Pnt2f(_GutterSpace + _GutterSeparation + bottomRight.x(),(lineNumber+1)*heightOfLine);
	}
	else
	{
		return Pnt2f(0,0);
	}
}
Ejemplo n.º 9
0
void SpinnerDefaultEditor::updateLayout(void)
{
    for(UInt32 i(0) ; i<getMFChildren()->size() ; ++i)
    {
        if(getChildren(i)->getPosition() != Pnt2f(0,0))
        {
            getChildren(i)->setPosition(Pnt2f(0,0));
        }
        if(getChildren(i)->getSize() != getSize())
        {
            getChildren(i)->setSize(getSize());
        }
    }
}
Ejemplo n.º 10
0
void GradientLayer::drawPad(Graphics* const TheGraphics, const Pnt2f& Origin, const Vec2f& Size, const Vec2f& UAxis, const Real32& Start, const Real32& End, const Color4f Color, const Real32& Opacity) const
{
	glPushMatrix();
	Matrix Transformation;
	Transformation.setTransform(Vec3f(Origin.x()+Start*UAxis.x()*Size.x(), Origin.y()+Start*UAxis.y()*Size.x(),0.0f), Quaternion(Vec3f(1.0f,0.0f,0.0f),Vec3f(UAxis.x(), UAxis.y(), 0.0f)), Vec3f(Size.x()*(End-Start), Size.y(),0.0f));
	glMultMatrixf(Transformation.getValues());

	
	TheGraphics->drawRect(Pnt2f(0.0,0.0f),
		                  Pnt2f(1.0,1.0f),
						  Color,
						  Opacity);

	glPopMatrix();
}
Ejemplo n.º 11
0
void TextDomArea::drawHighlightBGInternal(Graphics * const TheGraphics, Real32 Opacity,UInt32 lesserLine,UInt32 lesserIndex,UInt32 greaterLine,UInt32 greaterIndex) const
{
	for(UInt32 i=lesserLine+1;i<greaterLine;i++)
	{
		PlainDocumentLeafElementRefPtr theElement = dynamic_cast<PlainDocumentLeafElement*>(getLayoutManager()->getRootElement()->getElement(i));
		
		if(theElement)
		{
			Pnt2f topLeft,bottomRight;
			getFont()->getBounds(theElement->getText(),topLeft,bottomRight);

			TheGraphics->drawRect(Pnt2f(getLayoutManager()->getGutterSpace() + getLayoutManager()->getGutterSeparation(),i*getLayoutManager()->getHeightOfLine()),Pnt2f(getLayoutManager()->getGutterSpace() + getLayoutManager()->getGutterSeparation()+ bottomRight.x(),(i+1)*getLayoutManager()->getHeightOfLine()),Color4f(0.7,0.7,0.95,1),Opacity);
		}
	}

	if(lesserLine== greaterLine)
	{
		TheGraphics->drawRect(getLayoutManager()->getXYPosition(lesserLine,lesserIndex,true),getLayoutManager()->getXYPosition(greaterLine,greaterIndex,false),Color4f(0.7,0.7,0.95,1),Opacity);
	}
	else
	{
		// draw the first line
		TheGraphics->drawRect(getLayoutManager()->getXYPosition(lesserLine,lesserIndex,true),getLayoutManager()->getEndXYPosition(lesserLine),Color4f(0.7,0.7,0.95,1),Opacity);

		// draw the last line
		TheGraphics->drawRect(getLayoutManager()->getStartXYPosition(greaterLine),getLayoutManager()->getXYPosition(greaterLine,greaterIndex,false),Color4f(0.7,0.7,0.95,1),Opacity);
	}

}
Ejemplo n.º 12
0
bool Component::isContained(const Pnt2f& p, bool TestAgainstClipBounds) const
{
    if(!getVisible())
    {
        return false;
    }

    Pnt2f PointInCompSpace(DrawingSurfaceToComponent(p,this));
    Border* DrawnBorder(getDrawnBorder());
    Pnt2f TopLeft, BottomRight;
    if(TestAgainstClipBounds && getClipping())
    {
        TopLeft = getClipTopLeft();
        BottomRight = getClipBottomRight();
    }
    else
    {
        TopLeft.setValues(0,0);
        BottomRight = Pnt2f(getSize());
    }

    if(DrawnBorder == NULL)
    {
        return isContainedBounds(PointInCompSpace, TopLeft, BottomRight);
    }
    else
    {
        return isContainedBounds(PointInCompSpace, TopLeft, BottomRight) && 
            DrawnBorder->isContained(PointInCompSpace,0,0,getSize().x(),getSize().y());
    }
}
Ejemplo n.º 13
0
void SpringLayout::updateLayout(const MFUnrecComponentPtr* Components, const Component* ParentComponent) const
{
	Pnt2f ParentInsetsTopLeft, ParentInsetsBottomRight;
	dynamic_cast<const ComponentContainer*>(ParentComponent)->getInsideInsetsBounds(ParentInsetsTopLeft, ParentInsetsBottomRight);
    
    const_cast<SpringLayout*>(this)->setParent(const_cast<ComponentContainer*>(dynamic_cast<const
                                                                         ComponentContainer*>(ParentComponent)));
    
    SpringLayoutConstraintsRefPtr MyBoundsConstraints =
        getConstraint(const_cast<Component*>(ParentComponent));
    
    getDecycledSpring(MyBoundsConstraints->getX())->setValue(ParentInsetsTopLeft.x());
    getDecycledSpring(MyBoundsConstraints->getY())->setValue(ParentInsetsTopLeft.y());
    getDecycledSpring(MyBoundsConstraints->getWidth())->setValue( ParentInsetsBottomRight.x() - ParentInsetsTopLeft.x() );
    getDecycledSpring(MyBoundsConstraints->getHeight())->setValue( ParentInsetsBottomRight.y() - ParentInsetsTopLeft.y() );
    
    for (UInt32 i(0) ; i < Components->size() ; i++)
    {
        SpringLayoutConstraintsRefPtr TheConstraints = getConstraint( (*Components)[i] );
        Real32 x = getDecycledSpring(TheConstraints->getX())->getValue();
        Real32 y = getDecycledSpring(TheConstraints->getY())->getValue();
        Real32 width = getDecycledSpring(TheConstraints->getWidth())->getValue();
        Real32 height = getDecycledSpring(TheConstraints->getHeight())->getValue();
        
            (*Components)[i]->setPosition(Pnt2f(x,y));
            (*Components)[i]->setSize(Vec2f(width, height));
     }
}
Ejemplo n.º 14
0
	Pnt2f DynamicTerrain::getWorldOffset() const
	{
		// offset the terrain, so that it is centered around zero:
		const Pnt2f size = getWorldSize();

		return Pnt2f( -size[ 0 ] / 2.0f, -size[ 1 ] / 2.0f );
	}
GaussianNormalDistribution2DBase::GaussianNormalDistribution2DBase(void) :
    Inherited(),
    _sfMean                   (Pnt2f(0.0,0.0)),
    _sfStandardDeviationX     (Real32(1.0)),
    _sfStandardDeviationY     (Real32(1.0))
{
}
Ejemplo n.º 16
0
void runTests(bool write,BinaryDataHandler &pMem)
{
    runTest  (write,pMem, std::string("Hallo") );
    runTest1 (write,pMem, Time(222.22) );
    runTest  (write,pMem, Color3f(1.1,2.2,3.3) );
    runTest  (write,pMem, Color4f(1.1,2.2,3.3,4.4) );
    runTest  (write,pMem, Color3ub(1,2,3) );
    runTest  (write,pMem, Color4ub(1,2,3,4) );
    runTest  (write,pMem, DynamicVolume(DynamicVolume::BOX_VOLUME) );
    runTest  (write,pMem, DynamicVolume(DynamicVolume::SPHERE_VOLUME) );
    runTest1 (write,pMem, BitVector(0xabcd) );
    runTest  (write,pMem, Plane(Vec3f(1.0,0),0.222) );
    runTest  (write,pMem, Matrix(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) );
    runTest  (write,pMem, Quaternion(Vec3f(1,2,3),22) );
    runTest2<bool>(write,pMem, true );
    runTest  (write,pMem, Int8(-22) );
    runTest  (write,pMem, UInt8(11) );
    runTest  (write,pMem, Int16(-10233) );
    runTest  (write,pMem, UInt16(20233) );
    runTest  (write,pMem, Int32(-222320233) );
    runTest  (write,pMem, UInt32(522320233) );
    runTest<Int64>  (write,pMem, Int64(-522323334) );
    runTest  (write,pMem, UInt64(44523423) );
    runTest  (write,pMem, Real32(22.333224) );
    runTest  (write,pMem, Real64(52.334534533224) );
    runTest  (write,pMem, Vec2f(1.1,2.2) );
    runTest  (write,pMem, Vec3f(1.1,2.2,3.3) );
    runTest  (write,pMem, Vec4f(1.1,2.2,3.3,4.4) );
    runTest  (write,pMem, Pnt2f(1.1,2.2) );
    runTest  (write,pMem, Pnt2d(1.1,2.2) );
    runTest  (write,pMem, Pnt3f(1.1,2.2,3.3) );
    runTest  (write,pMem, Pnt3d(1.1,2.2,3.3) );
    runTest  (write,pMem, Pnt4f(1.1,2.2,3.3,4.4) );
    runTest  (write,pMem, Pnt4d(1.1,2.2,3.3,4.4) );
}
Ejemplo n.º 17
0
void Manipulator::mouseButtonPress(const UInt16 button,
                                   const Int16  x,
                                   const Int16  y     )
{
    setLastMousePos(Pnt2f(Real32(x), Real32(y)));
    setActive(true);
}
Ejemplo n.º 18
0
	Pnt2f DynamicTerrain::getWorldSize() const
	{
		const float sampleDistance = getSampleDistance();
		const Pnt2i sampleCount = imageHeightSource_.getSampleCount();

		return Pnt2f( float( sampleCount[ 0 ] ) * sampleDistance, float( sampleCount[ 1 ] ) * sampleDistance );
	}
Ejemplo n.º 19
0
void RotatedComponent::updateLayout(void)
{
    Pnt2f TopLeft, BottomRight;
    getInsideInsetsBounds(TopLeft, BottomRight);

    for(UInt32 i(0) ; i<getMFChildren()->size() ; ++i)
    {
        if(getChildren(i)->getPosition() != Pnt2f(0,0))
        {
            getChildren(i)->setPosition(Pnt2f(0,0));
        }
        if(getChildren(i)->getSize() != getChildren(i)->getPreferredSize())
        {
            getChildren(i)->setSize(getChildren(i)->getPreferredSize());
        }
    }
}
void GenericMultiFieldEditor::updateLayout(void)
{
    Pnt2f TopLeft, BottomRight;
    getInsideBorderBounds(TopLeft, BottomRight);

    _FieldElementsScrollPanel->setPosition(Pnt2f(0.0f,0.0f));
    _FieldElementsScrollPanel->setSize(BottomRight - TopLeft);
}
MouseWheelEventDetailsBase::MouseWheelEventDetailsBase(void) :
    Inherited(),
    _sfScrollType             (UInt8(MouseWheelEventDetails::UNIT_SCROLL)),
    _sfScrollOrientation      (UInt8(MouseWheelEventDetails::SCROLL_ORIENTATION_VERTICAL)),
    _sfWheelRotation          (Int32(0)),
    _sfLocation               (Pnt2f(0.0f,0.0f)),
    _sfViewport               (NULL)
{
}
Ejemplo n.º 22
0
MouseEventBase::MouseEventBase(void) :
    Inherited(),
    _sfButton                 (UInt16(MouseEvent::NO_BUTTON)),
    _sfClickCount             (UInt16(0)),
    _sfLocation               (Pnt2f(0.0f, 0.0f)),
    _sfDelta                  (Vec2f(0.0f, 0.0f)),
    _sfViewport               (NULL)
{
}
Pnt2f FixedHeightLayoutManager::getXYPosition(UInt32 lineNumber,UInt32 index,bool isBeginning) const
{
	PlainDocumentLeafElementRefPtr theElement = dynamic_cast<PlainDocumentLeafElement*>(rootElement->getElement(lineNumber));
	if(theElement)
	{
		std::string substring = theElement->getText();
		substring = substring.substr(0,index);

		Pnt2f topLeft,bottomRight;
		getParentTextDomArea()->getFont()->getBounds(substring,topLeft,bottomRight);

		if(isBeginning)return Pnt2f( _GutterSpace + _GutterSeparation + bottomRight.x(),lineNumber*heightOfLine);
		return Pnt2f(_GutterSpace + _GutterSeparation + bottomRight.x(),(lineNumber+1)*heightOfLine);
	}
	else
	{
		return Pnt2f(0,0);
	}

}
void FixedHeightLayoutManager::makeCaretVisible(UInt32 dir)
{
	Pnt2f TempTopLeft, TempBottomRight;
	
	TempTopLeft = Pnt2f(_CaretXPosition,_CaretYPosition);//TempTopLeft + Offset;
	TempBottomRight = Pnt2f(_CaretXPosition + 25 + 2,_CaretYPosition+heightOfLine);//25 here denotes the gutterwidth .. should not hardcode here

	if(getParentTextDomArea()->getParentContainer() != NULL && getParentTextDomArea()->getParentContainer()->getType().isDerivedFrom(UIViewport::getClassType()))
	{
		//Get the bounds of this line
		dynamic_cast<UIViewport*>(getParentTextDomArea()->getParentContainer())->maximizeVisibility(TempTopLeft, TempBottomRight);
	}
	else if(getParentTextDomArea()->getParentContainer() != NULL && 
		getParentTextDomArea()->getParentContainer()->getParentContainer() != NULL && 
		getParentTextDomArea()->getParentContainer()->getParentContainer()->getType().isDerivedFrom(UIViewport::getClassType()))
	{
		dynamic_cast<UIViewport*>(getParentTextDomArea()->getParentContainer()->getParentContainer())->maximizeVisibility(TempTopLeft, TempBottomRight);
	}
	updateViews();
	
}
WindowEventProducer::WindowEventProducer(const WindowEventProducer &source) :
    Inherited(source),
    _WindowEventLoopThread (NULL                          ),
    _DisplayCallbackFunc   (source._DisplayCallbackFunc   ),
    _ReshapeCallbackFunc   (source._ReshapeCallbackFunc   ),
	_CursorType            (source._CursorType            ),
    _BlockInput            (source._BlockInput            )
{
    _ButtonClickCountMap[MouseEventDetails::BUTTON1] = ClickVector();
    _ButtonClickCountMap[MouseEventDetails::BUTTON2] = ClickVector();
    _ButtonClickCountMap[MouseEventDetails::BUTTON3] = ClickVector();
    _ButtonClickCountMap[MouseEventDetails::BUTTON4] = ClickVector();
    _ButtonClickCountMap[MouseEventDetails::BUTTON5] = ClickVector();
    _ButtonClickCountMap[MouseEventDetails::BUTTON6] = ClickVector();
    //_ButtonClickCountMap[MouseEventDetails::BUTTON7] = ClickVector();
    //_ButtonClickCountMap[MouseEventDetails::BUTTON8] = ClickVector();
    //_ButtonClickCountMap[MouseEventDetails::BUTTON9] = ClickVector();
    //_ButtonClickCountMap[MouseEventDetails::BUTTON10] = ClickVector();

    _ButtonClickMap[MouseEventDetails::BUTTON1] = Pnt2f(0,0);
    _ButtonClickMap[MouseEventDetails::BUTTON2] = Pnt2f(0,0);
    _ButtonClickMap[MouseEventDetails::BUTTON3] = Pnt2f(0,0);
    _ButtonClickMap[MouseEventDetails::BUTTON4] = Pnt2f(0,0);
    _ButtonClickMap[MouseEventDetails::BUTTON5] = Pnt2f(0,0);
    _ButtonClickMap[MouseEventDetails::BUTTON6] = Pnt2f(0,0);
    //_ButtonClickMap[MouseEventDetails::BUTTON7] = Pnt2f(0,0);
    //_ButtonClickMap[MouseEventDetails::BUTTON8] = Pnt2f(0,0);
    //_ButtonClickMap[MouseEventDetails::BUTTON9] = Pnt2f(0,0);
    //_ButtonClickMap[MouseEventDetails::BUTTON10] = Pnt2f(0,0);
}
WindowEventProducer::WindowEventProducer(void) :
    Inherited(),
    _WindowEventLoopThread (NULL),
    _DisplayCallbackFunc   (NULL),
    _ReshapeCallbackFunc   (NULL),
    _CursorType            (CURSOR_POINTER),
    _BlockInput            (false)
{
    _ButtonClickCountMap[MouseEventDetails::BUTTON1] = ClickVector();
    _ButtonClickCountMap[MouseEventDetails::BUTTON2] = ClickVector();
    _ButtonClickCountMap[MouseEventDetails::BUTTON3] = ClickVector();
    _ButtonClickCountMap[MouseEventDetails::BUTTON4] = ClickVector();
    _ButtonClickCountMap[MouseEventDetails::BUTTON5] = ClickVector();
    _ButtonClickCountMap[MouseEventDetails::BUTTON6] = ClickVector();
    //_ButtonClickCountMap[MouseEventDetails::BUTTON7] = ClickVector();
    //_ButtonClickCountMap[MouseEventDetails::BUTTON8] = ClickVector();
    //_ButtonClickCountMap[MouseEventDetails::BUTTON9] = ClickVector();
    //_ButtonClickCountMap[MouseEventDetails::BUTTON10] = ClickVector();

    _ButtonClickMap[MouseEventDetails::BUTTON1] = Pnt2f(0,0);
    _ButtonClickMap[MouseEventDetails::BUTTON2] = Pnt2f(0,0);
    _ButtonClickMap[MouseEventDetails::BUTTON3] = Pnt2f(0,0);
    _ButtonClickMap[MouseEventDetails::BUTTON4] = Pnt2f(0,0);
    _ButtonClickMap[MouseEventDetails::BUTTON5] = Pnt2f(0,0);
    _ButtonClickMap[MouseEventDetails::BUTTON6] = Pnt2f(0,0);
    //_ButtonClickMap[MouseEventDetails::BUTTON7] = Pnt2f(0,0);
    //_ButtonClickMap[MouseEventDetails::BUTTON8] = Pnt2f(0,0);
    //_ButtonClickMap[MouseEventDetails::BUTTON9] = Pnt2f(0,0);
    //_ButtonClickMap[MouseEventDetails::BUTTON10] = Pnt2f(0,0);
}
Ejemplo n.º 27
0
Pnt2f Manipulator::calcScreenProjection(const Pnt3f    &       p,
                                              Viewport * const port)
{
    Camera  *cam;
    Matrix   proj, projtrans, view;
    Pnt3f    pnt;

    if( port != NULL )
    {
        cam = port->getCamera();

        cam->getProjection(proj, 
                           port->calcPixelWidth(),
                           port->calcPixelHeight());
        cam->getProjectionTranslation(projtrans, 
                                      port->calcPixelWidth(),
                                      port->calcPixelHeight());
        cam->getViewing(view, 
                        port->calcPixelWidth(), 
                        port->calcPixelHeight());

        Matrix wctocc = proj;
        wctocc.mult(projtrans);
        wctocc.mult(view);

        wctocc.multFull(p, pnt);

        Real32 rx = (pnt[0] + 1.0) /2 * port->calcPixelWidth();
        Real32 ry = (pnt[1] + 1.0) /2 * port->calcPixelHeight();

        return Pnt2f(rx, ry);
    }
    else
    {
        SWARNING << "calcScreenProjection(const Pnt3f&, "
                    "Viewport * const port="
                 << port << ")\n";
        return Pnt2f(0.0f, 0.0f);
    }
}
ArcUIDrawObjectBase::ArcUIDrawObjectBase(void) :
    Inherited(),
    _sfCenter                 (Pnt2f(0,0)),
    _sfWidth                  (Real32(1)),
    _sfHeight                 (Real32(1)),
    _sfStartAngleRad          (Real32(0.0)),
    _sfEndAngleRad            (Real32(6.283185307)),
    _sfSubDivisions           (UInt16(24)),
    _sfColor                  (Color4f(1.0,1.0,1.0,1.0)),
    _sfLineWidth              (Real32(1.0)),
    _sfOpacity                (Real32(1.0))
{
}
Ejemplo n.º 29
0
Pnt2f XWindow::getPosition(void) const
{
    ::Window *RootWindow;
    int x,y;
    unsigned int Width,Height,Depth,BorderWidth;
    
    XGetGeometry(this->getDisplay(),this->getWindow(),RootWindow,
            &x,&y,
            &Width,&Height,
            &BorderWidth,
            &Depth);
    
   return Pnt2f(x,y);
}
Ejemplo n.º 30
0
OSG_BEGIN_NAMESPACE

void openCreditsWindow(void)
{
    ApplicationBuilderUnrecPtr AppBuilder = dynamic_cast<ApplicationBuilder*>(MainApplication::the()->getBuilderMode());

    DialogWindowRecPtr TheCreditsWindow = createCreditsWindow();

    dynamic_cast<Button*>(AppBuilder->findContainer("KabalaEngine.CreditsWindow.OkButton"))->connectActionPerformed(boost::bind(&handleCreditsWindowCloseButton, _1, TheCreditsWindow.get()));

    TheCreditsWindow->setPosition(calculateAlignment(Pnt2f(0.0f,0.0f), AppBuilder->getDrawingSurface()->getSize(), TheCreditsWindow->getPreferredSize(), 0.5f,0.5f));

    AppBuilder->getDrawingSurface()->openWindow(TheCreditsWindow);
}