/// <summary> Called when user has moved their mouse over a given widget. </summary> protected virtual void SelectWidget(LauncherWidget widget) { LauncherButtonWidget button = widget as LauncherButtonWidget; if (button != null) { button.Active = true; button.Redraw(drawer, button.Text, buttonFont); Dirty = true; } }
protected void MakeButtonAt(string text, int width, int height, Font font, Anchor horAnchor, Anchor verAnchor, int x, int y, Action <int, int> onClick) { if (widgets[widgetIndex] != null) { LauncherButtonWidget button = (LauncherButtonWidget)widgets[widgetIndex]; button.Active = false; button.DrawAt(drawer, text, font, horAnchor, verAnchor, width, height, x, y); widgetIndex++; return; } LauncherButtonWidget widget = new LauncherButtonWidget(game); widget.Text = text; widget.OnClick = onClick; widget.Active = false; widget.DrawAt(drawer, text, font, horAnchor, verAnchor, width, height, x, y); widgets[widgetIndex++] = widget; }
protected void MakeButtonAt( string text, int width, int height, Font font, Anchor verAnchor, int x, int y, Action<int, int> onClick) { if( widgets[widgetIndex] != null ) { LauncherButtonWidget input = (LauncherButtonWidget)widgets[widgetIndex]; input.Active = false; input.DrawAt( drawer, text, font, Anchor.Centre, verAnchor, width, height, x, y ); widgetIndex++; return; } LauncherButtonWidget widget = new LauncherButtonWidget( game ); widget.Text = text; widget.OnClick = onClick; widget.Active = false; widget.DrawAt( drawer, text, font, Anchor.Centre, verAnchor, width, height, x, y ); widgets[widgetIndex++] = widget; }
void MakeButtonAt( string text, Anchor horAnchor, Anchor verAnchor, int width, int height, int x, int y, Action<int, int> onClick) { LauncherButtonWidget widget = new LauncherButtonWidget( game ); widget.Text = text; widget.OnClick = onClick; widget.Active = false; widget.DrawAt( drawer, text, textFont, horAnchor, verAnchor, width, height, x, y ); widgets[widgetIndex++] = widget; }