73 lines
2.5 KiB
C#
73 lines
2.5 KiB
C#
|
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 Bonhomme01
|
|||
|
{
|
|||
|
public partial class Form1 : Form
|
|||
|
{
|
|||
|
private Bonhomme bonhomme;
|
|||
|
|
|||
|
private BufferedGraphics bufferG = null;
|
|||
|
private Graphics g;
|
|||
|
Jambe.AngleJambe angleJ1 = new Jambe.AngleJambe(-45, 45, 0);
|
|||
|
Jambe.AngleJambe angleJ2 = new Jambe.AngleJambe(-45, 45, 0);
|
|||
|
Jambe.AngleJambe brasJ1 = new Jambe.AngleJambe(-90, -90, -90);
|
|||
|
Jambe.AngleJambe brasJ2 = new Jambe.AngleJambe(-90, -90, -90);
|
|||
|
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)
|
|||
|
{
|
|||
|
this.timerImage.Stop();
|
|||
|
this.btnStopDeplacerCTick.Enabled = false;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
this.bonhomme.Cacher(this.TV.Handle);
|
|||
|
//angleJ1.AngleBassin += 1;
|
|||
|
//angleJ1.AngleCheville = angleJ1.AngleGenou += 2;
|
|||
|
//angleJ2.AngleBassin -= 1;
|
|||
|
//angleJ2.AngleCheville = angleJ2.AngleGenou -= 2;
|
|||
|
this.bonhomme.Cacher(this.TV.Handle);
|
|||
|
this.bonhomme.Bouger(1, 0, angleJ1, angleJ2);
|
|||
|
this.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)
|
|||
|
{
|
|||
|
this.bonhomme = new Bonhomme(TV, TV.Location, 30, 60);
|
|||
|
this.bonhomme.Bouger(0, 0, angleJ1, angleJ2);
|
|||
|
this.bonhomme.Afficher(this.TV.Handle);
|
|||
|
this.btnStopDeplacerCTick.Enabled = true;
|
|||
|
this.timerImage.Start();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|