/** Creates a new notification with given text and optional graphic */ public GuiNotification(string content, Sprite sprite = null) : base(260, 60) { Stage = NotificationStage.AnimateOn; stageLife = AnimationDuration; Color = new Color(0.2f, 0.2f, 0.2f); text = new GuiLabel(content); text.AutoHeight = false; text.AutoWidth = false; text.X = 5; text.Y = 5; text.Width = (int)ContentsBounds.width - 10; text.Height = (int)ContentsBounds.height - 10; text.FontSize = 12; text.WordWrap = true; text.TextAlign = TextAnchor.MiddleLeft; Add(text); OuterShadow = true; if (sprite != null) { image = new GuiImage(3, 3, sprite); image.Scale = (Height - 10) / sprite.rect.height; text.X = 60; text.Width = (int)ContentsBounds.width - text.X - 5; var frame = new GuiFillRect(1, 1, image.Width + 4, image.Height + 4, Color.black.Faded(0.50f)); Add(frame); Add(image); var shadow = new GuiFrameRect(3, 3, image.Width, image.Height, Color.black.Faded(0.5f)); Add(shadow); } }
/** Creates a new game state. To be made active it must be pushed to the top of the game state stack (Game.push(x)) */ public ModalState(string title) : base(title) { TransparentDraw = true; GuiFillRect background = new GuiFillRect(0, 0, 0, 0, new Color(0.0f, 0.0f, 0.0f, 0.75f)); background.Align = GuiAlignment.Full; Window = new GuiWindow(400, 400, title); Window.Background.Color = Color.gray; Add(background); Add(Window, 0, 0, true); }