public override void Load() { _ui = new UIEngine(); _demos = GetAvailableDemos(); string[] demoNames = new string[_demos.Length]; for (int i = 0; i < _demos.Length; i++) { demoNames[i] = _demos[i].Name; } // Setup Frame var frame = new Frame(); var listBox = new ListBox(Vector2.Zero, demoNames, (SpriteFont)Utilities.ContentRepository.Repository["BasicFont"], Color.Blue, frame); listBox.MaximimumElementsDisplayed = 20; listBox.SelectionMade += new ListBoxEventHandler(SelectionMade); frame.KeyUp += new KeyEventHandler(KeyUp); _ui.AddAndLoad(frame); // End Frame Setup Game currentGame = (Game)Utilities.Globals.Data["Game"]; currentGame.IsMouseVisible = true; }
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"); }
public override void Load() { engine = new UIEngine(); var frame = new Frame(); var panel = new StackingPanel( Vector2.Zero, new Size(), StackingPanel.DirectionType.Down, 0f, frame); var txtBox = new AlphaNumTextBox(Vector2.Zero, 200, panel); //var optBox = new OptionBox(Vector2.Zero, "Check the Box", panel); var lin = new Link(Vector2.Zero, "Click Me", panel); lin.MouseClick += new MouseEventHandler( (sender, e) => this.Exit()); for (int i = 0; i < 10; i++) { new Label(Vector2.Zero, "Look At Me!", panel); } engine.AddAndLoad(frame); }
public override void Load() { // Extract Global Data Game currentGame = Globals.Data["Game"]; SpriteBatch spriteBatch = Globals.Data["SpriteBatch"]; Size winSize = DefaultSettings.Settings["WindowSize"]; // Initialize currentGame.IsMouseVisible = true; PE = new PhysicsEngine(new Region(0, (float)winSize.Width, 0, (float)winSize.Height), 10); 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); Random rand = new Random(); int nx = 40; int ny = 40; 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); } } // Load Content GraphicsUtils.Load(spriteBatch, (Texture2D)ContentRepository.Repository["Pixel"], (Texture2D)ContentRepository.Repository["Ball"]); // Setup UI _uiEngine = new UIEngine(); _uiEngine.AddAndLoad(new UIFrames.BasicFrame()); }
public override void Load() { UIManager = new UIEngine(); var frame = new UIFrames.BasicFrame(); frame.KeyPressDown += new KeyEventHandler(frame_KeyPressDown); UIManager.AddAndLoad(frame); Reload(); }
/* * GameState Reqs */ public override void Load() { UIManager = new UIEngine(); UIManager.AddAndLoad(new UIFrames.BasicFrame()); // Setup for UI input + GUI stuff // For Key Mappings _controller = new KeyboardController(UIManager.ActiveFrame, DemoKeyMappings.WasdMapping); _controller.KeyControlEngaged += new KeyControlEventHandler(_controller_KeyControlEngaged); _controller.KeyControlDisengaged += new KeyControlEventHandler(_controller_KeyControlDisengaged); Reload(); // For Map changes }
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); }
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(); }
public override void Load() { UIManager = new UIEngine(); var frame = new Frame(); frame.KeyUp += new KeyEventHandler(frame_KeyUp); frame.MouseClick += new MouseEventHandler(game_MouseClick); UIManager.AddAndLoad(frame); var keyController = new KeyboardController(frame, KeyMappings.SimpleMapping); keyController.KeyControlEngaged += new KeyControlEventHandler(keyController_KeyControlEngaged); keyController.KeyControlDisengaged += new KeyControlEventHandler(keyController_KeyControlDisengaged); keyController.KeyControlJustEngaged += new KeyControlEventHandler(keyController_KeyControlJustEngaged); frame.MouseOver += new MouseEventHandler(mouseController_MouseOver); Reload(); }
public override void Load() { _eng = new UIEngine(); _eng.AddAndLoad(new UIFrames.BasicFrame()); }
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); }