Avancer Ok sur un pied, non fini

This commit is contained in:
adri 2018-01-05 22:18:28 +01:00
parent 9ca3a893e9
commit 41a9223041
6 changed files with 157 additions and 36 deletions

View File

@ -39,9 +39,13 @@ namespace Bonhomme02
public new void Afficher(IntPtr handle)
{
Haut.Afficher(handle);
Millieux.Afficher(handle);
Bas.Afficher(handle);
if(base.Visible)
{
Haut.Afficher(handle);
Millieux.Afficher(handle);
Bas.Afficher(handle);
}
}
public new void Cacher(IntPtr handle)
{
@ -102,6 +106,12 @@ namespace Bonhomme02
Millieux.Angle = TrouverAngleMillieux(nouveauPtBas);
}
}
public void SetAngle(double h, double m, double b)
{
Haut.Angle = h;
Millieux.Angle = m;
Bas.Angle = b;
}
}
}

View File

@ -48,6 +48,7 @@
<ItemGroup>
<Compile Include="BaseBJ.cs" />
<Compile Include="BaseDessin.cs" />
<Compile Include="Marcher.cs" />
<Compile Include="Pied.cs" />
<Compile Include="Vecteur.cs" />
<Compile Include="Bonhomme.cs" />
@ -74,6 +75,7 @@
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
@ -88,5 +90,8 @@
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\moon.jpg" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -34,12 +34,14 @@
this.btnEffacer = new System.Windows.Forms.Button();
this.btnStopDeplacerCTick = new System.Windows.Forms.Button();
this.btnCreationCarrosse = new System.Windows.Forms.Button();
this.Sol = new System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)(this.TV)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.Sol)).BeginInit();
this.SuspendLayout();
//
// TV
//
this.TV.Location = new System.Drawing.Point(13, 13);
this.TV.Location = new System.Drawing.Point(12, 13);
this.TV.Name = "TV";
this.TV.Size = new System.Drawing.Size(782, 449);
this.TV.TabIndex = 0;
@ -81,18 +83,32 @@
this.btnCreationCarrosse.UseVisualStyleBackColor = true;
this.btnCreationCarrosse.Click += new System.EventHandler(this.btnCreationCarrosse_Click);
//
// Sol
//
this.Sol.BackgroundImage = global::Bonhomme02.Properties.Resources.moon;
this.Sol.InitialImage = global::Bonhomme02.Properties.Resources.moon;
this.Sol.Location = new System.Drawing.Point(12, 415);
this.Sol.Name = "Sol";
this.Sol.Size = new System.Drawing.Size(782, 47);
this.Sol.TabIndex = 12;
this.Sol.TabStop = false;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(807, 538);
this.Controls.Add(this.Sol);
this.Controls.Add(this.btnCreationCarrosse);
this.Controls.Add(this.btnEffacer);
this.Controls.Add(this.btnStopDeplacerCTick);
this.Controls.Add(this.TV);
this.Name = "Form1";
this.Text = "Dessins Animés";
this.Load += new System.EventHandler(this.Form1_Load);
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseMove);
((System.ComponentModel.ISupportInitialize)(this.TV)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.Sol)).EndInit();
this.ResumeLayout(false);
}
@ -104,6 +120,7 @@
private System.Windows.Forms.Button btnEffacer;
private System.Windows.Forms.Button btnStopDeplacerCTick;
private System.Windows.Forms.Button btnCreationCarrosse;
private System.Windows.Forms.PictureBox Sol;
}
}

View File

@ -1 +1,81 @@
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 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==2) { this.timerImage.Stop(); this.btnStopDeplacerCTick.Enabled = false; } else { bonhomme.Cacher(this.TV.Handle); bonhomme.coordonnee = new Point(bonhomme.coordonnee.X + 3, bonhomme.coordonnee.Y + 0); bonhomme.jambe1.Bouger(+3, -3); bonhomme.Afficher(this.TV.Handle); } } 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) { bonhomme = new Bonhomme(this.TV, 80, 80, 50, 20, Math.PI / 2); bonhomme.Afficher(this.TV.Handle); this.btnStopDeplacerCTick.Enabled = true; this.timerImage.Start(); } } }
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Bonhomme02
{
public partial class Form1 : Form
{
private Bonhomme bonhomme;
private Marcher marche;
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==2)
{
this.timerImage.Stop();
this.btnStopDeplacerCTick.Enabled = false;
}
else
{
bonhomme.Cacher(this.TV.Handle);
bonhomme.coordonnee = new Point(bonhomme.coordonnee.X + 3, bonhomme.coordonnee.Y + 0);
bonhomme.jambe1.Bouger(+3, -3);
bonhomme.Afficher(this.TV.Handle);
}
}
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)
{
bonhomme = new Bonhomme(this.TV, 80, 80, 50, 20, Math.PI / 2);
bonhomme.Afficher(this.TV.Handle);
marche = new Marcher(ref bonhomme, this.TV.Handle, this.Sol.Location.Y-this.TV.Location.Y);
Thread.Sleep(1000);
Task.Factory.StartNew(() => marche.Avancer(5));
//this.btnStopDeplacerCTick.Enabled = true;
// this.timerImage.Start();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void Form1_MouseMove(object sender, MouseEventArgs e)
{
MousePosition.Offset(this.Location);
Console.WriteLine(MousePosition);
}
}
}

View File

@ -8,10 +8,10 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace Bonhomme02.Properties
{
namespace Bonhomme02.Properties {
using System;
/// <summary>
/// Une classe de ressource fortement typée destinée, entre autres, à la consultation des chaînes localisées.
/// </summary>
@ -19,53 +19,55 @@ namespace Bonhomme02.Properties
// à 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.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
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()
{
internal Resources() {
}
/// <summary>
/// Retourne l'instance ResourceManager mise en cache utilisée par cette classe.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Bonhomme02.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Remplace la propriété CurrentUICulture du thread actuel pour toutes
/// les recherches de ressources à l'aide de cette classe de ressource fortement typée.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set
{
set {
resourceCulture = value;
}
}
/// <summary>
/// Recherche une ressource localisée de type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap moon {
get {
object obj = ResourceManager.GetObject("moon", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@ -46,7 +46,7 @@
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
@ -60,6 +60,7 @@
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
@ -68,9 +69,10 @@
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
@ -85,9 +87,10 @@
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
@ -109,9 +112,13 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="moon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\moon.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>