Skip to main content

History: MovableTextOverlay

Source of version: 1

Copy to clipboard
            !!Introduction
I started from ((ObjectTextDisplay|Xavier's ObjectTextDisplay)) example and eventually came up with these three classes, that do all the Text ((Overlay)) positioning for you.

The MovableTextOverlay class takes an Ogre ((MovableObject)), an Ogre String and a MovableTextOverlayAttributes pointer and 
makes your text moves with the Object on the screen, displaying it centered above the object (((HUD)) / heads up display).

The MovableTextOverlayAttributes contain all the ((Font)) / ((Material] / Colour Overlay attributes. I put them into a separate class with the intention of creating "groups" of MovableTextOverlay objects that share same "attributes".

The RectLayoutManager class is generic. It manages a list of non-overlapping rectangles within certain bounds. To find a non-overlapping position for a certain rectangle, it translates the rectangle on the Y axis until it finds a suitable position. I tried to optimise this class for speed as much as I could, any ideas are welcome.

ÿ9ÿThe Codeÿ10ÿ


ÿ11ÿMovableTextOverlay.hÿ12ÿ


ÿ0ÿ

ÿ13ÿMovableTextOverlay.cppÿ14ÿ


ÿ1ÿ

ÿ15ÿRectLayoutManager.hÿ16ÿ


ÿ2ÿ

ÿ17ÿHow to use itÿ18ÿ


Add a global vector to hold your MovableTextOverlay pointers

ÿ3ÿ

'''In your createScene'''

ÿ4ÿ

'''In your frameStarted'''

ÿ5ÿ

'''Media'''

ÿ6ÿ

ÿ19ÿHow it looks likeÿ20ÿ


[[Image:Robots.jpg))

((Category:Code Snippet))


        

History

Information Version
Wed 24 of Feb, 2016 14:39 GMT-0000 madmage 8
Wed 24 of Feb, 2016 14:37 GMT-0000 madmage 7
Wed 13 of Jun, 2012 14:30 GMT-0000 Shinigami Added some "std::"s for the vectors and list, replaced myMap with the given myVect variable to allow for "copy&paste" 6
Wed 08 of Dec, 2010 13:49 GMT-0000 sarcacid fixed lexicon links, moved section header 5
Thu 29 of Jul, 2010 11:10 GMT-0000 Beauty moved example picture to top 4
Sat 02 of Jan, 2010 05:41 GMT-0000 jacmoe 3
Thu 24 of Dec, 2009 18:11 GMT-0000 jacmoe 2
Wed 01 of Apr, 2009 13:54 GMT-0000 Spacegaier some smaller updates / corrections 1