protected void RedrawAllButtonBackgrounds() { int buttons = 0; for (int i = 0; i < widgets.Length; i++) { if (widgets[i] == null || !(widgets[i] is LauncherButtonWidget)) { continue; } buttons++; } if (buttons == 0) { return; } using (FastBitmap dst = new FastBitmap(game.Framebuffer, true)) { for (int i = 0; i < widgets.Length; i++) { if (widgets[i] == null) { continue; } LauncherButtonWidget button = widgets[i] as LauncherButtonWidget; if (button != null) { button.RedrawBackground(dst); } } } }
/// <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.RedrawBackground(); using ( drawer ) { drawer.SetBitmap(game.Framebuffer); button.Redraw(drawer); } 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) { LauncherButtonWidget widget; if (widgets[widgetIndex] != null) { widget = (LauncherButtonWidget)widgets[widgetIndex]; } else { widget = new LauncherButtonWidget(game); widget.Text = text; widget.OnClick = onClick; widgets[widgetIndex] = widget; } widget.Active = false; widget.SetDrawData(drawer, text, font, horAnchor, verAnchor, width, height, x, y); widgetIndex++; }
protected void MakeButtonAt( string text, int width, int height, Font font, Anchor horAnchor, Anchor verAnchor, int x, int y, Action<int, int> onClick) { LauncherButtonWidget widget; if( widgets[widgetIndex] != null ) { widget = (LauncherButtonWidget)widgets[widgetIndex]; } else { widget = new LauncherButtonWidget( game ); widget.Text = text; widget.OnClick = onClick; widgets[widgetIndex] = widget; } widget.Active = false; widget.SetDrawData( drawer, text, font, horAnchor, verAnchor, width, height, x, y ); widgetIndex++; }