GuiMLTextCtrl
by Pedro Vicente · in iTorque 2D · 08/17/2011 (10:17 am) · 8 replies
Can anyone provide some links/source code on how to use GuiMLTextCtrl?
#2
Thanks.
FYI, you can use MarkupLite tags like this
[url.] my url [/url.] (remove the "." )
08/17/2011 (12:27 pm)
@PeterThanks.
FYI, you can use MarkupLite tags like this
[url.] my url [/url.] (remove the "." )
#3
*Problem* is, if I call the TextGUI object, the SceneObject in the code (a button) does not respond. Bug or user error?
08/17/2011 (12:30 pm)
I came up with this code. It displays the text. *Problem* is, if I call the TextGUI object, the SceneObject in the code (a button) does not respond. Bug or user error?
// .......................................................................................
if ( !isObject( GuiMLTextProfile )) new GuiControlProfile( GuiMLTextProfile )
{
fontType = "Arial Black";
fontSize = 72;
fontColor = "255 0 0";
autoSizeWidth = true;
autoSizeHeight = true;
border = false;
justify = "center";
};
// .....................................................................................
function CreditsSceneGraph::OnAdd(%this)
{
%this.CreateBackground();
%this.CreateGuiText();
%this.x_button_1 = 0;
%this.y_button_1 = $model.y_bottom;
CreateButton( %this, "ButtonGoHome", "ButtonHomeImageMap", %this.x_button_1, %this.y_button_1, 64,64);
}
// .....................................................................................
function CreditsSceneGraph::CreateBackground( %this )
{
%obj = new t2dStaticSprite()
{
scenegraph = %this;
};
%obj.setVisible( true );
%obj.setLayer( 20 );
%obj.setImageMap( "MenuImageMap" );
%obj.setSize( 768, 1024 );
}
// .....................................................................................
function CreditsSceneGraph::CreateGuiText( %this )
{
%extent = $model.x_screen_size @ " " @ $model.y_screen_size;
%text = "<just:center>Credits" @ "<br><br><br> Art:<br> Me <br><br> Lead Programmer:<br> You";
%this.GuiTextCredits = new GuiMLTextCtrl()
{
canSaveDynamicFields = "0";
Profile = "GuiMLTextProfile";
HorizSizing = "width";
VertSizing = "height";
Position = "0 0";
Extent = %extent;
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
lineSpacing = "2";
allowColorChars = "0";
maxChars = "-1";
};
%this.GuiTextCredits.SetText( %text );
canvas.pushDialog( %this.GuiTextCredits );
}
#5
Thanks, but the same still happens.
I have this console error
08/17/2011 (1:44 pm)
@JohnnyThanks, but the same still happens.
I have this console error
Quote:Failed to load profile bitmap ()
#6
08/17/2011 (5:40 pm)
Just a thought but could the button be loading under the guitext? Like a separate dialog?
#7
I tried
but nothing changed.

Too bad, since the HTML like syntax for the text is really neat.
Well, some documentation digging follows.
08/17/2011 (5:48 pm)
@Peter.I tried
Position = "0 0"; Extent = "100 100";
but nothing changed.

Too bad, since the HTML like syntax for the text is really neat.
Well, some documentation digging follows.
#8
complete code
08/28/2011 (1:45 pm)
I solved this by creating an extra GuiControl instance and by adding the GuiMLTextCtrl to it; complete code
if(!isObject(GuiModelessDialogProfile)) new GuiControlProfile("GuiModelessDialogProfile")
{
modal = false;
};
if ( !isObject( GuiMLTextProfile )) new GuiControlProfile( "GuiMLTextProfile" )
{
fontType = "Times New Roman Bold";
fontSize = 48;
fontColor = "255 0 0";
autoSizeWidth = true;
autoSizeHeight = true;
border = false;
justify = "center";
modal = false;
};
// .....................................................................................
function SceneGraphLevel_02::OnAdd(%this)
{
CreateBackground( %this );
CreateButton( %this, "ButtonHome", "ButtonHomeImageMap", 0, 170, 128, 128);
%this.CreateGuiText();
}
// .....................................................................................
function SceneGraphLevel_02::onLevelEnded(%this)
{
%this.clearScene();
%this.GuiTextCredits.delete();
}
// .....................................................................................
function SceneGraphLevel_02::CreateGuiText( %this )
{
%text = "<just:center><br>I am<br>in level 2";
%this.guiOverlay = new GuiControl()
{
canSaveDynamicFields = "0";
Profile = "GuiModelessDialogProfile";
HorizSizing = "left";
VertSizing = "right";
Position = "0 0";
Extent = "320 320";
MinExtent = "8 8";
canSave = "1";
Visible = "1";
hovertime = "1000";
};
%this.GuiTextCredits = new GuiMLTextCtrl()
{
canSaveDynamicFields = "0";
Profile = "GuiMLTextProfile";
HorizSizing = "width";
VertSizing = "height";
Position = "0 0";
Extent = "320 320";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
lineSpacing = "2";
allowColorChars = "0";
maxChars = "-1";
};
%this.GuiTextCredits.SetText( %text );
%this.guiOverlay.addGuiControl( %this.GuiTextCredits );
canvas.pushDialog( %this.guiOverlay );
}
Torque Owner Peter K
--
It listed about 2/3 of the way down on this page.
http://tdn.garagegames.com/wiki/GUI/Profiles/ControlList
and this page has an examle
http://tdn.garagegames.com/wiki/TGB_GUI_Overview