diff --git a/Bonhomme02.sln b/Bonhomme02.sln new file mode 100644 index 0000000..90855d7 --- /dev/null +++ b/Bonhomme02.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27004.2002 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bonhomme02", "Bonhomme02\Bonhomme02.csproj", "{B3C7D374-80DA-45F0-B97F-6320169C1BE7}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B3C7D374-80DA-45F0-B97F-6320169C1BE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B3C7D374-80DA-45F0-B97F-6320169C1BE7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B3C7D374-80DA-45F0-B97F-6320169C1BE7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B3C7D374-80DA-45F0-B97F-6320169C1BE7}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C53F0596-CB41-43D0-97DF-706218E42504} + EndGlobalSection +EndGlobal diff --git a/Bonhomme02/App.config b/Bonhomme02/App.config new file mode 100644 index 0000000..731f6de --- /dev/null +++ b/Bonhomme02/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Bonhomme02/BaseBJ.cs b/Bonhomme02/BaseBJ.cs new file mode 100644 index 0000000..cbd43c4 --- /dev/null +++ b/Bonhomme02/BaseBJ.cs @@ -0,0 +1,16 @@ +/* + * Base des objets Bras et jambe + */ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Bonhomme02 +{ + class BaseBJ + { + } +} diff --git a/Bonhomme02/BaseDessin.cs b/Bonhomme02/BaseDessin.cs new file mode 100644 index 0000000..8b262fd --- /dev/null +++ b/Bonhomme02/BaseDessin.cs @@ -0,0 +1,150 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Bonhomme02 +{ + class BaseDessin + { + #region Données membres + public Point coordonnee; // Les coordonée du point seront basé sur le millieux des dessin pour facilité les rotations ! + private bool _Visible = true; + private PictureBox _Hebergeur; + private Color _Fond = Color.Silver; + private Color _Crayon = Color.Black; + private Boolean remplir = true; + public double eppaisseurContour = 5; + #endregion + + #region Constructeurs + public BaseDessin() + { + this._Hebergeur = null; + coordonnee = new Point(); + } + + public BaseDessin(PictureBox hebergeur) + { + this._Hebergeur = hebergeur; + this._Fond = hebergeur.BackColor; + } + + public BaseDessin(PictureBox hebergeur, int xy) : this (hebergeur) + { + this.coordonnee = new Point(xy, xy); + } + + public BaseDessin(PictureBox hebergeur, int x, int y) : this(hebergeur) + { + this.coordonnee = new Point(x, x); + } + public BaseDessin(int x, int y) + { + this.coordonnee = new Point(x, x); + } + public BaseDessin(PictureBox hebergeur, int xy, Color crayon) : this(hebergeur, xy) + { + Crayon = crayon; + } + + public BaseDessin(PictureBox hebergeur, int x, int y, Color crayon) : this(hebergeur, x, y) + { + Crayon = crayon; + } + #endregion + + #region Accesseurs + public int X + { + get { return coordonnee.X; } + set + { + if (value < 0) { coordonnee.X = 0; } + else if (value > this._Hebergeur.Bounds.Size.Width) { coordonnee.X = this._Hebergeur.Bounds.Size.Width; } + else { coordonnee.X = value; } + } + } + + public int Y + { + get { return coordonnee.Y; } + set + { + if (value < 0) { coordonnee.Y = 0; } + else if (value > coordonnee.Y) { coordonnee.Y = this._Hebergeur.Bounds.Size.Height; } + else { coordonnee.Y = value; } + } + } + + public bool Visible + { + get { return _Visible; } + set { _Visible = value; } + } + public bool Remplir + { + get { return remplir; } + set { remplir = value; } + } + + public Color Fond + { + get { return _Fond; } + set + { + try { _Fond = value; } + catch (Exception e) { Console.WriteLine("Erreur couleur invalide : " + e.ToString());} + } + } + + public Color Crayon + { + get { return _Crayon; } + set + { + try { _Crayon = value; } + catch (Exception e) { Console.WriteLine("Erreur couleur invalide : " + e.ToString()); } + } + } + + public PictureBox Hebergeur + { + get { return _Hebergeur; } + set { _Hebergeur = value; } + } + + #endregion + + #region Méthodes + public void Bouger(int deplX, int deplY) + { + X += deplX; + Y += deplY; + } + + public virtual void Afficher(IntPtr handle) + { + if (this.Visible) + { + Graphics gr = Graphics.FromHwnd(handle); + gr.FillEllipse(new SolidBrush(Color.Yellow), this.X, this.Y, 6, 6); + gr.DrawEllipse(new Pen(this._Crayon, 2), this.X, this.Y, 6, 6); + } + } + + public virtual void Cacher(IntPtr handle) + { + if (this.Visible) + { + Graphics gr = Graphics.FromHwnd(handle); + gr.FillEllipse(new SolidBrush(this.Fond), this.X, this.Y, 6, 6); + gr.DrawEllipse(new Pen(this.Fond, 2), this.X, this.Y, 6, 6); + } + } + #endregion + } +} diff --git a/Bonhomme02/Bonhomme.cs b/Bonhomme02/Bonhomme.cs new file mode 100644 index 0000000..cc754a8 --- /dev/null +++ b/Bonhomme02/Bonhomme.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Bonhomme02 +{ + class Bonhomme : Peau + { + } +} diff --git a/Bonhomme02/Bonhomme02.csproj b/Bonhomme02/Bonhomme02.csproj new file mode 100644 index 0000000..84195cc --- /dev/null +++ b/Bonhomme02/Bonhomme02.csproj @@ -0,0 +1,89 @@ + + + + + Debug + AnyCPU + {B3C7D374-80DA-45F0-B97F-6320169C1BE7} + WinExe + Bonhomme02 + Bonhomme02 + v4.6.1 + 512 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + \ No newline at end of file diff --git a/Bonhomme02/Bras.cs b/Bonhomme02/Bras.cs new file mode 100644 index 0000000..28a1ca3 --- /dev/null +++ b/Bonhomme02/Bras.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Bonhomme02 +{ + class Bras : BaseBJ + { + } +} diff --git a/Bonhomme02/Form1.Designer.cs b/Bonhomme02/Form1.Designer.cs new file mode 100644 index 0000000..4f1ac53 --- /dev/null +++ b/Bonhomme02/Form1.Designer.cs @@ -0,0 +1,111 @@ +namespace Bonhomme02 +{ + partial class Form1 + { + /// + /// Variable nécessaire au concepteur. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Nettoyage des ressources utilisées. + /// + /// true si les ressources managées doivent être supprimées ; sinon, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Code généré par le Concepteur Windows Form + + /// + /// Méthode requise pour la prise en charge du concepteur - ne modifiez pas + /// le contenu de cette méthode avec l'éditeur de code. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.TV = new System.Windows.Forms.PictureBox(); + this.timerImage = new System.Windows.Forms.Timer(this.components); + this.btnEffacer = new System.Windows.Forms.Button(); + this.btnStopDeplacerCTick = new System.Windows.Forms.Button(); + this.btnCreationCarrosse = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.TV)).BeginInit(); + this.SuspendLayout(); + // + // TV + // + this.TV.Location = new System.Drawing.Point(13, 13); + this.TV.Name = "TV"; + this.TV.Size = new System.Drawing.Size(782, 241); + this.TV.TabIndex = 0; + this.TV.TabStop = false; + // + // timerImage + // + this.timerImage.Interval = 500; + this.timerImage.Tick += new System.EventHandler(this.timerImage_Tick); + // + // btnEffacer + // + this.btnEffacer.Location = new System.Drawing.Point(13, 305); + this.btnEffacer.Name = "btnEffacer"; + this.btnEffacer.Size = new System.Drawing.Size(389, 23); + this.btnEffacer.TabIndex = 10; + this.btnEffacer.Text = "Effacer Tout"; + this.btnEffacer.UseVisualStyleBackColor = true; + this.btnEffacer.Click += new System.EventHandler(this.btnEffacer_Click); + // + // btnStopDeplacerCTick + // + this.btnStopDeplacerCTick.Enabled = false; + this.btnStopDeplacerCTick.Location = new System.Drawing.Point(408, 305); + this.btnStopDeplacerCTick.Name = "btnStopDeplacerCTick"; + this.btnStopDeplacerCTick.Size = new System.Drawing.Size(387, 23); + this.btnStopDeplacerCTick.TabIndex = 9; + this.btnStopDeplacerCTick.Text = "Stop Tick"; + this.btnStopDeplacerCTick.UseVisualStyleBackColor = true; + this.btnStopDeplacerCTick.Click += new System.EventHandler(this.btnStopDeplacerCTick_Click); + // + // btnCreationCarrosse + // + this.btnCreationCarrosse.Location = new System.Drawing.Point(13, 276); + this.btnCreationCarrosse.Name = "btnCreationCarrosse"; + this.btnCreationCarrosse.Size = new System.Drawing.Size(782, 23); + this.btnCreationCarrosse.TabIndex = 11; + this.btnCreationCarrosse.Text = "Creer Carrosse"; + this.btnCreationCarrosse.UseVisualStyleBackColor = true; + this.btnCreationCarrosse.Click += new System.EventHandler(this.btnCreationCarrosse_Click); + // + // EcranAccueil + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(807, 415); + this.Controls.Add(this.btnCreationCarrosse); + this.Controls.Add(this.btnEffacer); + this.Controls.Add(this.btnStopDeplacerCTick); + this.Controls.Add(this.TV); + this.Name = "EcranAccueil"; + this.Text = "Dessins Animés"; + ((System.ComponentModel.ISupportInitialize)(this.TV)).EndInit(); + this.ResumeLayout(false); + + + + } + + #endregion + + private System.Windows.Forms.PictureBox TV; + private System.Windows.Forms.Timer timerImage; + private System.Windows.Forms.Button btnEffacer; + private System.Windows.Forms.Button btnStopDeplacerCTick; + private System.Windows.Forms.Button btnCreationCarrosse; + } +} + diff --git a/Bonhomme02/Form1.cs b/Bonhomme02/Form1.cs new file mode 100644 index 0000000..cf99706 --- /dev/null +++ b/Bonhomme02/Form1.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Bonhomme02 +{ + public partial class Form1 : Form + { + private Bonhomme bonhomme; + private Peau test; + private BufferedGraphics bufferG = null; + private Graphics g; + public Form1() + { + InitializeComponent(); + // Modification contre le scintillement - Creation d'une mémoire tampon graphique + bufferG = BufferedGraphicsManager.Current.Allocate(TV.CreateGraphics(), TV.DisplayRectangle); + g = bufferG.Graphics; + } + + private void timerImage_Tick(object sender, EventArgs e) + { + if (/*this.bonhomme.Origine.X + this.bonhomme.Lhorizontal >= this.TV.Width*/1==1) + { + this.timerImage.Stop(); + this.btnStopDeplacerCTick.Enabled = false; + } + else + { + } + } + + private void btnStopDeplacerCTick_Click(object sender, EventArgs e) + { + this.timerImage.Stop(); + this.btnStopDeplacerCTick.Enabled = false; + } + + private void btnEffacer_Click(object sender, EventArgs e) + { + Graphics gr = Graphics.FromHwnd(this.TV.Handle); + gr.FillRectangle(new SolidBrush(this.TV.BackColor), 0, 0, this.TV.Bounds.Width, this.TV.Bounds.Height); + } + + private void btnCreationCarrosse_Click(object sender, EventArgs e) + { + test = new Peau(this.TV, 80, 80, 10, 10, Math.PI/2); + test.Afficher(this.TV.Handle); + } + } +} diff --git a/Bonhomme02/Jambe.cs b/Bonhomme02/Jambe.cs new file mode 100644 index 0000000..d0db1fc --- /dev/null +++ b/Bonhomme02/Jambe.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Bonhomme02 +{ + class Jambe : BaseBJ + { + } +} diff --git a/Bonhomme02/Peau.cs b/Bonhomme02/Peau.cs new file mode 100644 index 0000000..bf61651 --- /dev/null +++ b/Bonhomme02/Peau.cs @@ -0,0 +1,123 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Bonhomme02 +{ + class Peau : BaseDessin + { + Vecteur epaisseur; + Vecteur longueur; + public Peau() : base() + { + + } + + public Peau(PictureBox hebergeur) : base(hebergeur) + { + } + + public Peau(PictureBox hebergeur, int xy) : base(hebergeur, xy) + { + } + + public Peau(PictureBox hebergeur, int x, int y, double lg, double ep, double angle) : base(hebergeur,x, y) + { + InitVecteurs(lg, ep, angle); + } + public Peau(int x, int y) : base(x, y) + { + } + public Peau(PictureBox hebergeur, int xy, Color crayon) : base(hebergeur, xy, crayon) + { + } + + public Peau(PictureBox hebergeur, int x, int y, Color crayon) : base(hebergeur, x, y, crayon) + { + } + + #region accesseur + public Point CIG{ get{ return base.coordonnee - epaisseur; }} + public Point CID{ get{ return base.coordonnee + epaisseur; }} + public Point CSG{ get{ return (base.coordonnee - epaisseur) + longueur; }} + public Point CSD{ get{ return (base.coordonnee + epaisseur) + longueur; }} + #endregion + + #region methode + private void InitVecteurs(double lg, double ep, double angle) + { + this.longueur = new Vecteur(lg, angle); + this.epaisseur = new Vecteur(ep, ref this.longueur, true); + + } + + public override void Afficher(IntPtr handle) + { + if(base.Visible) + { + try + { + Graphics gr = Graphics.FromHwnd(handle); + Point[] l = new Point[4] { CIG, CID, CSD, CSG }; + if (base.Remplir || 1==1) + { + try + { + gr.FillPolygon(new SolidBrush(Color.Blue), l); + //gr.FillPolygon + } + catch + { + + } + + } + gr.DrawPolygon(new Pen(Brushes.Black), l); + } + catch + { + + } + } + } + /*public override public void Afficher(IntPtr handle, float angle) + { + this.angleRotation = angle; + if (visible) + { + Graphics gr = Graphics.FromHwnd(handle); + Point[] l = new Point[4] { CSG, CSD, CID, CIG }; + if (remplir) + { + gr.FillClosedCurve(new SolidBrush(fond), l); + } + gr.DrawClosedCurve(new Pen(contour, eppaisseurContour), l); + } + }*/ + public override void Cacher(IntPtr handle) + { + try + { + if (base.Visible && 1 == 1) + { + Graphics gr = Graphics.FromHwnd(handle); + Point[] l = new Point[4] { CSG, CSD, CID, CIG }; + if (base.Remplir) + { + gr.FillClosedCurve(new SolidBrush(base.Fond), l); + } + gr.DrawClosedCurve(new Pen(Brushes.Black), l); + } + } + catch + { + + } + } + #endregion + } +} diff --git a/Bonhomme02/Program.cs b/Bonhomme02/Program.cs new file mode 100644 index 0000000..016223a --- /dev/null +++ b/Bonhomme02/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Bonhomme02 +{ + static class Program + { + /// + /// Point d'entrée principal de l'application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/Bonhomme02/Properties/AssemblyInfo.cs b/Bonhomme02/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..b5fac35 --- /dev/null +++ b/Bonhomme02/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Les informations générales relatives à un assembly dépendent de +// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations +// associées à un assembly. +[assembly: AssemblyTitle("Bonhomme02")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Bonhomme02")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly +// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de +// COM, affectez la valeur true à l'attribut ComVisible sur ce type. +[assembly: ComVisible(false)] + +// Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM +[assembly: Guid("b3c7d374-80da-45f0-b97f-6320169c1be7")] + +// Les informations de version pour un assembly se composent des quatre valeurs suivantes : +// +// Version principale +// Version secondaire +// Numéro de build +// Révision +// +// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut +// en utilisant '*', comme indiqué ci-dessous : +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Bonhomme02/Properties/Resources.Designer.cs b/Bonhomme02/Properties/Resources.Designer.cs new file mode 100644 index 0000000..8ddafee --- /dev/null +++ b/Bonhomme02/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// Ce code a été généré par un outil. +// Version du runtime :4.0.30319.42000 +// +// Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si +// le code est régénéré. +// +//------------------------------------------------------------------------------ + +namespace Bonhomme02.Properties +{ + + + /// + /// Une classe de ressource fortement typée destinée, entre autres, à la consultation des chaînes localisées. + /// + // Cette classe a été générée automatiquement par la classe StronglyTypedResourceBuilder + // à l'aide d'un outil, tel que ResGen ou Visual Studio. + // Pour ajouter ou supprimer un membre, modifiez votre fichier .ResX, puis réexécutez ResGen + // avec l'option /str ou régénérez votre projet VS. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Retourne l'instance ResourceManager mise en cache utilisée par cette classe. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Bonhomme02.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Remplace la propriété CurrentUICulture du thread actuel pour toutes + /// les recherches de ressources à l'aide de cette classe de ressource fortement typée. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/Bonhomme02/Properties/Resources.resx b/Bonhomme02/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Bonhomme02/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Bonhomme02/Properties/Settings.Designer.cs b/Bonhomme02/Properties/Settings.Designer.cs new file mode 100644 index 0000000..4f56810 --- /dev/null +++ b/Bonhomme02/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Bonhomme02.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/Bonhomme02/Properties/Settings.settings b/Bonhomme02/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Bonhomme02/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Bonhomme02/Tete.cs b/Bonhomme02/Tete.cs new file mode 100644 index 0000000..2137328 --- /dev/null +++ b/Bonhomme02/Tete.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Bonhomme02 +{ + class Tete + { + } +} diff --git a/Bonhomme02/Vecteur.cs b/Bonhomme02/Vecteur.cs new file mode 100644 index 0000000..732a681 --- /dev/null +++ b/Bonhomme02/Vecteur.cs @@ -0,0 +1,94 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Numerics; +using System.Text; +using System.Threading.Tasks; + +namespace Bonhomme02 +{ + class Vecteur + { + #region donnée + private Vecteur parent = null; + private Complex vecteur; + #endregion + #region accesseur + public double Angle + { + get + { + if (parent != null) + return parent.Angle - Math.PI/2; + else + return vecteur.Phase; + } + set + { + if (parent != null) + Console.WriteLine("Erreur : La définition de l'angle d'un enfant ne peut-être fait !"); + else + vecteur = Complex.FromPolarCoordinates(vecteur.Magnitude, value); + } + } + + public int X + { + get + { + return (int)vecteur.Real; + } + } + public int Y + { + get + { + return (int)vecteur.Imaginary; + } + } + #endregion + #region constructeur + public Vecteur() + { + + } + public Vecteur(double longueur, double angle) + { + vecteur = Complex.FromPolarCoordinates(longueur, angle); + } + public Vecteur(double longueur, ref Vecteur parent, bool flag) : this(longueur, parent.Angle - Math.PI / 2) + { + this.parent = parent; + } + #region operateur + public static explicit operator Point(Vecteur v) // Rsique de perte de précision donc explicit + { + return new Point(v.X, v.Y); + } + public static implicit operator Vecteur(Point pt) + { + Complex c = new Complex(pt.X, pt.Y); + return new Vecteur(c.Magnitude, c.Phase); + } + public static Point operator +(Vecteur v, Point pt) + { + return new Point(v.X + pt.X, v.Y + pt.Y); + } + public static Point operator +(Point pt, Vecteur v) + { + return new Point(v.X + pt.X, v.Y + pt.Y); + } + public static Point operator -(Vecteur v, Point pt) + { + return new Point(v.X - pt.X, v.Y - pt.Y); + } + public static Point operator -(Point pt, Vecteur v) + { + return new Point(pt.X - v.X, pt.Y - v.Y); + } + #endregion + + } +#endregion +} diff --git a/Bonhomme02/Vecteur_.cs b/Bonhomme02/Vecteur_.cs new file mode 100644 index 0000000..226c7d3 --- /dev/null +++ b/Bonhomme02/Vecteur_.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Bonhomme02 +{ + class Vecteur_ + { + } +}