Hey Everyone! I have a question to ask: I’m currently tying to detect when the mouse cursor crosses over a string of text from an array of items in an inventory. Attached is an example image to help illustrate what I’m trying to accomplish. I’m not using scaleform because I do not wish to buy flash and learn/use different programs, cross integrate, ETC (RIP UTUISCENE). The goal is to be able to select one of those strings (that is dynamically generated in a for loop) and apply its properties to the ship I’m flying after clicking on it. I used to work on this (for UT3, NOT UDK):
Unfortunately I went through a divorce (we are amicable and civil towards eachother) that really got to me and lost a lot of the assets I used do to an HDD failure. Anyway, I have managed to recover most (if not all) of the assets I am using. How Would I be able to go about doing this? Here is a code snippet:
EDIT: I managed to get it to work. Giving back to the community, here is a code snippet:
/**
* Render the scene
*
* @param Canvas - the canvas object for drawing
*/
function RenderScene(Ace_Player_Controller myController,
Ace_PlayerInput myPlayerInput,
int ScreenWidth,
int ScreenHeight,
Optional Float CPx,
Optional Float CPy,
Optional Canvas Canvas,
optional array<GearUpgrade> StdUpgrades,
optional array<GearUpgrade> AdvUpgrades,
optional array<GearUpgrade> Logos,
optional Ace_Hud myHud,
optional bool bClicked)
{
local int i;
Local Float sx, sy, Length1, Length2 ,bx,by;
Local vector2d CategoryLengthStd, CategoryLengthAdv, LogoLength;
Local String Std, Adv, Logo;
Local Float Newx, NewY;
Std = "-------------================= Standard Weapons =================-------------";
Adv = "-------------================= Advanced Weapons =================-------------";
Logo = "-------------================= Logos Available =================-------------";
Canvas.TextSize(Std,CategoryLengthStd.X,CategoryLengthStd.Y);
Canvas.TextSize(Adv,CategoryLengthAdv.X,CategoryLengthAdv.Y);
Canvas.TextSize(Logo,LogoLength.X,LogoLength.Y);
//First, Draw My Category of Std weapons
Canvas.DrawColor = WhiteColor;
Canvas.SetPos(0,0);
Canvas.DrawText(Std);
For(i = 0; i < StdUpgrades.Length; i++) //Std Weapons For Loop
{
Canvas.TextSize(StdUpgrades*.FriendlyName, sx, sy);
if( ((CPX >= 0) && (CPX <= sx) && (CPY > CategoryLengthStd.Y+sy*i) && (CPY < CategoryLengthStd.Y + sy*(i+1))) )
{
Canvas.Setpos(0,CategoryLengthStd.Y+sy*i);
Canvas.DrawColor=LightGoldColor;
Canvas.DrawText(StdUpgrades*.FriendlyName);
Canvas.SetPos(sx + 100,CategoryLengthStd.Y + sy*i);
Canvas.DrawText(StdUpgrades*.Description);
if(bClicked==true)
myController.myManager.ApplyUpgrade(StdUpgrades*);
}
Else
{
Canvas.Setpos(0,CategoryLengthStd.Y+sy*i);
Canvas.DrawColor = WhiteColor;
Canvas.DrawText(StdUpgrades*.FriendlyName);
}
}
NewY = StdUpgrades.Length*sy + CategoryLengthStd.Y + CategoryLengthAdv.Y;
Canvas.SetPos(0,NewY);
Canvas.DrawText(Adv);
For(i = 0; i < AdvUpgrades.Length; i++) //Adv Weapons For Loop
{
Canvas.TextSize(AdvUpgrades*.FriendlyName, Length1, Length2);
if( ((CPX >= 0) && (CPX <= Length1) && (CPY > Length2*i + NewY + CategoryLengthAdv.Y) && (CPY < NewY + Length2*(i+1)+ CategoryLengthAdv.Y)) )
{
Canvas.Setpos(0,NewY+Length2*i + CategoryLengthAdv.y);
Canvas.DrawColor=LightGoldColor;
Canvas.DrawText(AdvUpgrades*.FriendlyName);
Canvas.SetPos(sx + 100,NewY + Length2*i + CategoryLengthAdv.y);
Canvas.DrawText(AdvUpgrades*.Description);
if(bClicked==true)
myController.myManager.ApplyUpgrade(AdvUpgrades*);
}
Else
{
Canvas.Setpos(0,NewY+Length2*i + CategoryLengthAdv.y);
Canvas.DrawColor = WhiteColor;
Canvas.DrawText(AdvUpgrades*.FriendlyName);
}
}
NewY = NewY + AdvUpgrades.Length * Length2 + CategoryLengthAdv.y + LogoLength.Y;
Canvas.SetPos(0,NewY);
Canvas.DrawText(Logo);
For(i = 0; i < Logos.Length; i++) //Logos For Loop
{
Canvas.TextSize(Logos*.FriendlyName, bx, by);
if( ((CPX >= 0) && (CPX <= bx) && (CPY > NewY+by*i+ LogoLength.Y) && (CPY < NewY + LogoLength.Y+ by*(i+1))) )
{
Canvas.Setpos(0,NewY+by*i+ LogoLength.Y);
Canvas.DrawColor=LightGoldColor;
Canvas.DrawText(Logos*.FriendlyName);
Canvas.SetPos(bx + 100, NewY + by*i+ LogoLength.Y);
Canvas.DrawText(Logos*.Description);
if(bClicked==true)
myController.myManager.ApplyUpgrade(Logos*);
}
Else
{
Canvas.Setpos(0,NewY+by*i+ LogoLength.Y);
Canvas.DrawColor = WhiteColor;
Canvas.DrawText(Logos*.FriendlyName);
}
}
}
To see it in action: