byte r, g, b, a; // colour #endregion Fields #region Constructors public ParticleSprite(XNAGraph g, float d) { graph = g; direction = d; hotspot = new Rectangle(0, 0, 16, 16); r = this.g = 255; a = 128; b = 0; }
public BitmapSprite(XNAGraph g, string assetName, int cellWidth, int cellHeight, int rowLength, Rectangle hotspot) { graph = g; tex = g.LoadImage(assetName); this.width = cellWidth; this.height = cellHeight; this.rowLength = rowLength; this.hotspot = hotspot; }
protected override void LoadContent() { graph = new XNAGraph(graphics.GraphicsDevice, this.Content); input = new InputHandler(); tileset = new BitmapSprite(graph, "mantiles", 16, 16, 19, new Microsoft.Xna.Framework.Rectangle(0, 0, 16, 16)); TabbySprite = new BitmapSprite(graph, "tabpis", 64, 64, 8, new Rectangle(24, 24, 16, 40)); DoorSprite = new BitmapSprite(graph, "door", 16, 64, 7, new Rectangle(0, 0, 16, 64)); RipperSprite = new BitmapSprite(graph, "ripper", 16, 32, 4, new Rectangle(0, 0, 16, 20)); BoomSprite = new BitmapSprite(graph, "boom", 16, 16, 7, new Rectangle(0, 0, 16, 16)); BulletSprite = new BitmapSprite(graph, "bullet", 8, 8, 8, new Rectangle(0, 0, 8, 8)); player = new Player(this); cameraTarget = player; player.X = player.Y = 32; // arbitrary, if the map doesn't stipulate a starting point. map = v2Map.Load("map00.map"); MapSwitch("data/maps/test.map"); obs = new VectorObstructionMap(map.Obs); time = new Timer(100); editor = new Editor.Editor(this); editor.OnExit += StopEditor; }
public Editor(Engine e) { engine = e; graph = e.graph; tileset = new Tileset( new System.Drawing.Bitmap("mantiles.png"), 16, 16, 19, 42 * 18 ); tilesetmode = new TileSetMode(this); copypastemode = new CopyPasteMode(this); obstructionmode = new ObstructionMode(this); entityeditmode = new EntityEditMode(this); tabs.Dock = DockStyle.Fill; form.Controls.Add(tabs); form.Size = new System.Drawing.Size(800, 400); statbar = new StatusBar(); statbar.Panels.Add(new StatusBarPanel()); statbar.Panels.Add(new StatusBarPanel()); statbar.Panels[0].AutoSize = StatusBarPanelAutoSize.Spring; statbar.Panels[1].AutoSize = StatusBarPanelAutoSize.Contents; statbar.ShowPanels = true; menu = new MainMenu(new MenuItem[] { new MenuItem("&File", new MenuItem[] { new MenuItem("&New", new EventHandler(NewMap ), Shortcut.CtrlN), new MenuItem("&Open...", new EventHandler(OpenMap ), Shortcut.CtrlO), new MenuItem("-"), new MenuItem("&Save", new EventHandler(SaveMap ), Shortcut.CtrlS), new MenuItem("Save &As...", new EventHandler(SaveMapAs), Shortcut.F12 ), }), new MenuItem("&Edit", new MenuItem[] { new MenuItem("&Map Properties...", new EventHandler(ShowMapProperties )), new MenuItem("&Tileset...", new EventHandler(ShowTileSet )), new MenuItem("Map &Entities...", new EventHandler(ShowMapEntProperties)), new MenuItem("&Auto Selection Thing...", new EventHandler(ShowAutoSelectionThing)), }), new MenuItem("&Mode", new MenuItem[] { new MenuItem("&Tiles", new EventHandler(SetTileSetMode )), new MenuItem("&Copy/paste", new EventHandler(SetCopyPasteMode )), new MenuItem("&Obstructions", new EventHandler(SetObstructionEditMode)), new MenuItem("Map &Entities", new EventHandler(SetMapEntEditMode )) }) }); tilesetpreview = new TileSetPreview(tileset); tilesetpreview.ChangeTile += new ChangeTileHandler(OnTileChange); mapinfoview = new MapInfoView(this); mapentpropertiesview = new MapEntPropertiesView(this); autoselectionthing = new AutoSelectionThing(this); form.Text = "Mannux Editor"; form.Menu = menu; form.Controls.Add(statbar); AddTab("Layers", mapinfoview); AddTab("Entities", mapentpropertiesview); AddTab("Tiles", tilesetpreview); AddTab("Selection", autoselectionthing); var m = engine.input.Mouse; m.MouseDown += MouseClick; m.MouseUp += MouseUp; m.Moved += MouseDown; }