コード例 #1
0
 public ButtonHover(DrawableRectangle rectangle, Texture2D white_pixel, SpriteFont tooltip_font, string tooltip_text)
 {
     button_hover = new DrawableRectangle(rectangle.texture, rectangle.Area, Color.White * 0.5f);
     this.tooltip_font = tooltip_font;
     this.tooltip_text = tooltip_text;
     Vector2 tooltip_text_size = tooltip_font.MeasureString(tooltip_text);
     Rectangle tooltip_rect = new Rectangle(0, button_hover.Area.Y, (int)Math.Ceiling(tooltip_text_size.X), (int)Math.Ceiling(tooltip_text_size.Y));
     tooltip_rect = tooltip_rect.LeftAlignOn(button_hover.Area).OffsetBy(0, -1 * tooltip_rect.Height - 6);
     tooltip_text_position = tooltip_rect.GetPosition();
     tooltip_rect = tooltip_rect.BufferBy(8);
     tooltip_box = new DrawableRectangle(white_pixel, tooltip_rect, Color.White, 2, Color.Black);
 }