I'm stuck in the game, I can't seem to find the red button. How do I find it? Does it have something to do with the countdown?
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menu
// 1) Create your very own module
// 2) Create your very own Gui, with any kind of control. For example:
// - a label called "MyLabel". You want to track the clicks on that one
// - another label called "StatusLine" where you want displayed the control being hovered
// 3) In your module's initialization, add this :
// StandaloneClick.RegisterControl(MyLabel, "this text will appear when the label is hovered");
// 4) In your module's repeatedly_execute_always(), add this:
// if (StandaloneClick.ClickDetected(eMouseLeft)) {
// GUIControl* c = StandaloneClick.GetClick(eMouseLeft);
// if (c==MyLabel)
// Display("you clicked on MyLabel with the left mouse button");
// }
//
// StatusLine.Text = StandaloneClick.GetHoveredText();
//
// 5) Run the game. Click on your label, and move your mouse over it.
[color=green]// AGS does not provide the height (in pixels) of a listbox row.
// The height depends purely on the font's height.
// Yet, one cannot access that info either, using scripting only
// (even with GetTextHeight, because you'd need to know in advance the height
// of the tallest character in the entire font, I suppose).
// Hence, this function. It's a MASSIVE HACK
//
// IMPORTANT NOTE: this function can make the game crash because of a bug in AGS' ListBox
// coding. See http://www.adventuregamestudio.co.uk/forums/index.php?topic=48793.msg636466821#msg636466821
// To work around this, you must never call this function before the ListBox has been
// painted at least once.
// This function works with a struct similar to this :
// struct ExtendedListboxType {
// ListBox* Box;
// int rowHeight
// };
//
// ExtendedListboxType TextAreas[10];
//
[/color]
int TextAreaType::GetRowHeight()
{
if (this.rowHeight!=0) //We do it only once, but it must be done after game_start
//or more generally after the box's first painting
return this.rowHeight;
else
{
ListBox* b = this.Box; //for convenience
b.Clear();
b.AddItem("0000000000000000000000000000000");
b.AddItem("1111111111111111111111111111111");
int i=0;
int start_x=b.X+b.OwningGUI.X+1;
int start_y=b.Y+b.OwningGUI.Y;
int lastItem;
lastItem=b.GetItemAtLocation(start_x, start_y+i);
while (i<30) //we assume the characters are not higher than 30 pix high
{
int item = b.GetItemAtLocation(start_x, start_y+i);
if (lastItem != item && item != -1)
{
b.Clear();
this.rowHeight = i;
return i;
}
lastItem=item;
i++;
}
Display("WARNING: could not find height of text area rows. The cursor might be off, or maybe your font is taller than 30 pixels?");
b.Clear();
this.rowHeight = 10; //arbitrary value
return this.rowHeight;
}
}
int key;
...
Display(String.Format("key=%d", key)); //DEBUG
if (key == 91) //'['
text = text.AppendChar(92);
import void AddItem_Safe(ListBox* this, String item);
void AddItem_Safe(ListBox* this, String item)
{
this.AddItem(item);
}
void WrapLine(ListBox* lstBox, String desc)
{
String buffer = "";
lstBox.AddItem_Safe(buffer);
}
By continuing to use this site you agree to the use of cookies. Please visit this page to see exactly how we use these.
Page created in 0.232 seconds with 15 queries.