Пример #1
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);
                        }
                    }
                }
            }
        }
 public override void DrawGUI()
 {
     if (_deathScrEnabled)
     {
         DrawCntrl.CurrentColor = Color.White;
         DrawCntrl.DrawRectangle(Vector2.Zero, GameCntrl.WindowManager.CanvasSize, false);
     }
 }
        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));
        }
Пример #4
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);
            }
        }
Пример #5
0
        public override void DrawEnd()
        {
            if (CurrentMode == Mode.Objects)
            {
                DrawObjectOverlays();
            }


            DrawCntrl.CurrentColor = UIBgColor;
            DrawCntrl.DrawRectangle(0, 0, Terrain.TileMap.GetLength(0) * GameConsole.CharSize.X, Terrain.TileMap.GetLength(1) * GameConsole.CharSize.Y, true);



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

            GameConsole.ForegroundColor = UIFgColor;
            GameConsole.BackgroundColor = UIBgColor;
            GameConsole.DrawFrame(0, 0, GameConsole.W, GameConsole.H);

            string mode = "";

            if (CurrentMode == Mode.Tiles)
            {
                mode = "Tile mode";
            }
            if (CurrentMode == Mode.Collision)
            {
                mode = "Collision mode";
            }
            if (CurrentMode == Mode.Objects)
            {
                mode = "Object mode";
            }


            string caption = mode
                             + " | mx:" + TileMousePos.X
                             + " my:" + TileMousePos.Y
                             + " | fps:" + GameCntrl.Fps
                             + " | map w:" + Terrain.TileMap.GetLength(0)
                             + " map h:" + Terrain.TileMap.GetLength(1)
                             + " | ";

            GameConsole.DrawText(caption, 1, 0);

            if (CurrentMode == Mode.Tiles)
            {
                GameConsole.ForegroundColor = Palettes[CurrentPalette][0];
                GameConsole.BackgroundColor = Palettes[CurrentPalette][1];
                GameConsole.DrawText("Char: " + CurrentChar, caption.Length + 1, 0);
            }


            if (CurrentMode == Mode.Objects)
            {
                string className = ObjectTypes[CurrentObjectType].ToString().Split('.').Last();
                GameConsole.DrawText("Obj: " + className, caption.Length + 1, 0);

                if (CurrentObject != null)
                {
                    className = CurrentObject.ToString().Split('.').Last();
                    GameConsole.DrawText("Selected: " + className + " | " + CurrentObject.ArgumentName + ": " + CurrentObject.Argument, 1, GameConsole.H - 1);
                }
            }


            if (SelectionMenuActive)
            {
                if (SelectionMenuMode == 0)
                {
                    DrawPaletteSelectionMenu();
                }
                else
                {
                    DrawCharSelectionMenu();
                }
            }

            if (ObjArgumentMenuActive)
            {
                DrawObjArgumentMenu();
            }

            if (ObjSelectMenuActive)
            {
                DrawObjSelectMenu();
            }



            DrawCntrl.CurrentColor = Color.White;
            DrawCntrl.DrawRectangle(TileScreenMousePos * GameConsole.CharSize, TileScreenMousePos * GameConsole.CharSize + GameConsole.CharSize, true);



            DrawCntrl.ResetTransformMatrix();
        }