Code archives/3D Graphics - Misc/LabelEntity (camera, entity, text$)
This code has been declared by its author to be Public Domain code.
Download source code
| |||||
Does what it says on the box! Call it just before Flip (), supplying the camera you're using, the entity, and the text you want... Mostly for debugging purposes, or picking up the 3D to 2D projection method from... | |||||
Function LabelEntity (camera, entity, label$) If EntityInView (entity, camera) CameraProject camera, EntityX (entity), EntityY (entity), EntityZ (entity) w = StringWidth (label$) h = StringHeight (label$) x = ProjectedX () - (w / 2) - 1 y = ProjectedY () - (h / 2) - 1 Color 0, 0, 0 Rect x, y, w + 2, h + 2, 1 Color 255, 255, 255 Text x, y, label$ EndIf End Function |
Comments
| ||
Like in the MMORPG games where everyones name is over their head... or could you sunstitute a rectangle showing how much life they have left... Hmmm... -RZ |
Code Archives Forum