public SelectTeleportationForm(Map map, System.Drawing.Point premier, int layer, Map firstMap, SpriteBatch Mapbatch) { InitializeComponent(); utils = new XNAUtils(); this.map = map; this.premier = premier; this.layer = layer; this.firstMap = firstMap; this.batch = Mapbatch; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.Size = Screen.PrimaryScreen.Bounds.Size; this.StartPosition = FormStartPosition.Manual; this.Location = new System.Drawing.Point(0, 0); PN_Map.Size = Screen.PrimaryScreen.Bounds.Size; PresentationParameters pp = new PresentationParameters() { BackBufferHeight = PN_Map.Height, BackBufferWidth = PN_Map.Width, DeviceWindowHandle = PN_Map.Handle, IsFullScreen = false }; XNADevices.graphicsdevice.Reset(pp); }
private void LIST_Icons_SelectedIndexChanged(object sender, EventArgs e) { PN_Preview.BackgroundImageLayout = ImageLayout.Center; if (LIST_Icons.SelectedItem != null) using (XNAUtils utils = new XNAUtils()) PN_Preview.BackgroundImage = utils.ConvertToImage(((pIcon)LIST_Icons.SelectedItem).GetImage()); }
private void BTN_Add_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.Multiselect = true; dlg.Filter = "Fichiers png (*.png)|*.png"; if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { WaitingForm form = new WaitingForm(); form.Show(); Application.DoEvents(); for (int i = 0; i < dlg.FileNames.Count(); i++) { using (XNAUtils utils = new XNAUtils()) { byte[] data = File.ReadAllBytes(dlg.FileNames[i]); Image image = byteArrayToImage(data); Battler battler = new Battler(dlg.SafeFileNames[i], utils.ConvertToTexture(image)); LIST_Battlers.Items.Add(battler); } } form.Close(); } }
public PeventEditor(Pevent pevent, SpriteBundle bundle, PeventClassBundle bundlec) { InitializeComponent(); using (XNAUtils utils = new XNAUtils()) { sBundle = bundle; pEvent = pevent; pSprite = pevent.pSprite; cBundle = bundlec; foreach (PeventClass pClass in cBundle.ListpEventClass) CB_Class.Items.Add(pClass); CB_Class.Text = pevent.Class.ToString(); CB_Direction.SelectedItem = pevent.Direction.ToString(); CHK_Flying.Checked = pevent.Flying; if (pSprite != null) PN_Graphics.BackgroundImage = utils.ConvertToImage(pevent.pSprite.SpriteImage); CB_MoveType.SelectedItem = pevent.MoveType.ToString(); TB_Name.Text = pevent.Name; TB_Script.Text = pevent.Script; LB_Position.Text = pevent.Position.X + " x " + pevent.Position.Y; NUM_Sight.Value = new Decimal(pEvent.Sight); CHK_Through.Checked = pevent.Through; CB_TriggerType.SelectedItem = pevent.TriggerType.ToString(); NUM_Speed.Value = new Decimal(pevent.Velocity); CHK_Disposable.Checked = pevent.Disposable; HasAccepted = false; this.CB_MoveType.SelectedIndexChanged += new System.EventHandler(this.CB_MoveType_SelectedIndexChanged); } }
public pIcon(SerializationInfo info, StreamingContext context) { using (XNAUtils utils = new XNAUtils()) { ContentImage = utils.ConvertToTexture(info.GetValue("ContentImage", typeof(System.Drawing.Image)) as System.Drawing.Image); Name = info.GetValue("Name", typeof(String)) as String; } }
public Battler(SerializationInfo info, StreamingContext context) { using (XNAUtils utils = new XNAUtils()) { Name = info.GetString("Name"); Img = utils.ConvertToTexture(info.GetValue("Img", typeof(System.Drawing.Image)) as System.Drawing.Image); } }
public void GetObjectData(SerializationInfo info, StreamingContext context) { using (XNAUtils utils = new XNAUtils()) { info.AddValue("ContentImage", utils.ConvertToImage(ContentImage)); info.AddValue("Name", Name); } }
public void GetObjectData(SerializationInfo info, StreamingContext context) { using (XNAUtils utils = new XNAUtils()) { info.AddValue("BackImage", utils.ConvertToImage(BackImage)); info.AddValue("Repeat", Repeat); info.AddValue("Opacity", Opacity); } }
public Landscape(SerializationInfo info, StreamingContext context) { using (XNAUtils utils = new XNAUtils()) { BackImage = utils.ConvertToTexture((System.Drawing.Image)info.GetValue("BackImage", typeof(System.Drawing.Image))); Repeat = (Boolean)info.GetValue("Repeat", typeof(Boolean)); Opacity = (Int32)info.GetValue("Opacity", typeof(Int32)); } }
private void LIST_Icons_SelectedIndexChanged(object sender, EventArgs e) { using (XNAUtils utils = new XNAUtils()) if (LIST_Icons.SelectedItem != null) { BTN_Choose.Enabled = true; PN_Icon.BackgroundImage = utils.ConvertToImage(((pIcon)LIST_Icons.SelectedItem).GetImage()); PN_Icon.BackgroundImageLayout = ImageLayout.Center; } }
private void LBSprites_SelectedIndexChanged(object sender, EventArgs e) { using (XNAUtils utils = new XNAUtils()) if (LBSprites.SelectedItem != null) { btnChoisir.Enabled = true; SpriteChoisi = (Sprite)LBSprites.SelectedItem; plPreview.BackgroundImage = utils.ConvertToImage(SpriteChoisi.SpriteImage); } }
private void SetInfos(Tile tile) { using (XNAUtils utils = new XNAUtils()) { LB_Position.Text = tile.X + " X " + tile.Y; LB_TileSetIndex.Text = tile.TileIndexX < 0 ? "Tuile vide" : tile.TileIndexX + " X " + tile.TileIndexY; //PN_Preview.BackgroundImage = utils.ConvertToImage(tile.Background); BTN_pEvent.Enabled = tile.pEvent != null; } }
public Sprite(SerializationInfo info, StreamingContext context) { using (XNAUtils utils = new XNAUtils()) { SpriteImage = utils.ConvertToTexture((System.Drawing.Image)info.GetValue("Image", typeof(System.Drawing.Image))); Name = (String)info.GetValue("Name", typeof(String)); TileCount = (Point)info.GetValue("TileCount", typeof(Point)); tempTileX = 0; tempTileY = 0; } }
private void PN_Map_Paint(object sender, PaintEventArgs e) { using (XNAUtils utils = new XNAUtils()) { device.Clear(Color.White); map.Draw(batch, utils, ratio); device.Present(); } }
private void BTN_Save_Click(object sender, EventArgs e) { using (XNAUtils utils = new XNAUtils()) { HasSaved = true; fog.BackImage = utils.ConvertToTexture(PN_Preview.BackgroundImage); fog.Opacity = TRACK_Opacity.Value; fog.Repeat = true; } Close(); }
public FogSelector(Fog o) { InitializeComponent(); fog = o; using (XNAUtils utils = new XNAUtils()) { TRACK_Opacity.Value = fog.Opacity; PN_Preview.BackgroundImage = utils.ConvertToImage(fog.BackImage); LB_Opacity.Text = TRACK_Opacity.Value.ToString(); } }
public PopUpGraphics(Sprite ppSprite, SpriteBundle psBundle) { sBundle = psBundle; pSprite = ppSprite; InitializeComponent(); using (XNAUtils utils = new XNAUtils()) { if (pSprite != null) PN_Graphics.BackgroundImage = utils.ConvertToImage(pSprite.SpriteImage); } }
private void BTN_Edit_Click(object sender, EventArgs e) { SpritePicker dlg = new SpritePicker(sBundle); dlg.ShowDialog(); pSprite = dlg.SpriteChoisi; if (dlg.Choisi) { using (XNAUtils utils = new XNAUtils()) PN_Graphics.BackgroundImage = utils.ConvertToImage(pSprite.SpriteImage); } }
private void BTN_AddItemObject_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.Multiselect = true; dlg.Filter = "Images|*.jpg;*.jpeg;*.png;*.bmp"; if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { using (XNAUtils utils = new XNAUtils()) foreach (String item in dlg.FileNames) { LIST_Icons.Items.Add(new pIcon(utils.ConvertToTexture(Image.FromFile(item)), item.Substring(item.LastIndexOf("\\")))); } } }
public Color AssignColor(Elemental Elem) { Image Conversion; using (XNAUtils utils = new XNAUtils()) { Conversion = utils.ConvertToImage(Elem.Icon.GetImage()); } Bitmap Image = new Bitmap(Conversion); Color PixelColor = Image.GetPixel(Image.Width / 2, Image.Height / 2); //if (PixelColor.IsNearBlack(25)) // PixelColor = Color.FromArgb(50, 50, 50); //else if (PixelColor.IsNearWhite(25)) // PixelColor = Color.FromArgb(205, 205, 205); return PixelColor; }
private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { if (LIST_Maps.SelectedItem != null) using (XNAUtils utils = new XNAUtils()) { Map map = LIST_Maps.SelectedItem as Map; LB_Name.Text = map.Name; LB_Size.Text = map.MapSize.Width + " X " + map.MapSize.Height; PN_Preview.Refresh(); Single RatioX = (Single)PN_Preview.Width / ((Single)map.MapSize.Width * (Single)GlobalPreferences.Prefs.Map.TileSize.Width); Single RatioY = (Single)PN_Preview.Width / ((Single)map.MapSize.Height * (Single)GlobalPreferences.Prefs.Map.TileSize.Height); Single AbsRatio = RatioX > RatioY ? RatioX : RatioY; XNADevices.graphicsdevice.Clear(Color.White); map.Draw(batch, utils, AbsRatio); XNADevices.graphicsdevice.Present(); } }
public MapInfos(Map CurrentMap, String ProjectName, String filename) { InitializeComponent(); map = CurrentMap; PN_Title.BackgroundImage = new Bitmap(PN_Title.Width, PN_Title.Height); using (XNAUtils utils = new XNAUtils()) using (Graphics g = Graphics.FromImage(PN_Title.BackgroundImage)) using (Brush brush = new SolidBrush(Color.Black)) using (Font bigfont = new Font("Calibri", 30)) using (Font smallfont = new Font("Calibri", 14)) { g.DrawImage(utils.ConvertToImage(map.DrawMap()), new Point(0, 0)); g.DrawImage(Properties.Resources.FuzzyLineTitle, new Point(0,0)); g.DrawImage(Properties.Resources.AeroEffect, new Point(0, 0)); g.DrawString(map.Name, bigfont, brush, new Point(5, 5)); g.DrawString(ProjectName, smallfont, brush, new Point(25, 50)); PN_Title.Refresh(); NUM_X.Value = Convert.ToDecimal(map.MapSize.Width); NUM_Y.Value = Convert.ToDecimal(map.MapSize.Height); TB_Rename.Text = map.Name; PB_Tileset.Image = utils.ConvertToImage(map.TileSet); PB_Tileset.Size = PB_Tileset.Image.Size; FileInfo info = new FileInfo(filename); LB_Filename.Text = info.Name; LB_Filesize.Text = (info.Length / 1024) + "ko"; } this.Text += " - " + map.Name; }
public DrawLimits(Map map) { InitializeComponent(); this.map = map; using (XNAUtils utils = new XNAUtils()) { PN_Map.BackgroundImage = utils.ConvertToImage(map.DrawMap()); PN_Map.Size = new Size(map.MapSize.Width * 32, map.MapSize.Height * 32); Buffer = new Bitmap(PN_Map.Size.Width, PN_Map.Size.Height); using (Graphics g = Graphics.FromImage(Buffer)) { g.Clear(Color.White); if (map.Limits != null) g.DrawImage(utils.ConvertToImage(map.Limits), new Point(0, 0)); } Buffer.MakeTransparent(Color.White); Brushsize = 10; Brushtype = BrushType.Circle; brushcolor = Color.Black; } }
public HistoryManager(MapStateHistory msh, Texture2D tileset) { InitializeComponent(); history = msh; length = 10; using (XNAUtils utils = new XNAUtils()) foreach (MapState item in history.GetAllStates()) { Panel pn = new Panel(); pn.Height = 320; pn.Width = 500; HistoryButton btn = new HistoryButton(); btn.BackgroundImage = utils.ConvertToImage(item.GenerateMap(tileset)); btn.BackgroundImageLayout = ImageLayout.Zoom; btn.Width = 480; btn.Height = 280; btn.Location = new System.Drawing.Point(10, 10); btn.mapState = item; btn.Click += new EventHandler(OnClick); Label lbl = new Label(); lbl.Text = String.Format("[{0}] - {1}", item.TimeStamp.ToLongDateString(), item.TimeStamp.ToLongTimeString()); lbl.Location = new System.Drawing.Point(10, 300); lbl.Size = new System.Drawing.Size(300, 30); pn.Controls.Add(btn); pn.Controls.Add(lbl); pn.Location = new System.Drawing.Point(length, 10); length += 520; PN_History.Controls.Add(pn); } }
private void LIST_Battlers_SelectedIndexChanged(object sender, EventArgs e) { using (XNAUtils utils = new XNAUtils()) PN_Preview.BackgroundImage = utils.ConvertToImage(LIST_Battlers.SelectedItem == null ? null : (LIST_Battlers.SelectedItem as Battler).Img); }
private void LIST_ItemObjects_SelectedIndexChanged(object sender, EventArgs e) { ItemObject o = LIST_ItemObjects.SelectedItem as ItemObject; using (XNAUtils utils = new XNAUtils()) if (o != null) { GROUP_Item.Visible = true; LBL_ITEM_Name.Text = o.Name; CB_Consumable.Checked = o.Ephemeral; TB_Desc.Text = o.Description; NUM_pHP.Value = new decimal(o.HPPercent); NUM_HP.Value = new decimal(o.HPRecovery); if (o.Icon != null) PN_Icon.BackgroundImage = utils.ConvertToImage(o.Icon.GetImage()); else PN_Icon.BackgroundImage = null; PN_Icon.Tag = o.Icon; NUM_pMP.Value = new decimal(o.MPPercent); NUM_MP.Value = new decimal(o.MPRecovery); NUM_Price.Value = new decimal(o.Price); CB_Unique.Checked = o.Unique; NUM_Weight.Value = new decimal(o.Weight); DDL_ITEM_Target.SelectedItem = o.Target; for (int i = 0; i < CHK_LIST_StatusEffectItem.Items.Count; i++) CHK_LIST_StatusEffectItem.SetItemChecked(i, false); foreach (StatusEffect item in o.StatusClear) CHK_LIST_StatusEffectItem.SetItemChecked(CHK_LIST_StatusEffectItem.Items.IndexOf(item), true); } else GROUP_Item.Visible = false; }
private void PN_Icon_Click(object sender, EventArgs e) { IconPicker dlg = new IconPicker(ressources.Icons); dlg.ShowDialog(); using (XNAUtils utils = new XNAUtils()) if (dlg.HasAccepted) { PN_Icon.Tag = dlg.GetIcon(); PN_Icon.BackgroundImage = utils.ConvertToImage(dlg.GetIcon().GetImage()); } }
private void PB_Tileset_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.Filter = "PNG (*.png)|*.png"; if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { using (XNAUtils utils = new XNAUtils()) { PB_Tileset.Image = Image.FromFile(dlg.FileName); PB_Tileset.Size = PB_Tileset.Image.Size; map.TileSet = utils.ConvertToTexture(PB_Tileset.Image); } } }
private void DrawMap() { using (XNAUtils utils = new XNAUtils()) CurrentMap.Draw(Batch, utils, (Single)TRACK_Ratio.Value / 100); XNADevices.graphicsdevice.Present(); }
private void LIST_Animations_SelectedIndexChanged(object sender, EventArgs e) { if (Saving) return; if (LIST_Animations.SelectedItem != null) { String animationname = LIST_Animations.SelectedItem.ToString(); DrawLoadingNotice("Initialisation de l'animation", animationname); Thread.Sleep(20); Animation animation = (LIST_Animations.SelectedItem as Animation).Clone() as Animation; if (animation.GetPattern() != null && animation.GetPattern().GetImage() != null) { // Set pattern in pattern panel DrawLoadingNotice("Chargement du motif", animationname); SetPatternImage(animation, animation.GetPattern().GetImage()); // Dispose old textures DrawLoadingNotice("Libération de la mémoire", animationname); foreach (Texture2D texture in textures) texture.Dispose(); // Clear texture table textures.Clear(); // Convert images into Texture2D for them to be used with XNA DrawLoadingNotice("Adaptation du motif", animationname); foreach (Control c in PN_Pattern.Controls) using (XNAUtils utils = new XNAUtils()) { textures.Add(utils.ConvertToTexture(c.BackgroundImage)); } } else { // Dispose old textures DrawLoadingNotice("Libération de la mémoire", animationname); foreach (Texture2D texture in textures) texture.Dispose(); // Clear texture table textures.Clear(); PN_Pattern.Controls.Clear(); } // Set informations DrawLoadingNotice("Affichage des informations", animationname); LBL_AnimationName.Text = animation.ToString(); // Update indexes DrawLoadingNotice("Mise à jour des index", animationname); CurrentAnimation = animation; CurrentIndex = LIST_Animations.SelectedIndex; // Update timeline DrawLoadingNotice("Chargement de la ligne de temps", animationname); animationTimeLine1.LoadAnimation(animation); DrawFrame(CurrentAnimation.FrameAt(0)); GROUP_Animation.Visible = true; } else { CurrentAnimation = null; CurrentIndex = LIST_Animations.SelectedIndex; GROUP_Animation.Visible = false; } }