public UIMessageBox( String message, String title, bool closeButton = true ) : base( new Vector2( 480, 64 ) ) { CanClose = closeButton; _centreText = false; Title = title; _text = new UILabel( Zombles.Graphics.PixelFont.Large ) { Text = message, Position = new Vector2( 4, 4 ) }; AddChild( _text ); }
public UIButton(Vector2 size, Vector2 position, float scale = 1.0f) : base(size, position) { Colour = Color4.White; PaddingLeft = PaddingTop = PaddingRight = PaddingBottom = 4.0f * scale; _buttonSprite = new FrameSprite(PanelsTexture, scale) { SubrectSize = new Vector2(16, 16), SubrectOffset = new Vector2(32, 16), FrameTopLeftOffet = new Vector2(4, 4), FrameBottomRightOffet = new Vector2(4, 4), Size = size }; _label = new UILabel(PixelFont.Large, scale); AddChild(_label); }
public UITextBox(Vector2 size, Vector2 position, float scale = 1.0f) : base(size, position) { PaddingLeft = PaddingTop = PaddingRight = PaddingBottom = 4.0f * scale; _sprite = new FrameSprite(PanelsTexture, scale) { SubrectSize = new Vector2(16, 16), SubrectOffset = new Vector2(0, 32), FrameTopLeftOffet = new Vector2(4, 4), FrameBottomRightOffet = new Vector2(4, 4), Size = size }; _font = PixelFont.Large; _text = new UILabel(_font, scale); AddChild(_text); CharacterLimit = (int) (InnerWidth / (_font.CharWidth * scale)); _underlineChar = new Sprite(scale * _font.CharWidth, scale * 2.0f, OpenTK.Graphics.Color4.Black); }
public UIWindow(Vector2 size, Vector2 position, float scale = 1.0f) : base(size, position) { _scale = scale; PaddingLeft = 4.0f * scale; PaddingTop = 20.0f * scale; PaddingRight = 4.0f * scale; PaddingBottom = 4.0f * scale; _frameSprite = new FrameSprite(PanelsTexture, scale) { SubrectSize = new Vector2(32, 32), SubrectOffset = new Vector2(0, 0), FrameTopLeftOffet = new Vector2(4, 20), FrameBottomRightOffet = new Vector2(4, 4), Size = size }; _titleText = new UILabel(PixelFont.Large, scale) { Position = new Vector2(6 * scale - PaddingLeft, 4 * scale - PaddingTop), IsEnabled = false }; AddChild(_titleText); _closeButton = new UIWindowCloseButton(new Vector2(size.X - 18.0f * scale - PaddingLeft, 2.0f * scale - PaddingTop), scale); _closeButton.Click += delegate(object sender, OpenTK.Input.MouseButtonEventArgs e) { Close(); }; AddChild(_closeButton); CanBringToFront = true; CanClose = true; CanDrag = true; }
public override void OnEnter(bool firstTime) { base.OnEnter(firstTime); MainWindow.IsPaused = true; if (firstTime) { _filter = new UIPanel(new Vector2(Width, Height)) { Colour = new Color4(0, 0, 0, 191) }; AddChild(_filter); _worldSizeLbl = new UILabel(Graphics.PixelFont.Large) { Text = "World Size", Colour = Color4.White }; AddChild(_worldSizeLbl); _worldSizeTxt = new UINumericTextBox(new Vector2(48, 20)) { Minimum = 32, Maximum = 256, Value = 128 }; AddChild(_worldSizeTxt); _humanCountLbl = new UILabel(Graphics.PixelFont.Large) { Text = "Survivor Count", Colour = Color4.White }; AddChild(_humanCountLbl); _humanCountTxt = new UINumericTextBox(new Vector2(48, 20)) { Minimum = 0, Maximum = 512, Value = 192 }; AddChild(_humanCountTxt); _zombieCountLbl = new UILabel(Graphics.PixelFont.Large) { Text = "Zombie Count", Colour = Color4.White }; AddChild(_zombieCountLbl); _zombieCountTxt = new UINumericTextBox(new Vector2(48, 20)) { Minimum = 0, Maximum = 512, Value = 64 }; AddChild(_zombieCountTxt); _generateBtn = new UIButton(new Vector2(96, 32)) { Text = "Start New", CentreText = true }; _generateBtn.Click += (sender, e) => { if (_gameScene != null) _gameScene.Dispose(); _gameScene = new GameScene(GameWindow, this); MainWindow.SetScene(_gameScene); }; AddChild(_generateBtn); _quitBtn = new UIButton(_generateBtn.Size) { Text = "Quit", CentreText = true }; _quitBtn.Click += (sender, e) => { GameWindow.Close(); }; AddChild(_quitBtn); _continueBtn = new UIButton(new Vector2(_quitBtn.Width + _generateBtn.Width + 8, _generateBtn.Height)) { Text = "Continue", CentreText = true, IsEnabled = false }; _continueBtn.Click += (sender, e) => { MainWindow.SetScene(_gameScene); }; AddChild(_continueBtn); } RepositionElements(); _continueBtn.IsEnabled = _gameScene != null; }
public override void OnEnter(bool firstTime) { base.OnEnter(firstTime); if (firstTime) { Generator = new CityGenerator(); World = Generator.Generate(WorldSize, WorldSize); _fpsText = new UILabel(PixelFont.Large); _fpsText.Colour = Color4.White; AddChild(_fpsText); _posText = new UILabel(PixelFont.Large); _posText.Colour = Color4.White; AddChild(_posText); _infDisplay = new UIInfectionDisplay(World); AddChild(_infDisplay); PositionUI(); Camera = new OrthoCamera(Width, Height, 4.0f / _upScale); Camera.SetWrapSize(WorldSize, WorldSize); Camera.Position2D = new Vector2(WorldSize, WorldSize) / 2.0f; Camera.Pitch = TargetCameraPitch; Camera.Yaw = TargetCameraYaw; Plugin.CityGenerated(); GeoShader = new GeometryShader(); GeoShader.Camera = Camera; FlatEntShader = new FlatEntityShader(); FlatEntShader.Camera = Camera; ModelEntShader = new ModelEntityShader(); ModelEntShader.Camera = Camera; _traceShader = new DebugTraceShader(); _traceShader.Camera = Camera; _frameTimer.Start(); } }