public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, PrimitiveDrawer primitiveDrawer, FontHandler fontHandler, Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice)
        {
            String text = mode ? "True" : "False";
            Color color = !GetSelected() ? colorA : colorB;

            Rectangle numRect = this.ToRectangle();
            numRect.Width = boolWidth;

            Rectangle rect = this.ToRectangle();

            this.width = (rect.Width = (int)fontHandler.GetVerdana().MeasureString(" " + text + " ").X + 3) + boolWidth;

            rect.X += boolWidth;
            primitiveDrawer.DrawRoundedRectangle(graphicsDevice, rect, color);
            primitiveDrawer.DrawRoundedRectangle(graphicsDevice, numRect, new Color(0x3D, 0x70, 0xBC));
            Vector2 vector = this.GetVector();

            vector.X += 3;
            vector.Y += 3;

            spriteBatch.DrawString(fontHandler.GetVerdana(), " Bool ", vector + TetrisGameRunner.GetOffsetVector(), Color.White);

            vector.X += boolWidth - 3;

            spriteBatch.DrawString(fontHandler.GetVerdana(), " " + text + " ", vector + TetrisGameRunner.GetOffsetVector(), Color.White);
            spriteBatch.End();
            spriteBatch.Begin();
        }
        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, PrimitiveDrawer primitiveDrawer, FontHandler fontHandler, Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice)
        {
            if(varLink != null)
            {
                Vector2 vec = this.GetVector();
                this.varLink.SetVector(ref vec);
                this.SetWidth(varLink.GetWidth());
                this.SetHeight(varLink.GetHeight());

                varLink.Draw(spriteBatch, primitiveDrawer, fontHandler, graphicsDevice);
            }
            else
            {
                primitiveDrawer.DrawRoundedRectangle(graphicsDevice, this, colorA);
                Vector2 ve = fontHandler.GetVerdana().MeasureString(this.typeOfVariable);

                this.width = (int)ve.X + 3;
                this.height = 30;

                Vector2 vec = this.GetVector();
                vec.Y += 3;
                vec.X += 3;

                spriteBatch.DrawString(fontHandler.GetVerdana(), this.typeOfVariable, vec + TetrisGameRunner.GetOffsetVector(), Color.White);
                spriteBatch.End();
                spriteBatch.Begin();
            }
        }
Пример #3
0
        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, PrimitiveDrawer primitiveDrawer, FontHandler fontHandler, Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice)
        {
            Rectangle numRect = this.ToRectangle();
            numRect.Width = strWidth;

            Rectangle rect = this.ToRectangle();
            this.width = (rect.Width = (int)fontHandler.GetVerdana().MeasureString(" " + formatText(fontHandler) + " ").X + 3) + strWidth;
            rect.X += strWidth;

            if (this.text.Length > 0 || GetSelected())
                if (selected)
                {
                    primitiveDrawer.DrawRoundedRectangle(graphicsDevice, rect, colorB);
                }
                else
                {
                    primitiveDrawer.DrawRoundedRectangle(graphicsDevice, rect, colorA);
                }

            primitiveDrawer.DrawRoundedRectangle(graphicsDevice, numRect, storedColor);

            Vector2 vector = this.GetVector();

            vector.X += 3;

            vector.Y += 3;

            spriteBatch.DrawString(fontHandler.GetVerdana(), " Code ", vector + TetrisGameRunner.GetOffsetVector(), Color.White);

            vector.X += strWidth;

            spriteBatch.DrawString(fontHandler.GetVerdana(), " " + formatText(fontHandler) + " ", vector + TetrisGameRunner.GetOffsetVector(), Color.White);
            spriteBatch.End();
            spriteBatch.Begin();
        }
        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, PrimitiveDrawer primitiveDrawer, FontHandler fontHandler, Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice)
        {
            SetWidth((int)fontHandler.GetVerdana().MeasureString(this.eventName).X + 8);
            Vector2 adjust = GetVector();
            adjust.X += 4;
            spriteBatch.DrawString(fontHandler.GetVerdana(), this.eventName, adjust + TetrisGameRunner.GetOffsetVector(), Color.White);

            primitiveDrawer.DrawRoundedRectangle(graphicsDevice, this, Color.Green);
            spriteBatch.End();
            spriteBatch.Begin();
        }
        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, PrimitiveDrawer primitiveDrawer, FontHandler fontHandler, Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice)
        {
            Vector2 vec = this.GetVector();

            holderA.SetVector(ref vec);
            vec.X += holderA.GetWidth() + 1;

            Rectangle rect = this.ToRectangle();
            rect.X = (int)vec.X;
            rect.Y = (int)vec.Y;
            rect.Width = 28;
            vec.X += 29;

            spriteBatch.DrawString(fontHandler.GetVerdana(), modes[mode], new Vector2(rect.X, rect.Y) + TetrisGameRunner.GetOffsetVector(), Color.White);

            holderB.SetVector(ref vec);

            this.width = holderA.GetWidth() + holderB.GetWidth() + 30;
            primitiveDrawer.DrawRoundedRectangle(graphicsDevice, rect, storedColor);
            holderA.Draw(spriteBatch, primitiveDrawer, fontHandler, graphicsDevice);

            holderB.Draw(spriteBatch, primitiveDrawer, fontHandler, graphicsDevice);
        }
        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, PrimitiveDrawer primitiveDrawer, FontHandler fontHandler, Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice)
        {
            Rectangle numRect = this.ToRectangle();
            numRect.Width = notWidth;
            this.width = notWidth + holder.GetWidth();

            primitiveDrawer.DrawRoundedRectangle(graphicsDevice, numRect, storedColor);

            Vector2 vector = this.GetVector();

            vector.X += 3;

            vector.Y += 3;

            spriteBatch.DrawString(fontHandler.GetVerdana(), modes[mode], vector + TetrisGameRunner.GetOffsetVector(), Color.White);

            vector.X += notWidth - 2;
            vector.Y -= 3;

            holder.SetVector(ref vector);
            holder.Draw(spriteBatch, primitiveDrawer, fontHandler, graphicsDevice);
            spriteBatch.End();
            spriteBatch.Begin();
        }
        public void Draw(GraphicsDevice graphicsDevice, SpriteBatch batch, PrimitiveDrawer drawer, FontHandler font)
        {
            world.Draw(graphicsDevice, batch, drawer, font);

            game.Draw(graphicsDevice, drawer, batch, font);

            if(GameEnded)
            {

                if(GameLost)
                batch.DrawString(font.GetVerdana(), "You Lost!", new Vector2(320,0) + TetrisGameRunner.GetOffsetVector(), Color.White);
                else
                batch.DrawString(font.GetVerdana(), "You Win!", new Vector2(320, 0) + TetrisGameRunner.GetOffsetVector(), Color.White);
            }
               batch.DrawString(font.GetVerdana(), text, new Vector2(320, 0) + TetrisGameRunner.GetOffsetVector(), Color.White);
        }
Пример #8
0
        public override void Draw(PrimitiveDrawer drawer, GraphicsDevice graphics, SpriteBatch batch, FontHandler font)
        {
            Vector2 headPlacement = GetVector();
            headPlacement.Y -= 46;
            headPlacement.X += (GetWidth() / 2);

            base.Draw(drawer, graphics, batch, font);

            drawer.DrawCircle(graphics, headPlacement, 50, Color.Black, 60);
            drawer.DrawCircle(graphics, headPlacement, 49, Color.Wheat, 60);

            Vector2 lower = GetVector();
            lower.Y += 30;

            lower.X += GetWidth();

            headPlacement.Y += -16;
            headPlacement.X += -28;

            // e     e\n , ____ ,
            string face = " l l\n";
            bool blinking = false;
            string face2 = " ____ ";
            if ((blink > 43 && blink < 56))
            {
                face = "  _  _\n";
                blinking = true;
            }

            if (blink == 110)
            {
                blink = 0;
            }

            if (blink % 140 < 15)
            {
                face2 = "  ____ ";
            }

            if (left != null)
            {
                left.Draw(graphics, batch, drawer, font);
                right.Draw(graphics, batch, drawer, font);
                leg_left.Draw(graphics, batch, drawer, font);
                leg_right.Draw(graphics, batch, drawer, font);
            }

            Vector2 dis = new Vector2(TetrisGameRunner.GetOffsetX(), TetrisGameRunner.GetOffsetY());

            batch.DrawString(((!blinking) ? font.GetWingdings() : font.GetVerdana()), face, headPlacement + dis, Color.Black);
            batch.DrawString(font.GetVerdana(), "\n\n", GetVector(), Color.Black, 0, dis + new Vector2(), .82f, SpriteEffects.None, 0);
            batch.DrawString(font.GetVerdana(), "\n" + face2, dis + headPlacement, Color.Black);
        }
 public void Draw(SpriteBatch batch, FontHandler handler, GraphicsDevice graphics, PrimitiveDrawer drawer)
 {
     drawer.DrawRoundedRectangle(graphics, this, col);
     batch.DrawString(handler.GetVerdana(), text, GetVector() + new Vector2(20, 10), Color.Black);
 }
        protected String formatText(FontHandler font)
        {
            String textA;

            if (selected)
            {
                #region Format the String with the Underscore in the person's current position of the text.
                textA = this.text.Substring(0, position) + "_" + this.text.Substring(position);
                #endregion
            }
            else
            {
                #region Shows the string from the end.
                textA = this.text.Substring(0, position) + "" + this.text.Substring(position);
                position = this.text.Length;
                #endregion
            }

            #region Measures the String Repeatedly and cuts off text until it will fit.
            Vector2 vector = font.GetVerdana().MeasureString(textA);
            int count = 0;
            while(vector.X > width)
            {

                if (position >= textA.Length - count - 1) break;
                
                vector = font.GetVerdana().MeasureString(textA.Substring(0, textA.Length - count++));
            }
            textA = textA.Substring(0, textA.Length - count);
           
            while(vector.X > width)
            {
                textA = textA.Substring(1);
                vector = font.GetVerdana().MeasureString(textA);
            }
            #endregion
            return textA;
        }
        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, PrimitiveDrawer primitiveDrawer, FontHandler fontHandler, Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice)
        {
           
            if(selected)
            {
                primitiveDrawer.DrawRoundedRectangle(graphicsDevice, this, colorB);
            } else
            {
                primitiveDrawer.DrawRoundedRectangle(graphicsDevice, this, colorA);
            }
            Vector2 vector = this.GetVector() + new Vector2(TetrisGameRunner.GetOffsetX(), TetrisGameRunner.GetOffsetY());
            
            vector.X += 3;
            vector.Y += 3;

            spriteBatch.DrawString(fontHandler.GetVerdana(), formatText(fontHandler), vector, Color.White);
            spriteBatch.End();
            spriteBatch.Begin();
        }
        public void Draw(SpriteBatch spriteBatch, PrimitiveDrawer primitiveDrawer, FontHandler fontHandler, GraphicsDevice graphics)
        {
            #region Draw the Background of the Interface
            widthOfMenu = modes[0].GetWidth() + modes[1].GetWidth() + modes[2].GetWidth();
            primitiveDrawer.DrawFilledRectangle(graphics, new Rectangle(0, 0, widthOfMenu, height), background);

            DrawSuggestions(spriteBatch, primitiveDrawer, fontHandler, graphics);

            primitiveDrawer.DrawFilledRectangle(graphics, new Rectangle(widthOfMenu, 0, width - widthOfMenu, height), background2);
            primitiveDrawer.DrawFilledRectangle(graphics, new Rectangle(widthOfMenu, 0, width - widthOfMenu, modes[0].GetHeight()), background);
            #endregion

            #region Draw the Text in the Top Right Corner
            String str = safeFileName;

            if(classManager != null)
            {
                str = classManager.GetName();
            }

            int wdt = (int)fontHandler.GetVerdana().MeasureString(str).X + 3;
            primitiveDrawer.DrawFilledRectangle(graphics, new Rectangle(width - wdt - 6, 0, wdt + 6, modes[0].GetHeight()), new Color(0x29, 0x80, 0xb9));
            spriteBatch.DrawString(fontHandler.GetVerdana(), str, new Vector2(width - wdt, 6) + TetrisGameRunner.GetOffsetVector(), Color.White);
            #endregion

            #region Set the Position of the Scroll Buttons
            scrollDown.SetY(height - scrollDown.GetHeight());
            scrollUp.SetY(height - scrollUp.GetHeight());

            scrollDown.SetWidth(widthOfMenu / 2 - 2);
            scrollDown.SetX(1);

            scrollUp.SetWidth(widthOfMenu / 2 - 2);
            scrollUp.SetX(widthOfMenu / 2 + 1);
            #endregion

            #region Set the Position of the Mode Buttons
            modes[1].SetX(modes[0].GetWidth());
            modes[2].SetX(modes[0].GetWidth() + modes[1].GetWidth());
            #endregion

            #region Draw the Elements and Modes and Such
            DrawModes(spriteBatch, primitiveDrawer, fontHandler, graphics);
            DrawElements(spriteBatch, primitiveDrawer, fontHandler, graphics);
            #endregion

            #region Draw the Scroll Buttons
            scrollDown.Draw(spriteBatch, primitiveDrawer, fontHandler, graphics);
            scrollUp.Draw(spriteBatch, primitiveDrawer, fontHandler, graphics);
            #endregion
        }
Пример #13
0
        public void Draw(GraphicsDevice graphicsDevice, SpriteBatch batch, PrimitiveDrawer drawer, FontHandler font)
        {
            Vector2 headPlacement = testingRectangle.GetVector();
            headPlacement.Y -= 46;
            headPlacement.X += (testingRectangle.GetWidth() / 2);

            if(textBox.GetSelected())
            textBox.Draw(batch, drawer, font, graphicsDevice);

            drawer.DrawRoundedRectangle(graphicsDevice, testingRectangle.ScalePosition(-1,-1).ScaleSize(2,2), Color.Black);
            drawer.DrawRoundedRectangle(graphicsDevice, testingRectangle, color);

            drawer.DrawCircle(graphicsDevice, headPlacement, 50, Color.Black, sides);
            drawer.DrawCircle(graphicsDevice, headPlacement, 49, Color.Wheat, sides);

            Vector2 lower = testingRectangle.GetVector();
            lower.Y += 30;

            lower.X += testingRectangle.GetWidth();

            headPlacement.Y += -16;
            headPlacement.X += -28;

            // e     e\n , ____ ,
            string face = " l l\n";
            if (squareOrCircle) face = " n n\n";
            bool blinking = false;
            string face2 = " ____ ";
            if ((blink > 43 && blink < 56) )
            {
                face = "  _  _\n";
                blinking = true;
            }

            if(blink == 110)
            {
                blink = 0;
            }

            if(blink % 140 < 15 )
            {
                face2 = "  ____ ";
            }

            left.Draw(graphicsDevice, batch, drawer, font);
            right.Draw(graphicsDevice, batch, drawer, font);
            lleft.Draw(graphicsDevice, batch, drawer, font);
            lright.Draw(graphicsDevice, batch, drawer, font);
            Vector2 dis = new Vector2(TetrisGameRunner.GetOffsetX(), TetrisGameRunner.GetOffsetY());
            batch.DrawString(font.GetVerdana(), "Frame : " + ff + "     "+"S: Save Frame     C: Correct Frame        V: Correct Frame Dynamic\nH: Hide Dots", new Vector2(300, 0) + dis, Color.White);

            batch.DrawString(((!blinking) ? font.GetWingdings() : font.GetVerdana()), face, headPlacement + dis, Color.Black);

            batch.DrawString(font.GetVerdana(), "\n\n", testingRectangle.GetVector(), Color.Black, 0, dis + new Vector2(), .82f, SpriteEffects.None, 0);

            batch.DrawString(font.GetVerdana(), "\n"+face2, dis + headPlacement, Color.Black);
        }