Exemple #1
0
        public TestScene(JackApp app) : base(app)
        {
            int width  = JackApp.WindowWidth;
            int height = JackApp.WindowHeight;

            Camera.Origin = new Vector2(width / 2, height / 2);

            _font = new SpriteFont("Terminus (TTF)", 37);

            Random rand = new Random();

            for (int i = 0; i < 10; i++)
            {
                Vector2 pos = new Vector2(
                    rand.Next(width / 2 - 500, width / 2 + 500),
                    rand.Next(height / 2 - 500, height / 2 + 500)
                    );
                Vector2 size  = new Vector2(rand.Next(40, 150));
                Color   color = Color.FromArgb(
                    rand.Next(0, 255),
                    rand.Next(0, 255),
                    rand.Next(0, 255)
                    );
                int dir = rand.Next(100) < 50 ? -1 : 1;
                Root.AddChild(new QuadNode(pos, size, color, dir, 1.0f));
            }

            Root.AddChild(new PlayerNode());
        }
        public static void Init(JackApp app)
        {
            _app    = app;
            _camera = new Camera(JackApp.WindowWidth, JackApp.WindowHeight);
            _font   = new SpriteFont("Terminus (TTF)", 22);

            MakePanels();

            JackApp.OnWindowResize += MakePanels;
        }