Exemplo n.º 1
0
        public override void Draw(RenderTarget rt)
        {
            RectangleShape numberbox = new RectangleShape(Size)
            {
                Position  = Position,
                FillColor = Color.Black,
            };

            rt.Draw(numberbox);

            if (mouseIn)
            {
                RectangleShape checkboxHover = new RectangleShape(new Vector2f(64.0f - 8.0f, 48.0f - 8.0f))
                {
                    Position         = Position + new Vector2f(4f, 4f),
                    FillColor        = Color.Black,
                    OutlineColor     = Color.White,
                    OutlineThickness = 2f
                };

                rt.Draw(checkboxHover);
            }

            Text valueText = new Text(stringValue, Assets.LoadFont(Program.DefaultFont))
            {
                Position      = Position + new Vector2f(8.0f, 8.0f),
                CharacterSize = 28,
                Color         = Color.White
            };

            valueText.Round();
            rt.Draw(valueText);

            if (Selected && cursorVisible)
            {
                RectangleShape cursor = new RectangleShape(new Vector2f(2.0f, Size.Y - 16.0f))
                {
                    Position  = Position + new Vector2f(valueText.GetWidth() + 8.0f + 2.0f, 8.0f),
                    FillColor = Color.White
                };

                cursor.Round();
                rt.Draw(cursor);
            }

            Text labelText = new Text(label, Assets.LoadFont(Program.DefaultFont))
            {
                Position      = Position + new Vector2f(64.0f + 16.0f, 24.0f + 2.0f),
                CharacterSize = 32,
                Color         = Color.Black
            };

            labelText.Center(false);
            labelText.Round();
            rt.Draw(labelText);
        }
Exemplo n.º 2
0
        public override void Draw(RenderTarget rt)
        {
            RectangleShape barArea = new RectangleShape(Size)
            {
                Position  = Position,
                FillColor = Color.Black
            };

            rt.Draw(barArea);

            Text labelText = new Text(label, Assets.LoadFont(Program.DefaultFont))
            {
                Position      = Position + new Vector2f(16.0f, -24.0f),
                CharacterSize = 18,
                Color         = Color.Black
            };

            labelText.Round();
            rt.Draw(labelText);

            Text messageText = new Text(Value, Assets.LoadFont(Program.DefaultFont))
            {
                Position      = Position + new Vector2f(8.0f, 8.0f),
                CharacterSize = 28,
                Color         = Color.White
            };

            messageText.Round();
            rt.Draw(messageText);

            if (Selected && cursorVisible)
            {
                RectangleShape cursor = new RectangleShape(new Vector2f(2.0f, Size.Y - 16.0f))
                {
                    Position  = Position + new Vector2f(messageText.GetWidth() + 8.0f + 2.0f, 8.0f),
                    FillColor = Color.White
                };

                cursor.Round();
                rt.Draw(cursor);
            }

            base.Draw(rt);
        }
Exemplo n.º 3
0
        public override void Draw(RenderTarget rt)
        {
            // Display connecting message if needed
            if (!Client.Connected)
            {
                RectangleShape bgShape = new RectangleShape(new Vector2f(GameOptions.Width, GameOptions.Height))
                {
                    FillColor = Color.Black
                };
                rt.Draw(bgShape);

                Text waitingText = new Text("Connecting", Assets.LoadFont(Program.DefaultFont))
                {
                    Position      = new Vector2f(GameOptions.Width / 2.0f, GameOptions.Height / 2.0f),
                    CharacterSize = 48,
                    Color         = Color.White
                };

                waitingText.Center();
                waitingText.Round();

                rt.Draw(waitingText);

                return;
            }

            // Draw lobby text
            Text lobbyText = new Text("Lobby", Assets.LoadFont(Program.DefaultFont))
            {
                Position      = new Vector2f(GameOptions.Width / 2.0f, 48.0f),
                CharacterSize = 48,
                Color         = Color.Black
            };

            lobbyText.Center();
            lobbyText.Round();

            rt.Draw(lobbyText);

            // Draw chat area
            RectangleShape chatArea = new RectangleShape(
                new Vector2f((GameOptions.Width / 3.0f) * 2.0f - 64.0f, (GameOptions.Height / 3.0f) * 2.0f + 64.0f))
            {
                Position  = new Vector2f(GameOptions.Width / 3.0f, GameOptions.Height / 3.0f - 128.0f),
                FillColor = new Color(96, 96, 96, 255)
            };

            rt.Draw(chatArea);

            RectangleShape chatBarArea = new RectangleShape(new Vector2f((GameOptions.Width / 3.0f) * 2.0f - 64.0f, 48.0f))
            {
                Position  = new Vector2f(GameOptions.Width / 3.0f, GameOptions.Height - 64.0f - 48.0f),
                FillColor = Color.Black
            };

            rt.Draw(chatBarArea);

            Text messageText = new Text(chatValue, Assets.LoadFont(Program.DefaultFont))
            {
                Position =
                    new Vector2f(GameOptions.Width / 3.0f + 8.0f, GameOptions.Height - 64.0f - 48.0f + 8.0f + 4.0f),
                CharacterSize = 22,
                Color         = Color.White
            };

            messageText.Round();
            rt.Draw(messageText);

            if (cursorVisible)
            {
                RectangleShape cursor = new RectangleShape(new Vector2f(2.0f, 24.0f))
                {
                    Position  = messageText.Position + new Vector2f(messageText.GetWidth() + 2.0f, 2.0f),
                    FillColor = Color.White
                };

                cursor.Round();
                rt.Draw(cursor);
            }

            // Draw chat backlog
            float y = 0.0f;

            for (int i = ChatBacklog.Count - 1; i > ChatBacklog.Count - ChatBacklogItems && i != -1; --i)
            {
                Text itemText = GameUtility.Wrap(ChatBacklog[i], Assets.LoadFont(Program.DefaultFont), 22,
                                                 (GameOptions.Width / 3.0f) * 2.0f - 64.0f - 32.0f - 48.0f, false);

                y -= 24.0f * itemText.DisplayedString.Count(c => c == '\n');
                itemText.Position = new Vector2f((float)Math.Floor(GameOptions.Width / 3.0f + 8.0f), GameOptions.Height - 144.0f + y + 24.0f);
                itemText.Color    = Color.White;

                rt.Draw(itemText);
            }

            base.Draw(rt);
        }
Exemplo n.º 4
0
        public override void Draw(RenderTarget rt)
        {
            // Outline
            rt.Draw(new RectangleShape(new Vector2f(GameOptions.Width - 16, GameOptions.Height - 16))
            {
                Position         = new Vector2f(8, 8),
                OutlineColor     = Color.Black,
                FillColor        = Color.White,
                OutlineThickness = 8
            });

            // Draw chat backlog
            float y = 0.0f;

            for (int i = ChatBacklog.Count - 1; i > ChatBacklog.Count - ChatBacklogItems && i != -1; --i)
            {
                Text itemText = GameUtility.Wrap(ChatBacklog[i], Assets.LoadFont(Program.DefaultFont), 18,
                                                 GameOptions.Width / 3.0f, false);

                y -= 20.0f * itemText.DisplayedString.Count(c => c == '\n');
                itemText.Position = new Vector2f(16.0f, GameOptions.Height - 226.0f - 24.0f - 24.0f + y + 24.0f);
                itemText.Color    = new Color(128, 128, 128);

                rt.Draw(itemText);
            }

            Text chatMessageText = new Text(chatValue, Assets.LoadFont(Program.DefaultFont))
            {
                Position      = new Vector2f(8.0f + 6.0f, GameOptions.Height - 220.0f - 24.0f),
                Color         = Color.Black,
                CharacterSize = 22
            };

            rt.Draw(chatMessageText);

            if (cursorVisible)
            {
                RectangleShape cursor = new RectangleShape(new Vector2f(2.0f, 24.0f))
                {
                    Position  = chatMessageText.Position + new Vector2f(chatMessageText.GetWidth() + 2.0f, 2.0f),
                    FillColor = Color.Black
                };

                cursor.Round();
                rt.Draw(cursor);
            }

            // White card table
            rt.Draw(new RectangleShape(new Vector2f(1264.0f, 202.0f))
            {
                Position  = new Vector2f(8.0f, GameOptions.Height - 194.0f - 16.0f),
                FillColor = Color.Black
            });

            // Timer table
            rt.Draw(new RectangleShape(new Vector2f(256.0f, 63.0f))
            {
                Position  = new Vector2f(GameOptions.Width - 256.0f - 8.0f, 8.0f),
                FillColor = Color.Black
            });

            // Table border
            rt.Draw(new RectangleShape(new Vector2f(8.0f, 502.0f))
            {
                Position  = new Vector2f(GameOptions.Width - 256.0f - 8.0f, 8.0f),
                FillColor = Color.Black
            });

            // Timer text
            string timerValue = String.Format("{0}:{1}", (Client.SecondsLeft / 60).ToString("D"),
                                              (Client.SecondsLeft % 60).ToString("D").PadLeft(2, '0'));
            Text text = new Text(timerValue, Assets.LoadFont("QuartzMS.ttf"))
            {
                Position      = new Vector2f(GameOptions.Width - 128.0f - 8.0f, 40.0f),
                Color         = Color.White,
                CharacterSize = 48
            };

            text.Center();
            text.Round();
            rt.Draw(text);

            // Draw decks
            rt.Draw(new Sprite(Assets.LoadTexture("Decks.png"))
            {
                Position = new Vector2f(GameOptions.Width / 2.0f - 31.0f - 128.0f - 70.0f, GameOptions.Height / 2.0f - 44.0f - 89.0f - 22.0f)
            });

            base.Draw(rt);
        }