Example #1
0
        public void DrawMinimap(vec2 pos, vec2 size, bool ShowCameraBox = true, bool SolidColor = false)
        {
            //vec2 center = pos + vec(-CameraAspect, -1) + new vec2(size.x, size.y) * vec(1.1f, 1.15f);
            vec2 center = pos * vec(2 * CameraAspect, -2) - vec(CameraAspect, -1);

            MinimapQuad.SetupVertices(center - size, center + size, vec(0, 0), vec(1, 1));

            vec2 _size   = size * vec(1, 254f / 245f) * 1.12f;
            vec2 _center = center + _size * vec(.03f, -.06f);

            DrawTextureSmooth.Using(vec(0, 0, 1, 1), CameraAspect, Assets.Minimap);
            RectangleQuad.Draw(GameClass.Graphics, _center, _size);

            if (SolidColor)
            {
                DrawSolid.Using(vec(0, 0, 1, 1), CameraAspect, rgb(0x222222));
                MinimapQuad.Draw(GameClass.Graphics);
            }
            else
            {
                DrawTextureSmooth.Using(vec(0, 0, 1, 1), CameraAspect, Minimap);
                MinimapQuad.Draw(GameClass.Graphics);
            }

            if (ShowCameraBox)
            {
                vec2 cam = CameraPos * size;
                vec2 bl  = center + cam - vec(CameraAspect, 1) * size / CameraZoom;
                vec2 tr  = center + cam + vec(CameraAspect, 1) * size / CameraZoom;
                bl = max(bl, center - size);
                tr = min(tr, center + size);
                DrawSolid.Using(vec(0, 0, 1, 1), CameraAspect, new color(.6f, .6f, .6f, .5f));
                DrawBox(bl, tr, 2f / GameClass.Screen.x);
            }
        }
Example #2
0
        private void BlackOverlay(float s)
        {
            float a = 1920f / 1080f;
            var   q = new RectangleQuad();

            q.SetupVertices(new vec2(-a, -1), new vec2(a, 1), vec2.Zero, vec2.Ones);
            q.SetColor(new color(1f, 1f, 1f, 1f));
            DrawSolid.Using(new vec4(0, 0, 1, 1), ScreenAspect, new color(0f, 0f, 0f, s));
            q.Draw(GameClass.Graphics);
            Render.UnsetDevice();
        }
Example #3
0
        public void DrawGridCell()
        {
            vec2 GridCoord = ScreenToGridCoord(Input.CurMousePos);

            color clr = CanPlaceItem ? DrawTerritoryPlayer.Available : DrawTerritoryPlayer.Unavailable;

            DrawSolid.Using(camvec, CameraAspect, clr);

            vec2 gWorldCord = GridToWorldCood(floor(GridCoord));
            vec2 size       = 1 / DataGroup.GridSize;

            RectangleQuad.Draw(GameClass.Graphics, gWorldCord + new vec2(size.x, -size.y), size);
        }
Example #4
0
        public void DrawBoxSelect(bool AfterUi)
        {
            if (AfterUi)
            {
                DrawArrowCursor();
                return;
            }

            if (!LeftMouseDown)
            {
                BoxSelecting = false;
                return;
            }

            if (!BoxSelecting && LeftMousePressed && MouseInGame)
            {
                BoxSelecting = true;
            }

            //BoxSelecting = true;
            if (!BoxSelecting)
            {
                return;
            }

            vec2 pos      = ScreenToWorldCoord(Input.CurMousePos);
            vec2 grid_pos = ScreenToGridCoord(Input.CurMousePos);

            if (LeftMousePressed)
            {
                BoxSelectStart = pos; BoxSelectEnd = pos; BoxSelectGridStart = grid_pos; BoxSelectGridEnd = grid_pos;
            }
            else
            {
                BoxSelectEnd = pos; BoxSelectGridEnd = grid_pos;
            }

            DrawSolid.Using(camvec, CameraAspect, new color(.6f, .6f, .6f, .5f));
            DrawBox(BoxSelectEnd, BoxSelectStart, 2f / (GameClass.Screen.x * CameraZoom));
        }
Example #5
0
        void DrawAvailabilityGrid()
        {
            vec2 GridCoord = ScreenToGridCoord(Input.CurMousePos) - new vec2(1, 1);

            int _w = 3, _h = 3;

            color clr = color.TransparentBlack;

            CanPlaceItem = true;
            for (int i = 0; i < _w; i++)
            {
                for (int j = 0; j < _h; j++)
                {
                    clr = CanPlace[i + j * _h] ? DrawTerritoryPlayer.Available : DrawTerritoryPlayer.Unavailable;
                    DrawSolid.Using(camvec, CameraAspect, clr);

                    vec2 gWorldCord = GridToWorldCood(new vec2((float)Math.Floor(GridCoord.x + i), (float)Math.Floor(GridCoord.y + j)));
                    vec2 size       = 1 / DataGroup.GridSize;
                    RectangleQuad.Draw(GameClass.Graphics, gWorldCord + new vec2(size.x, -size.y), size);
                }
            }
        }