Example #1
0
        public override void Load()
        {
            Game        currentGame = Globals.Data["Game"];
            SpriteBatch spriteBatch = Globals.Data["SpriteBatch"];

            currentGame.IsMouseVisible = true;

            // Already done by XNAGAme
            //GraphicsUtils.Load(spriteBatch,
            //    ContentRepository.Repository["Pixel"],
            //    ContentRepository.Repository["Ball"]);

            fire  = ContentRepository.Repository["fire"];
            smoke = ContentRepository.Repository["smoke"];

            PE = new PhysicsEngine(new Region(0, winSize.Width, 0, winSize.Height), 10);
            PE.AddUniversalForce(DefaultForces.LinearDrag);


            //UI stuff...
            _uiEngine = new UIEngine();
            var frame = new UIFrames.BasicFrame();

            frame.MouseClick += new MouseEventHandler(frame_MouseClick);

            _uiEngine.AddAndLoad(frame);


            Console.WriteLine("CONTROLS:");
            Console.WriteLine("[RCLICK] - detailed 310 particle explosion");
            Console.WriteLine("[LCLICK] - dirty 35 particle explosion");
        }
Example #2
0
        public override void Load()
        {
            Game currentGame = Globals.Data["Game"];
            SpriteBatch spriteBatch = Globals.Data["SpriteBatch"];
            currentGame.IsMouseVisible = true;

            // Already done by XNAGAme
            //GraphicsUtils.Load(spriteBatch,
            //    ContentRepository.Repository["Pixel"],
            //    ContentRepository.Repository["Ball"]);

            fire = ContentRepository.Repository["fire"];
            smoke = ContentRepository.Repository["smoke"];

            PE = new PhysicsEngine(new Region(0, winSize.Width, 0, winSize.Height), 10);
            PE.AddUniversalForce(DefaultForces.LinearDrag);

            //UI stuff...
            _uiEngine = new UIEngine();
            var frame = new UIFrames.BasicFrame();

            frame.MouseClick += new MouseEventHandler(frame_MouseClick);

            _uiEngine.AddAndLoad(frame);

            Console.WriteLine("CONTROLS:");
            Console.WriteLine("[RCLICK] - detailed 310 particle explosion");
            Console.WriteLine("[LCLICK] - dirty 35 particle explosion");
        }
Example #3
0
        public override void Load()
        {
            UIManager = new UIEngine();
            var frame = new UIFrames.BasicFrame();
            frame.KeyPressDown += new KeyEventHandler(frame_KeyPressDown);
            UIManager.AddAndLoad(frame);

            Reload();
        }
Example #4
0
        public override void Load()
        {
            UIManager = new UIEngine();
            var frame = new UIFrames.BasicFrame();

            frame.KeyPressDown += new KeyEventHandler(frame_KeyPressDown);
            UIManager.AddAndLoad(frame);


            Reload();
        }
Example #5
0
        public override void Load()
        {
            // Extract Global Data
            Game        currentGame = (Game)Globals.Data["Game"];
            SpriteBatch spriteBatch = (SpriteBatch)Globals.Data["SpriteBatch"];
            Size        winSize     = (Size)DefaultSettings.Settings["WindowSize"];

            // Initialize
            rand = new Random();

            currentGame.IsMouseVisible = true;


            // Load Content
            GraphicsUtils.Load(spriteBatch,
                               (Texture2D)ContentRepository.Repository["Pixel"],
                               (Texture2D)ContentRepository.Repository["Ball"]);

            Objs = new List <Object>();
            QT   = new QuadTree <Object>(new Region(0, winSize.Width, 0, winSize.Height), 1, 10);

            printTree <Object>(QT, 0);


            /*for (int i = 0; i < 10000; i++)
             * {
             *  var ob = new Object(getRandRegion(winSize));
             *  QT.AddNode(ob);
             *  Objs.Add(ob);
             * }
             *
             * var start = DateTime.Now.Ticks; //time the query
             * for (int i = 0; i < 1000; i++)
             * {
             *  QT.Query(new Region(0, 50, 0, 50));
             * }
             * var end = DateTime.Now.Ticks;
             *
             * Console.WriteLine("QUERY TOOK " + (end - start).ToString() + " TICKS");*/


            // Setup UI
            _uiEngine = new UIEngine();

            var frame = new UIFrames.BasicFrame();

            frame.MouseClick += new MouseEventHandler(frame_MouseClick);
            frame.MouseDown  += new MouseEventHandler(frame_MouseDown);
            frame.MouseOver  += new MouseEventHandler(frame_MouseOver);
            frame.KeyUp      += new KeyEventHandler(frame_KeyUp);
            _uiEngine.AddAndLoad(frame);
        }
Example #6
0
        public override void Load()
        {
            UIManager = new UIEngine();
            var frame = new UIFrames.BasicFrame();
            frame.MouseClick += new MouseEventHandler(frame_MouseClick);
            frame.KeyPressDown += new KeyEventHandler(frame_KeyPressDown);
            frame.MouseOver += new MouseEventHandler(frame_MouseOver);
            UIManager.AddAndLoad(frame);

            _controller = new KeyboardController(UIManager.ActiveFrame, KeyMappings.PolarMouseMapping);
            _controller.KeyControlEngaged += new KeyControlEventHandler(_controller_KeyControlEngaged);
            _controller.KeyControlDisengaged += new KeyControlEventHandler(_controller_KeyControlDisengaged);

            Reload();
        }
Example #7
0
        public override void Load()
        {
            UIManager = new UIEngine();
            var frame = new UIFrames.BasicFrame();

            frame.MouseClick   += new MouseEventHandler(frame_MouseClick);
            frame.KeyPressDown += new KeyEventHandler(frame_KeyPressDown);
            frame.MouseOver    += new MouseEventHandler(frame_MouseOver);
            UIManager.AddAndLoad(frame);

            _controller = new KeyboardController(UIManager.ActiveFrame, KeyMappings.PolarMouseMapping);
            _controller.KeyControlEngaged    += new KeyControlEventHandler(_controller_KeyControlEngaged);
            _controller.KeyControlDisengaged += new KeyControlEventHandler(_controller_KeyControlDisengaged);


            Reload();
        }
Example #8
0
        public override void Load()
        {
            // Extract Global Data
            Game        currentGame = Globals.Data["Game"];
            SpriteBatch spriteBatch = Globals.Data["SpriteBatch"];


            // Initialize
            currentGame.IsMouseVisible = true;


            PE = new PhysicsEngine(new Region(0, (float)winSize.Width, 0, (float)winSize.Height), 10);
            //PE.AddUniversalForce(DefaultForces.Gravity);
            //PE.AddUniversalForce(DefaultForces.Drag);


            var w0 = new VertWallBody(new Vector2(0, winSize.Height / 2), winSize.Height);
            var w1 = new VertWallBody(new Vector2(winSize.Width, winSize.Height / 2), winSize.Height);

            var w2 = new HorizWallBody(new Vector2(winSize.Width / 2, 0), winSize.Width);
            var w3 = new HorizWallBody(new Vector2(winSize.Width / 2, winSize.Height), winSize.Width);

            PE.MapBodies.Add(w0);
            PE.MapBodies.Add(w1);
            PE.MapBodies.Add(w2);
            PE.MapBodies.Add(w3);


            //var c0 = new CircleBody(30, 300, new Vector2(600, winSize.Height / 2));
            //c0.Velocity = -1000 * Vector2.UnitX;
            //PE.ActiveBodies.Add(c0);

            //PE.AddBoundForceField(new BoundForceField(c0, 50, DefaultForces.StrongAttractor));


            int nx  = 40;
            int ny  = 20;
            var rad = 4f;
            var buf = 0f;
            var pos = new Vector2(winSize.Width / 2 - nx * (2f * rad + buf) / 2f, winSize.Height / 2 - ny * (2f * rad + buf) / 2f);

            for (int xi = 0; xi < nx; xi++)
            {
                for (int yi = 0; yi < ny; yi++)
                {
                    var cent = pos + new Vector2((2f * rad + buf) * xi, (2f * rad + buf) * yi);
                    var ball = new CircleBody(rad, rad, cent);
                    PE.ActiveBodies.Add(ball);
                }
            }

            printInstr();
            printStat();

            // Load Content
            GraphicsUtils.Load(spriteBatch,
                               ContentRepository.Repository["Pixel"],
                               ContentRepository.Repository["Ball"]);

            // Setup UI
            _uiEngine = new UIEngine();
            var frame = new UIFrames.BasicFrame();

            frame.MouseDown    += new MouseEventHandler(frame_MouseDown);
            frame.MouseClick   += new MouseEventHandler(frame_MouseClick);
            frame.MouseOver    += new MouseEventHandler(frame_MouseOver);
            frame.KeyPressDown += new KeyEventHandler(frame_KeyPressDown);
            _uiEngine.AddAndLoad(frame);
        }