Changing Font Sizes in Game
by Academy of Interactive Ent. (#00 · in Torque Game Engine · 08/18/2008 (4:44 pm) · 1 replies
Ok so i have created my own profile and it has the differing size depending on the size of the screen.
fontSize = (20 * (getWord($pref::Video::resolution, 0) / 640));
The problem is all the objects are created at the start of the game and when you change the screen size in the middle of the game, the text labels still same the same size as the start of the game and so if you jump from 1024 to 640 the text is MASSIVE and off the screen!!!
i was just wondering if there is any way to get it so the objects create themselves again everytime it's window is called up. i tried using simgroups but adding one of the objects to it just removed it from the screen and didn't recreate it when we reopened the screen.
Please HELP!!!!
fontSize = (20 * (getWord($pref::Video::resolution, 0) / 640));
The problem is all the objects are created at the start of the game and when you change the screen size in the middle of the game, the text labels still same the same size as the start of the game and so if you jump from 1024 to 640 the text is MASSIVE and off the screen!!!
i was just wondering if there is any way to get it so the objects create themselves again everytime it's window is called up. i tried using simgroups but adding one of the objects to it just removed it from the screen and didn't recreate it when we reopened the screen.
Please HELP!!!!
Torque Owner Mathew Williams
function CalcFontSize(%size)
{
return (%size * (getWord($pref::Video::resolution, 0) / 640));
}
new SimSet(GUIObjects);
myprofile
{
baseFontSize = 20;
fontSize = calcFontSize(20);
}
GUIOBjects.add(myProfile);
//on resolution change
for(%i = 0; %i < GUIObjects.getCount(); %i++)
{
%profile = GUIObjects.getObject(%i);
%profile.fontSize = calcFontSize(%profile.baseFontSize);
}