public OpenTextureWindow(TextureCallback callback) : base(DevelopmentMenu.Instance) { this.Title = "Select Texture"; this.Resized += OnResize; this.SetPosition((int)MouseManager.GetMousePositionWindows().X, (int)MouseManager.GetMousePositionWindows().Y); Callback = callback; PackageView = new PackageTree(this); PackageView.SetPosition(10, 10); PackageView.Filter = ResourceType.Texture; PackageView.TextureOpened += ItemSelected; PackageView.RefreshPackageView(); Cancel = new Button(this); Cancel.Text = "Cancel"; Cancel.Clicked += delegate(Base item, ClickedEventArgs args) { FSTexture none = new FSTexture(); none.ID = Guid.Empty; this.ItemSelected(none); this.Close(); }; this.SetSize(340, 450); }
private void ItemSelected(FSTexture tex) { if (Callback != null) { Callback(tex); } this.Close(); }
public TextureEditor(FSTexture texture) : base(DevelopmentMenu.Instance) { this.Title = "Texture Editor"; this.SetSize(600, 400); this.SetPosition((int)MouseManager.GetMousePositionWindows().X, (int)MouseManager.GetMousePositionWindows().Y); Canvas = new DrawingArea(this); Canvas.SetPosition(10, 10); Canvas.SetSize(300, 300); colorpicker = new HSVColorPicker(this); colorpicker.SetPosition(320, 10); colorpicker.ColorChanged += delegate(Base sender, EventArgs args) { Canvas.SetColor(colorpicker.SelectedColor); }; ToolSelect = new ToolBox(this); ToolSelect.Text = "Current Tool"; ToolSelect.SetPosition(320, 150); ToolSelect.SetSize(200, 200); Canvas.OnDraw += DrawEventHandler; Canvas.LoadTexture(texture); }
static Textures() { if (Game.Render) { ErrorTexture = new Texture(@"Data\Error.png"); FSErrorTexture = new FSTexture(); FSErrorTexture.ID = Guid.Empty; FSErrorTexture.Load(ErrorTexture.Image); } else { ErrorTexture = null; } }
private void SetTexture(FSTexture tex) { throw new NotImplementedException(); //Texture.Texture = tex; //if (tex.ID != Guid.Empty) { // Texture.Defined = true; //} //RefreshAll(); //Game.World.DirtyAll(); //if (TextureChanged != null) { // TextureChanged(this, EventArgs.Empty); //} }
internal void Load(FSTexture Tex) { this.ID = Tex.ID; this.Width = Tex.Texture.Width; this.Height = Tex.Texture.Height; Data = new Color[Width, Height]; for (int x = 0; x < Width; x++) { for (int y = 0; y < Height; y++) { this[x, y] = Tex.Texture.Image.GetPixel(x, y); } } if (!_subscribed){ _subscribed = true; Tex.OnUpdate += FSTextureUpdated; } }
public AddTexture(FSTexture tex, Guid parent) { this.texture = tex; this.parent = parent; }
public AddTexture() { this.texture = new FSTexture(); }
private void OnResourceRightClicked(Base item, ClickedEventArgs args) { Resource ClickedResource = (Resource)(((ResourceNode)item).Resource); Menu RightClickMenu = new Menu(Parent); { if (ClickedResource is Folder) { Folder FolderResource = ClickedResource as Folder; MenuItem Add = RightClickMenu.AddItem("Add"); { MenuItem submenu = Add.Menu.AddItem("Folder"); { submenu.SetImage(@"Data\folder.png"); submenu.Clicked += delegate(Base sender, ClickedEventArgs args2) { Folder res = new Folder(); res.Name = "New Folder"; FolderResource.Add(res); new AddFolder(res, ClickedResource.ID).Send(); }; } submenu = Add.Menu.AddItem("Texture"); { submenu.SetImage(@"Data\texture.png"); submenu.Clicked += delegate(Base sender, ClickedEventArgs args2) { FSTexture tex = new FSTexture(); tex.Name = "NewTexture.png"; tex.Load(new Bitmap(16, 16)); FolderResource.Add(tex); new AddTexture(tex, ClickedResource.ID).Send(); }; } submenu = Add.Menu.AddItem("Block Type"); { submenu.SetImage(@"Data\blocktype.png"); submenu.Clicked += delegate(Base sender, ClickedEventArgs args2) { BlockType bt = new BlockType(); bt.Name = "NewBlock.block"; FolderResource.Add(bt); new AddBlockType(bt, ClickedResource.ID).Send(); }; } submenu = Add.Menu.AddItem("Code File"); { submenu.SetImage(@"Data\SharedCode.png"); submenu.Clicked += delegate(Base sender, ClickedEventArgs args2) { CodeFile cf = new CodeFile(); cf.Name = "NewClass.cs"; FolderResource.Add(cf); new AddCode(cf, ClickedResource.ID).Send(); }; } } } MenuItem Rename = RightClickMenu.AddItem("Rename"); Rename.Clicked += delegate(Base sender, ClickedEventArgs renameargs) { ((ResourceNode)item).StartRename(); }; } Point LocalPos = Parent.CanvasPosToLocal(new Point(args.X, args.Y)); RightClickMenu.SetPosition(LocalPos.X - 6, LocalPos.Y - 28); //Subtracting bounds of inner panel RightClickMenu.Show(); }
public UpdateTexture(FSTexture tex) { this.texture = tex; }
public UpdateTexture() { this.texture = new FSTexture(); }
internal void LoadTexture(FSTexture Tex) { Canvas.Load(Tex); Tex.OnUpdate += Tex_OnUpdate; this.Invalidate(); }