예제 #1
0
        private void GenerateContent()
        {
            this.log.WriteInformation("Generating content...");

            // Kreiranje boje pozadine
            backgroundColor = Color.Black;
            backgroundColor.A = 150;
            cameraColor = backgroundColor;

            // Generiranje teksure pogleda na mapu
            float ratio = (float)boardRange.Height / (float)boardRange.Width;
            backgroundQuad = new Rectangle(Vector3.Zero + position.ToVector3(),
                                                               new Vector3(ComponentWidth, ComponentWidth * ratio, 0f) + position.ToVector3(),
                                                               backgroundColor);

            // Generiranje teksture pogleda kamere
            componentBoardRatio = new Vector2(
               ComponentWidth / (float)boardRange.Height,
               (ComponentWidth * ratio) / boardRange.Width);

            RecalculateCameraPosition(this.camera.Position);

            this.log.WriteInformation("Content generated!");
        }
예제 #2
0
 private void RecalculateCameraPosition(Vector2 cameraPosition)
 {
     cameraPositionComponent = position + cameraPosition * componentBoardRatio;
     cameraViewRectangle = new Rectangle(
         cameraPositionComponent.ToVector3(),
         (cameraPositionComponent + camera.ViewSize * componentBoardRatio).ToVector3(),
         cameraColor);
 }
예제 #3
0
        private void GenerateContent()
        {
            this.log.WriteInformation("Generating content...");

            // Kreira pozadinu za graf
            Color blackTrans = Color.Black;
            blackTrans.A = 150;

            Range backgroundRange = new Range(GraphWidth, GraphHeight);
            backgroundQuad = new Rectangle(position + backgroundRange.UpperLeft,
                                                               position + backgroundRange.LowerRight, blackTrans);

            // Ucitava linije
            if (graphLines == null) graphLines = new TimeLine[GraphWidth];
            for (int index = 0; index < GraphWidth; index++) {
                if (graphLines[index] == null) {
                    graphLines[index] = new TimeLine {
                        PointA = new Vector3(position.X + index, position.Y + GraphHeight, position.Z),
                        PointB = new Vector3(position.X + index, position.Y + GraphHeight, position.Z),
                        ColorA = Color.DarkGreen,
                        ColorB = Color.Green,
                    };
                }
                else {
                    graphLines[index].PointA = new Vector3(position.X + index, position.Y + GraphHeight, position.Z);
                    graphLines[index].PointB = new Vector3(graphLines[index].PointA.X,
                                                           graphLines[index].PointA.Y - graphLines[index].Height, position.Z);
                }
            }
            this.log.WriteInformation("{0} TimeLines generated!", this.graphLines.Length);

            this.log.WriteInformation("Content generated!");
        }