how to scale some text

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
dujimache
Posts: 24
Joined: Mon Aug 03, 2009 3:22 am

how to scale some text

Post by dujimache »

smgr:addTextSceneNode(font,"i have a dream,one day i have a car!",render.video.SColor(255,0,255,255),0,render.core.vector3d(0,30,-500))
i add some text in the scene,and i want to scale them,how???
lulzfish
Posts: 34
Joined: Sat Aug 15, 2009 8:19 pm

Post by lulzfish »

If it's a scene node, you should be able to do something like this:

Code: Select all

ITextSceneNode * text = smgr->addTextSceneNode (font, "blah", SColor (255, 0, 255, 255), 0, vector3df (0, 30, -500));
text->setScale (vector3df (10, 10, 10));
So, the ITextSceneNode should have a member function named setScale. You seem to be using a different language than C/C++, though, so I'm not sure how it will translate.

edit: Yeah, I don't know Lua, sorry. :/
Last edited by lulzfish on Thu Aug 20, 2009 2:41 am, edited 1 time in total.
Is the somber dream of the Grim Reaper a shade Darker Than Black?
dujimache
Posts: 24
Joined: Mon Aug 03, 2009 3:22 am

Post by dujimache »

i use irrlua ,and i tried your method,but it did't work,thank you
Arclamp
Posts: 71
Joined: Thu Oct 10, 2013 7:45 pm

Re: how to scale some text

Post by Arclamp »

This node doesn't scale! It uses something like a static text to overlay text, so the size is dependent on the actual font size, it also draws on top of all other geometry too (like a gui element does)
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: how to scale some text

Post by Mel »

You need a larger font to render larger texts, that, until Irrlicht implements signed distance field font rendering, which is shader dependant, but also able to scale bitmap fonts with vector-like quality. I guess the SDF rendering is overkill, but allows free scaling of fonts

https://www.youtube.com/watch?v=CGZRHJvJYIg
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: how to scale some text

Post by CuteAlien »

IBillboardTextSceneNode can do some zoom (but it's not resizing the font, but zooming the bitmap). ITextSceneNode can't.

One other solution: Create fonts with different sizes and switch between them.

Or check font-wrappers for ttf like the CGUIFont classes here: https://bitbucket.org/mzeilfelder/irr-p ... -micha/src (wrapper is based on some other ttf code wrapper in forum: http://irrlicht.sourceforge.net/forum/v ... =6&t=37296). Thought not sure how to use that with irrlua as I'm not familiar with that.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply