From d1c54223cbe11aa21e44568155adffff065f3c19 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 6 Apr 2018 14:06:50 +0100 Subject: [PATCH] Added osgtext --alignment test to look the effect of calling Text::setAlignent() before and after the Text::setText(). --- examples/osgtext/osgtext.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/examples/osgtext/osgtext.cpp b/examples/osgtext/osgtext.cpp index 4f7972fe3..e1f710de4 100644 --- a/examples/osgtext/osgtext.cpp +++ b/examples/osgtext/osgtext.cpp @@ -674,6 +674,30 @@ int main(int argc, char** argv) viewer.setSceneData(text.get()); } + else if (arguments.read("--alignment")) + { + osg::ref_ptr group = new osg::Group; + + { + osg::ref_ptr text = new osgText::Text; + text->setFont("fonts/times.ttf"); + text->setAxisAlignment(osgText::Text::XZ_PLANE); + text->setAlignment(osgText::Text::RIGHT_TOP); + text->setText("Alingment\nBefore:"); + group->addChild(text); + } + + { + osg::ref_ptr text = new osgText::Text; + text->setFont("fonts/times.ttf"); + text->setAxisAlignment(osgText::Text::XZ_PLANE); + text->setText("Alingment\nAfter:"); + text->setAlignment(osgText::Text::RIGHT_TOP); + group->addChild(text); + } + + viewer.setSceneData(group.get()); + } else if (arguments.read("--mt", numThreads) || arguments.read("--mt")) { // construct a multi-threaded text updating test.