Exemple #1
0
        private void DrawAdjustedTextureVertically(Texture texture, Vector2 topLeftCorner, Vector2 bottomRightCorner)
        {
            topLeftCorner     = GetTransformedVector(topLeftCorner);
            bottomRightCorner = GetTransformedVector(bottomRightCorner);

            BasicGraphics.DrawTextureVerticallyWithUse(texture, topLeftCorner, bottomRightCorner);
        }
Exemple #2
0
        private void DrawSquare(Vector2 topLeft, Vector2 bottomRight, bool transformVectors)
        {
            if (transformVectors)
            {
                topLeft     = GetTransformedVector(topLeft);
                bottomRight = GetTransformedVector(bottomRight);
            }

            BasicGraphics.DrawSquare(topLeft, bottomRight);
        }
Exemple #3
0
        private void DrawGround(Ground ground)
        {
            BasicGraphics.SetColor(0.22f, 0.13f, 0.11f);

            Vector2 v1 = new Vector2(ground.LeftX, ground.TopY);
            Vector2 v2 = new Vector2(ground.RightX, ground.TopY - 99999f);

            DrawSquare(v1, v2);

            DrawGround2(ground);
        }
Exemple #4
0
        private void DrawProjectile(Vector2 projectilePosition)
        {
            BasicGraphics.SetColor(DangerColor);

            float x = projectilePosition.X;
            float y = projectilePosition.Y;
            float h = VisualValues.HalfProjectileWidthHeight;

            Vector2 v1 = new Vector2(x - h, y + h);
            Vector2 v2 = new Vector2(x + h, y - h);

            DrawSquare(v1, v2);
        }
        public void DrawMainMenu(int[] menuItemXPaddings)
        {
            float aspectRatio = VisualValues.GetAspectRatio();

            Vector2 titleTopLeftCorner     = new Vector2(-aspectRatio, 1);
            Vector2 titleBottomRightCorner = new Vector2(aspectRatio, -1);

            BasicGraphics.DrawTextureWithUse(titleTexture, titleTopLeftCorner, titleBottomRightCorner);

            for (int i = 0; i < 6; i++)
            {
                DrawMenuItem(i, menuItemXPaddings[i]);
            }
        }
Exemple #6
0
        private void DrawOverlayScreen(bool isLevelCompleteScreen, float rating = 0)
        {
            BasicGraphics.SetColor4(0.0f, 0.0f, 0.0f, 0.85f);
            BasicGraphics.DrawSquare(new Vector2(-2, 2), new Vector2(2, -2));

            Texture headerTexture = isLevelCompleteScreen ? overlayGameComplete : overlayGamePaused;

            DrawTexture(headerTexture, new Vector2(-0.6f, 0.6f), new Vector2(0.6f, 0.36f));

            if (isLevelCompleteScreen)
            {
                DrawRatings(rating);
            }

            DrawTexture(overlayPressX, new Vector2(-0.6f, -0.4f), new Vector2(0.6f, -0.64f));
        }
Exemple #7
0
        private void DrawCollectible(Collectible collectible, int stateValue)
        {
            float alpha      = Math.Max(stateValue / (float)collectibleMaximumValue, 0);
            float sizeFactor = 1 - alpha;

            BasicGraphics.SetColor4(1.0f, 0.9f, 0.4f, alpha);

            float x   = collectible.Position.X;
            float y   = collectible.Position.Y;
            float add = VisualValues.HalfCollectibleWidthHeight * sizeFactor * 1.5f;
            float h   = VisualValues.HalfCollectibleWidthHeight + add;

            Vector2 v1 = new Vector2(x - h, y + h);
            Vector2 v2 = new Vector2(x + h, y - h);

            DrawSquare(v1, v2);
        }
        public void DrawMenuItem(int index, int menuItemXPadding)
        {
            Texture texture;

            if (index == 0)
            {
                texture = playTutorialTexture;
            }
            else if (index == 1)
            {
                texture = playSong1Texture;
            }
            else if (index == 2)
            {
                texture = playSong2Texture;
            }
            else if (index == 3)
            {
                texture = playSong3Texture;
            }
            else if (index == 4)
            {
                texture = importSongTexture;
            }
            else
            {
                texture = exitGameTexture;
            }

            float xOffset = menuItemXPadding * menuItemXPaddingFactor;
            float yOffset = index * (menuItemHeight + menuItemYMargin);

            Vector2 topLeftCorner     = menuTopLeftCorner + new Vector2(xOffset, -yOffset);
            Vector2 bottomRightCorner = topLeftCorner + new Vector2(menuItemHeight * 7, -menuItemHeight);

            BasicGraphics.DrawTextureWithUse(texture, topLeftCorner, bottomRightCorner);
        }
Exemple #9
0
 private void DrawTexture(Texture texture, Vector2 topLeftCorner, Vector2 bottomRightCorner)
 {
     BasicGraphics.DrawTextureWithUse(texture, topLeftCorner, bottomRightCorner);
 }
Exemple #10
0
        private void DrawObstacle(Obstacle obstacle)
        {
            BasicGraphics.SetColor(DangerColor);

            DrawSquare(obstacle.TopLeftCorner, obstacle.BottomRightCorner);
        }
Exemple #11
0
        private void DrawGround2(Ground ground)
        {
            float groundPartWidth     = 2.4f;
            float groundMinimumHeight = 0.1f;
            float triangleYOffset     = 0.05f;

            float leftYOffset  = triangleYOffset;
            float rightYOffset = 0;

            float topY = ground.TopY;

            float leftX     = ground.LeftX;
            float maxRightX = ground.RightX;

            BasicGraphics.SetColor(0.2f, 0.74f, 0.33f);

            while (leftX < maxRightX)
            {
                if (IsCoordRightOfScreen(leftX))
                {
                    break;
                }

                leftYOffset  = leftYOffset > 0 ? 0 : triangleYOffset;
                rightYOffset = rightYOffset > 0 ? 0 : triangleYOffset;

                float fullRightX = leftX + groundPartWidth;

                if (IsCoordLeftOfScreen(fullRightX))
                {
                    leftX = fullRightX;
                    continue;
                }

                Vector2 topLeftCorner    = new Vector2(leftX, topY);
                Vector2 bottomLeftCorner = new Vector2(leftX, topY - groundMinimumHeight - leftYOffset);

                Vector2 topRightCorner;
                Vector2 bottomRightCorner;

                if (fullRightX < maxRightX)
                {
                    topRightCorner    = new Vector2(fullRightX, topY);
                    bottomRightCorner = new Vector2(fullRightX, topY - groundMinimumHeight - rightYOffset);
                }
                else
                {
                    topRightCorner = new Vector2(maxRightX, topY);

                    bottomRightCorner = new Vector2(maxRightX, (topY - groundMinimumHeight - rightYOffset));
                }

                topLeftCorner     = GetTransformedVector(topLeftCorner);
                topRightCorner    = GetTransformedVector(topRightCorner);
                bottomLeftCorner  = GetTransformedVector(bottomLeftCorner);
                bottomRightCorner = GetTransformedVector(bottomRightCorner);

                BasicGraphics.DrawQuad(topLeftCorner, topRightCorner, bottomLeftCorner, bottomRightCorner);

                leftX = fullRightX;
            }
        }
Exemple #12
0
        //
        // LEVELELEMENTS
        //

        private void DrawBackground(LevelProgression levelProgression)
        {
            BasicGraphics.SetColor(0.4f, 0.8f, 1.0f);

            DrawSquare(new Vector2(-2.1f, 1.1f), new Vector2(2.1f, -1.1f), false);
        }