예제 #1
0
 /// <summary>
 /// LoadContent will be called once per game and is the place to load
 /// all of your content.
 /// </summary>
 protected override void LoadContent()
 {
     Resources.Sprites.SpritesDefault.Load();
     Resources.Fonts.Load(Content);
     Resources.Effects.Load(Content);
     DrawCntrl.Init(GraphicsDevice);
 }
 public override void Draw()
 {
     DrawCntrl.DrawSprite(
         Sprite,
         Test.RoundVector2(Position - (Vector2.UnitY * Z) + (Vector2.UnitY * Test.CurrentScene.GetLift(Position)))
         );
 }
예제 #3
0
        public override void DrawBegin()
        {
            int startX = Math.Max(0, (int)(DrawCntrl.CurrentCamera.X / GameConsole.CharSize.X));
            int startY = Math.Max(0, (int)(DrawCntrl.CurrentCamera.Y / GameConsole.CharSize.Y));

            for (var x = startX; x < Math.Min(startX + GameConsole.W, TileMap.GetLength(0)); x += 1)
            {
                for (var y = startY; y < Math.Min(startY + GameConsole.H, TileMap.GetLength(1)); y += 1)
                {
                    TileMap[x, y].Draw(x, y);
                }
            }

            if (DisplaySolids)
            {
                DrawCntrl.CurrentColor = Color.Red;
                for (var x = startX; x < Math.Min(startX + GameConsole.W, TileMap.GetLength(0)); x += 1)
                {
                    for (var y = startY; y < Math.Min(startY + GameConsole.H, TileMap.GetLength(1)); y += 1)
                    {
                        if (!TileMap[x, y].IsPassable())
                        {
                            DrawCntrl.DrawRectangle(new Vector2(x, y) * GameConsole.CharSize, new Vector2(x, y) * GameConsole.CharSize + GameConsole.CharSize - Vector2.One, true);
                        }
                    }
                }
            }
        }
예제 #4
0
        public override void Draw()
        {
            GameConsole.ForegroundColor = GameConsole.BaseForegroundColor;
            GameConsole.BackgroundColor = GameConsole.BaseBackgroundColor;
            DrawCntrl.SetTransformMatrix(Matrix.CreateTranslation(Vector3.Zero));

            if (DisplayBorders)
            {
                GameConsole.DrawFrame(Pos - Vector2.One, Size + Vector2.One * 2);
                GameConsole.DrawRectangle(Pos, Size);
                GameConsole.DrawText(Name, Pos - Vector2.UnitY);
            }

            string itemStr;

            for (var i = 0; i < Items.Length; i += 1)
            {
                if (i == SelectedItem)
                {
                    itemStr = "> " + Items[i];
                }
                else
                {
                    itemStr = Items[i];
                }
                GameConsole.DrawText(itemStr, Pos + Vector2.UnitY * i);
            }
            DrawCntrl.ResetTransformMatrix();
        }
예제 #5
0
        public override void Draw()
        {
            if (_currentSelectionMenu != null)
            {
                DrawCntrl.SetTransformMatrix(Matrix.CreateTranslation(Vector3.Zero));
                GameConsole.BackgroundColor = GameConsole.BaseBackgroundColor;
                GameConsole.ForegroundColor = GameConsole.BaseForegroundColor;
                GameConsole.DrawRectangle(Dialogue.Pos, Dialogue.Size);
                GameConsole.DrawFrame(Dialogue.Pos - Vector2.One, Dialogue.Size + Vector2.One * 2);

                string desc;

                if (_currentSelectionMenu.SelectedItem >= _currentInventory.Count)
                {
                    desc = Strings.BackTip;
                }
                else
                {
                    desc = _currentInventory.ElementAt(_currentSelectionMenu.SelectedItem).Value.Description;
                }

                GameConsole.DrawText(desc, Dialogue.Pos);
                DrawCntrl.ResetTransformMatrix();
            }
        }
        void DrawSpeechBubble(Vector2 pos, Vector2 tarPos, Vector2 size)
        {
            DrawCntrl.CurrentColor = Color.White;

            _wiggleyId = 0;

            var flippedSize = new Vector2(size.X, -size.Y);

            DrawCntrl.DrawTriangle(pos - Vector2.UnitX * 10, pos + Vector2.UnitX * 10, _targetPos, false);

            DrawCntrl.PrimitiveBegin();

            //DrawCntrl.PrimitiveAddVertex(pos);

            DrawArc(pos - size / 2, 90);
            DrawLine(pos - size / 2, Vector2.UnitX, size.X);

            DrawArc(pos + flippedSize / 2, 0);
            DrawLine(pos + flippedSize / 2, Vector2.UnitY, size.Y);

            DrawArc(pos + size / 2, 270);
            DrawLine(pos + size / 2, -Vector2.UnitX, size.X);

            DrawArc(pos - flippedSize / 2, 180);
            DrawLine(pos - flippedSize / 2, -Vector2.UnitY, size.Y);

            //DrawCntrl.PrimitiveSetLineStripIndices(true);
            DrawCntrl.PrimitiveSetTriangleFanIndices();
            DrawCntrl.PrimitiveEnd();
        }
예제 #7
0
        public override void Draw()
        {
            GameConsole.ForegroundColor = GameConsole.BaseForegroundColor;
            GameConsole.BackgroundColor = GameConsole.BaseBackgroundColor;

            DrawCntrl.SetTransformMatrix(Matrix.CreateTranslation(Vector3.Zero));

            GameConsole.DrawRectangle(Vector2.Zero, new Vector2(GameConsole.W, GameConsole.H));

            string itemStr;

            for (var i = 0; i < Items.Length; i += 1)
            {
                if (i == SelectedItem)
                {
                    itemStr = "> " + Items[i];
                }
                else
                {
                    itemStr = Items[i];
                }
                GameConsole.DrawText(itemStr, Pos + Vector2.UnitY * i);
            }
            DrawCntrl.ResetTransformMatrix();

            GameConsole.DrawText(Strings.MenuTitle, Pos + Vector2.UnitY * -2);

            GameConsole.DrawText(Strings.MenuControls, new Vector2(1, GameConsole.H - 2));
            GameConsole.DrawText(Strings.MenuCredits1, new Vector2(70, GameConsole.H - 3));
            GameConsole.DrawText(Strings.MenuCredits2, new Vector2(64, GameConsole.H - 2));
        }
        public override void Draw()
        {
            var resPos = Position + _bodyOffset - Vector2.UnitY * (Z + _jumpChargeZ);

            var frame = 0;

            if (FacingDirection > 0 && FacingDirection < 180)
            {
                frame = 1;
            }
            DrawCntrl.DrawSprite(BodySprite, frame, Test.RoundVector2(resPos + (Vector2.UnitY * Test.CurrentScene.GetLift(Position))));

            if (frame == 0)
            {
                float ratio = ((float)FacingDirection - 270) / 90f;

                if (ratio > 1)
                {
                    ratio = 1;
                }
                if (ratio < -1)
                {
                    ratio = -1;
                }

                DrawCntrl.DrawSprite(
                    FaceSprite,
                    Test.RoundVector2(
                        resPos + _facePos +
                        (Vector2.UnitX * FaceOffsetMax * ratio) +
                        (Vector2.UnitY * Test.CurrentScene.GetLift(Position))
                        )
                    );
            }
        }
예제 #9
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GameCntrl.UpdateFps(gameTime);
            DrawCntrl.Update(gameTime);

            base.Draw(gameTime);
        }
예제 #10
0
        public override void Draw()
        {
            DrawCntrl.SetTransformMatrix(Matrix.CreateTranslation(Vector3.Zero));
            GameConsole.BackgroundColor = GameConsole.BaseBackgroundColor;

            GameConsole.DrawRectangle(0, 0, GameConsole.W, GameConsole.H);
            DrawCntrl.ResetTransformMatrix();
        }
 public override void DrawGUI()
 {
     if (_deathScrEnabled)
     {
         DrawCntrl.CurrentColor = Color.White;
         DrawCntrl.DrawRectangle(Vector2.Zero, GameCntrl.WindowManager.CanvasSize, false);
     }
 }
 public override void Draw()
 {
     if (Sprite != null)
     {
         DrawCntrl.CurrentColor = Color.White;
         DrawCntrl.DrawSprite(Sprite, Position + Vector2.One * Scene.CellSize / 2);
     }
 }
예제 #13
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            GameCntrl.LoadGraphics(Content);
            Fonts.Load(Content);
            DrawCntrl.Init(GraphicsDevice);

            SoundController.Init(Content);

            GameCntrl.Begin();
        }
        void DrawLine(Vector2 pos, Vector2 dir, float length)
        {
            var step         = length / (_sideVecticesCount + 2);
            var borderOffset = new Vector2(dir.Y, -dir.X) * Border;

            for (var i = 0; i <= _sideVecticesCount; i += 1)
            {
                DrawCntrl.PrimitiveAddVertex(pos + _wiggleys[i] + dir * step * (i + 1) + borderOffset);
                _wiggleyId += 1;
            }
        }
        void DrawArc(Vector2 pos, float ang)
        {
            var stepAng = 90f / _cornerVecticesCount;

            for (var i = _cornerVecticesCount; i >= 0; i -= 1)
            {
                var dir = MathHelper.ToRadians(ang + i * stepAng);
                DrawCntrl.PrimitiveAddVertex(pos + _wiggleys[i] + new Vector2((float)Math.Cos(dir), -(float)Math.Sin(dir)) * Border);
                _wiggleyId += 1;
            }
        }
        public override void Draw()
        {
            var center = Position + SecondPosition / 2;

            DrawCntrl.CurrentColor = Color.White;

            var v = Vector2.UnitY * amp * (float)Math.Sin(_ang);

            DrawCntrl.DrawRectangle(center - Mask / 2, center + Mask / 2, false);

            DrawCntrl.DrawSprite(SpritesDefault.LaserOrb, Test.RoundVector2(Position + v));
            DrawCntrl.DrawSprite(SpritesDefault.LaserOrb, Test.RoundVector2(Position + SecondPosition + v));
        }
예제 #17
0
        public static void DrawText(string text, int x, int y)
        {
            DrawCntrl.CurrentFont = Font;
            string[] lines = text.Split(new[] { Environment.NewLine }, StringSplitOptions.None);

            var yAdd = 0;

            foreach (string line in lines)
            {
                DrawCntrl.DrawSprite(Sprites.Font, _fillerFrame, x * CharSize.X, (y + yAdd) * CharSize.Y, line.Length, 1, 0, BackgroundColor);
                DrawCntrl.CurrentColor = ForegroundColor;
                DrawCntrl.DrawText(line, x * CharSize.X, (y + yAdd) * CharSize.Y);
                yAdd += 1;
            }
        }
예제 #18
0
 public override void DrawBegin()
 {
     if (!Destroyed)
     {
         var c = new Color(Color.White, (float)_life.Counter / _lifetime);
         DrawCntrl.DrawSprite(
             Sprite,
             0,
             Test.RoundVector2(Position + (Vector2.UnitY * Test.CurrentScene.GetLift(Position))),
             Vector2.One,
             -Dir,
             c
             );
     }
 }
예제 #19
0
        public override void DrawEnd()
        {
            if (_drawWhiteScreen)
            {
                DrawCntrl.SetTransformMatrix(Matrix.CreateTranslation(Vector3.Zero));
                GameConsole.ForegroundColor = Color.White;
                GameConsole.BackgroundColor = GameConsole.BaseBackgroundColor;

                GameConsole.DrawRectangle(0, 0, GameConsole.W, GameConsole.H);
                DrawCntrl.ResetTransformMatrix();

                Player player = (Player)Objects.ObjFind <Player>(0);
                GameConsole.DrawChar('@', player.Pos);
            }
        }
예제 #20
0
        public override void DrawEnd()
        {
            GameConsole.BackgroundColor = GameConsole.BaseBackgroundColor;
            GameConsole.ForegroundColor = GameConsole.BaseForegroundColor;

            DrawCntrl.SetTransformMatrix(Matrix.CreateTranslation(Vector3.Zero));
            GameConsole.DrawRectangle(Pos, Size);
            if (!Borderless)
            {
                GameConsole.DrawFrame(Pos - Vector2.One, Size + Vector2.One * 2);
            }

            GameConsole.DrawText(_dialogueNames[LineId], Pos + new Vector2(1, -1));
            GameConsole.DrawText(_typedText.ToString(), Pos);
            DrawCntrl.ResetTransformMatrix();
        }
예제 #21
0
        void DrawObjectOverlays()
        {
            foreach (OverworldObj obj in Objects.GetList <OverworldObj>())
            {
                if (obj == CurrentObject)
                {
                    DrawCntrl.CurrentColor = Color.Yellow;
                }
                else
                {
                    DrawCntrl.CurrentColor = Color.Blue;
                }

                DrawCntrl.DrawRectangle(obj.Pos * GameConsole.CharSize, obj.Pos * GameConsole.CharSize + GameConsole.CharSize, true);
            }
        }
        public override void DrawEnd()
        {
            var str = "";

            if (!_dead)
            {
                str = Text.Substring(0, TextPtr + 1);
            }

            DrawSpeechBubble(_pos + BubbleOffset, _targetPos, _textSize);

            DrawCntrl.CurrentFont  = _font;
            DrawCntrl.HorAlign     = TextAlign.Center;
            DrawCntrl.VerAlign     = TextAlign.Center;
            DrawCntrl.CurrentColor = Color.Black;
            DrawCntrl.DrawText(str, _pos + BubbleOffset);
        }
        public override void Draw()
        {
            DrawCntrl.CurrentColor = Color.Red;

            if (CurrentState == State.Pursuing)
            {
                DrawCntrl.DrawSprite(SpritesDefault.EnemyPaw, 0, Test.RoundVector2(Position), Vector2.One, -_tracedPawprint.Dir, Color.White);
            }
            //DrawCntrl.DrawCircle(Test.RoundVector2(Position), 8, false);

            /*
             * foreach(Vector2 pt in _patrolPoints)
             * {
             *      DrawCntrl.DrawCircle(pt, 2, false);
             * }
             */
            DrawCntrl.CurrentColor = Color.White;
        }
예제 #24
0
        public override void DrawEnd()
        {
            base.DrawEnd();

            if (_menu != null)
            {
                DrawCntrl.SetTransformMatrix(Matrix.CreateTranslation(Vector3.Zero));
                Inventory inv = (Inventory)Objects.ObjFind <Inventory>(0);
                GameConsole.ForegroundColor = GameConsole.BaseForegroundColor;
                GameConsole.BackgroundColor = GameConsole.BaseBackgroundColor;
                GameConsole.DrawText("HP: " + inv.Health.ToString().PadLeft(3) + "/" + inv.MaxHealth, _menuPos + Vector2.UnitY * 4);

                GameConsole.ForegroundColor = GameConsole.HealthForegroundColor;
                GameConsole.BackgroundColor = GameConsole.HealthBackgroundColor;
                GameConsole.DrawRectangle((int)_menuPos.X, (int)_menuPos.Y + 5, (int)_menuSize.X, 1);
                GameConsole.DrawProgressBar((int)_menuPos.X, (int)_menuPos.Y + 5, (int)_menuSize.X, ((float)inv.Health) / ((float)inv.MaxHealth));
                DrawCntrl.ResetTransformMatrix();
            }
        }
예제 #25
0
        public void DrawTileMap()
        {
            _tileDeg += 0.1f;
            if (_tileDeg > Math.PI * 2)
            {
                _tileDeg -= (float)Math.PI * 2;
            }

            DrawCntrl.CurrentColor = Color.White;

            for (var y = 0; y < TileMap.GetLength(1); y += 1)
            {
                for (var x = 0; x < TileMap.GetLength(0); x += 1)
                {
                    if (TileMap[x, y] > 0)
                    {
                        DrawCntrl.DrawSprite(SpritesDefault.Tile, TileMap[x, y] - 1, x * CellSize, y * CellSize + GetLift(new Vector2(x, y) * CellSize));
                    }
                }
            }
        }
        public override void DrawBegin()
        {
            if (_started)
            {
                CurrentScene.DrawTileMap();
            }
            else
            {
                DrawCntrl.CurrentFont = Resources.Fonts.CartonSix;
                DrawCntrl.HorAlign    = TextAlign.Center;
                DrawCntrl.VerAlign    = TextAlign.Center;

                DrawCntrl.CurrentColor = Color.Black;
                DrawCntrl.DrawText(
                    "oh no, someone stole my hands!" + Environment.NewLine + " " + Environment.NewLine +
                    "by gn.fur, aristokrat952, brodux and cybereye" + Environment.NewLine + " " + Environment.NewLine +
                    "monogame jam special" + Environment.NewLine + " " + Environment.NewLine +
                    "press space",
                    new Vector2(0, 0)
                    );
            }
        }
예제 #27
0
 public static void DrawChar(char ch, int x, int y)
 {
     DrawCntrl.DrawSprite(Sprites.Font, _fillerFrame, x * CharSize.X, y * CharSize.Y, 1, 1, 0, BackgroundColor);
     DrawCntrl.DrawFrame(_fontChars[ch], new Vector2(x, y) * CharSize, Vector2.One, 0, Vector2.Zero, ForegroundColor, SpriteEffects.None);
 }
예제 #28
0
 public override void Draw()
 {
     DrawCntrl.CurrentColor = Color.White;
     DrawCntrl.DrawSprite(SpritesDefault.Coin, Position);
 }
 public override void Draw()
 {
     DrawCntrl.CurrentColor = Color.White;
     //DrawCntrl.DrawCircle(Position, 16, false);
     DrawCntrl.DrawSprite(SpritesDefault.Sign, Position);
 }
 public override void DrawBegin()
 {
     DrawCntrl.CurrentColor = Color.White;
     DrawCntrl.DrawSprite(SpritesDefault.Clouds, Id, Position + DrawCntrl.CurrentCamera.Pos * Parallax);
 }