public override void Start()
    {
        defaultFont = new FontData(Raylib.GetFontDefault(), 16);
        rect        = new CenteredRectangle(new Vector2(width / 2, height / 2), new Vector2(100, 100));

        // CenteredText Showcase
        centeredText = new CenteredText(new Vector2(width / 2, height / 2), new FontData(Raylib.GetFontDefault(), 16f), Color.WHITE, "PaperSDL");
    }
        protected override void OnUpdate()
        {
            foreach (QuadTreeNode qtn in QuadTreeSystem.quadTreeDict.Values)
            {
                CenteredRectangle cr = qtn.centeredRect;
                Debug.DrawLine(cr.topLeft, cr.topLeft + new Vector3(1, 0) * cr.width, Color.cyan);
                Debug.DrawLine(cr.topLeft, cr.topLeft + new Vector3(0, -1) * cr.height, Color.cyan);

                Debug.DrawLine(cr.botRight, cr.botRight + new Vector3(-1, 0) * cr.width, Color.cyan);
                Debug.DrawLine(cr.botRight, cr.botRight + new Vector3(0, 1) * cr.height, Color.cyan);
            }
        }
Exemple #3
0
    public override void Start()
    {
        int width  = pluto.width;
        int height = pluto.height;


        // stars
        stars      = new CenteredTexture[25];
        starColors = new Color[stars.Length];

        GenerateStars();

        // fonts
        fontData     = new FontData(Raylib.LoadFont("assets/Square.ttf"), 18f);
        timeFontData = new FontData(fontData.font, 24);

        // pluto image
        symbol = new CenteredTexture(new Vector2(width / 2, height / 2), Raylib.LoadTexture("assets/pluto.png"));

        // header bar
        header           = new CenteredRectangle(new Vector2(width / 2, 15), new Vector2(width, 30));
        volumeSlider     = new CenteredRectangle(new Vector2(header.position.X + 275, header.position.Y), new Vector2(100, 10));
        brightnessSlider = new CenteredRectangle(new Vector2(header.position.X - 275, header.position.Y), new Vector2(100, 10));

        // handles
        volumeHandle     = new Circle(new Vector2(volumeSlider.literalPosition.X, volumeSlider.position.Y), 8f);
        brightnessHandle = new Circle(new Vector2(brightnessSlider.literalPosition.X, brightnessSlider.position.Y), 8f);

        // panels
        brightnessPanel = new CenteredRectangle(new Vector2(width / 2, height / 2), new Vector2(width, height));
        mainPanel       = new CenteredRectangle(new Vector2(width / 2, height / 2 + 15), new Vector2(width, height - 30));

        // text objects
        timeText = new CenteredText(header.position, timeFontData, Color.WHITE, "TI:ME");

        for (int i = 0; i < consoleText.Length; i++)
        {
            consoleText[i] = new TextObject(new Vector2(10, 35 + (i * 20)), fontData, Color.WHITE);
        }

        UpdateVolumeSlider(pluto.musicSystem.volume);
        brightnessHandle.position = new Vector2(GetRelativePosition(brightnessSlider.literalPosition.X, brightnessSlider.literalPosition.X + brightnessSlider.size.X, 0.99f), volumeHandle.position.Y);
    }
 static public Quad Transform(this ITransformer transformer, CenteredRectangle centeredRectangle)
 {
     return(new Quad(transformer.Transform(centeredRectangle.Position), transformer.Transform(centeredRectangle.P1), transformer.Transform(centeredRectangle.P2)));
 }
 static public Rectangle ToIntegers(this CenteredRectangle value)
 {
     return(new Rectangle((int)value.Left, (int)value.Top, (int)value.Width, (int)value.Height));
 }