<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>blog tequilarapido. &#187; Techno</title>
	<atom:link href="http://blog.tequilarapido.com/category/techno/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.tequilarapido.com</link>
	<description>Les usages numériques vus par les collaborateurs de tequilarapido.</description>
	<lastBuildDate>Mon, 30 Jan 2012 15:13:53 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>L&#8217;Open Graph Facebook, engagement &amp; rétention</title>
		<link>http://blog.tequilarapido.com/2012/01/27/open-graph-facebook-engagement/</link>
		<comments>http://blog.tequilarapido.com/2012/01/27/open-graph-facebook-engagement/#comments</comments>
		<pubDate>Fri, 27 Jan 2012 16:00:30 +0000</pubDate>
		<dc:creator>Olivier Rondet</dc:creator>
				<category><![CDATA[Médias sociaux]]></category>
		<category><![CDATA[Techno]]></category>
		<category><![CDATA[Webmarketing]]></category>

		<guid isPermaLink="false">http://blog.tequilarapido.com/?p=4744</guid>
		<description><![CDATA[Déployer Open Graph, c&#8217;est rendre social son site &#8211; c&#8217;est à dire délivrer une expérience fluide et personnalisée qui soit propre à chacun. Une marque peut augmenter ainsi significativement sa capacité à engager ses audiences et ses communautés en ligne. Et le suivre très simplement avec comme métrique, le temps de visite et comme indicateur [...]]]></description>
			<content:encoded><![CDATA[<p>Déployer <a title="Open Graph" href="http://www.slideshare.net/tequilarapido/open-graph-facebook">Open Graph</a>, c&#8217;est rendre social son site &#8211; c&#8217;est à dire délivrer une expérience fluide et personnalisée qui soit propre à chacun. Une marque peut augmenter ainsi significativement sa capacité à engager ses audiences et ses communautés en ligne. Et le suivre très simplement avec comme métrique, le temps de visite et comme indicateur <a title="supervizin" href="http://superviz.in" target="_blank">le taux d&#8217;engagement</a>.</p>
<p><img title="Pourquoi déployer Open Graph?" src="http://www.allfacebook.com/wordpress/wp-content/uploads/2012/01/GigyaInfographic.jpg" alt="Open Graph infographic" width="570" height="2579" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tequilarapido.com/2012/01/27/open-graph-facebook-engagement/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>7 conseils pour réussir sur Foursquare</title>
		<link>http://blog.tequilarapido.com/2011/11/07/7-conseils-pour-reussir-sur-foursquare/</link>
		<comments>http://blog.tequilarapido.com/2011/11/07/7-conseils-pour-reussir-sur-foursquare/#comments</comments>
		<pubDate>Mon, 07 Nov 2011 17:06:08 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[Médias sociaux]]></category>
		<category><![CDATA[Techno]]></category>
		<category><![CDATA[Usages émergeants]]></category>

		<guid isPermaLink="false">http://blog.tequilarapido.com/?p=4535</guid>
		<description><![CDATA[Carmine Gallo est consultant, journaliste, expert en communication américain (auteur de l&#8217;ouvrage The Presentation Secrets of Steve Jobs) publie un intéressant Slideshare sur Le pouvoir de Foursquare.
Au-delà du titre à l&#8217;américaine, cette présentation regorge d&#8217;informations pratiques et de tips pour tous ceux qui s&#8217;intéressent à Foursquare.
Ainsi, nous avons droit à quelques statistiques montrant le succès [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.carminegallo.com/">Carmine Gallo</a> est consultant, journaliste, expert en communication américain (auteur de l&#8217;ouvrage <a href="http://gallocommunications.com/books/the-presentation-secrets-of-steve-jobs/" target="_blank">The Presentation Secrets of Steve Jobs</a>) publie un intéressant Slideshare sur <a href="http://www.slideshare.net/cvgallo/the-power-of-foursquare-9651408" target="_blank">Le pouvoir de Foursquare</a>.</p>
<p>Au-delà du titre à l&#8217;américaine, cette présentation <strong>regorge d&#8217;informations pratiques et de tips pour tous ceux qui s&#8217;intéressent à Foursquare.</strong></p>
<p>Ainsi, nous avons droit à quelques statistiques montrant le succès de la plateforme aux USA :</p>
<p>-<strong> 40% des adolescents américains</strong> utilisent un service de géolocalisation comme 4square.</p>
<p>- L&#8217;année 2010 comptabilise<strong> 381 00 000 check-ins </strong></p>
<p>- <strong>1 million de personnes checkent tous les jours</strong> à travers le monde</p>
<p>- Il n&#8217;y a pas moins de <strong>23 check-in par secondes</strong> dans le monde entier</p>
<p>Après avoir posé le contexte, Carmine Gallo pose 7<strong> conseils aux marques pour maximiser leurs potentiels de réussite sur Foursquare : </strong></p>
<p><strong>1) Connectez votre marque </strong>: le plus évident et le premier pas</p>
<div><a href="http://blog.tequilarapido.com/wp-content/uploads/2011/11/corcoran.jpg"><img class="aligncenter size-medium wp-image-4540" title="corcoran" src="http://blog.tequilarapido.com/wp-content/uploads/2011/11/corcoran-300x225.jpg" alt="corcoran" width="300" height="225" /></a><br />
Reprenant l&#8217;exemple du plus grand groupe immobilier américain<strong> <a href="http://www.corcoran.com/" target="_blank">The Corcoran Group</a></strong>, le consultant explique comment la marque a utilisé la force de la géolocalisation et le conseil local pour<strong> indiquer la localisation de ses biens en ventes, les bons plans quartiers par quartiers à New York</strong>.</div>
<div>Pour le directeur marketing du groupe immobilier, cette présence sur Foursquare est une extension &laquo;&nbsp;fun, utile et lui permettant d&#8217;impacter son coeur de cible&nbsp;&raquo;.</div>
<div>
<p><strong>2) Travaillez votre façon d&#8217;acquérir de nouveaux followers</strong></p>
<p>Foursquare suggère <strong>7 idées différentes pour :</strong></p>
<p>- attirer de nouveaux consommateurs<br />
- récompenser les utilisateurs qui checkent déjà dans votre lieu<br />
- utiliser tous vos supports offline pour relayer votre présence digitale</p>
<p>Exemples : 1 check = 1 produit offert / Le maire d&#8217;un lieu est récompensé par un menu gratuit (30 jours de checkin à la suite)</p>
<p>A noter que la <strong>seule limite pour les &laquo;&nbsp;Tips&nbsp;&raquo; est votre créativité&#8230; et le détail en</strong> <strong>slide 23.</strong></p>
<p><strong>3) Engagez votre communauté</strong></p>
<p><strong><a href="http://blog.tequilarapido.com/wp-content/uploads/2011/11/UC-.jpg"><img class="aligncenter size-medium wp-image-4541" title="UC" src="http://blog.tequilarapido.com/wp-content/uploads/2011/11/UC--300x226.jpg" alt="UC" width="300" height="226" /></a></strong></p>
<div id="_mcePaste" style="font-weight: bold; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">- Connectez votre marque : The Corcoran Group</div>
<div id="_mcePaste" style="font-weight: bold; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Le plus grand groupe immobilier américain donne des conseils spécialisés</div>
<p><strong>L&#8217;UC Berkeley</strong> est une des nombreuses <strong>universités américaines à utiliser Foursquare pour engager ses élèves, ses professeurs, les parents et les visiteurs à travers un guide touristique digital</strong>. Ainsi sur chaque lieux particuliers du campus, l&#8217;université a renseigné un certain nombre d&#8217;informations sur l&#8217;histoire et la vie du bâtiment en question.</p>
<p>L&#8217;objectif étant pour la direction de créer une&nbsp;&raquo; véritable relation dans un espace virtuel&nbsp;&raquo;.</p>
<p><strong>4) Récompenser sa communauté</strong></p>
<p>Un constat soulevé par le créateur de 4square, Naveen Selvadurai :<strong> &laquo;&nbsp;Quand vous êtes le maire d&#8217;un lieu, vous vous sentez la personne la plus cool pendant 5 minutes. Et quelle reconnaissance avez-vous pour cela ?</strong></p>
<p>Et de prendre l&#8217;exemple du très prisé restaurant <strong><a href="http://www.missshirleys.com/" target="_blank">Miss Shirley&#8217;s</a> à Baltimore qui a réussi à retourner son principal défaut comme un avantage et un moyen de fidélisation</strong> de sa clientèle : se servir des 2 heures d&#8217;habituelles pour avoir une table et proposer&#8230; aucun temps d&#8217;attente au maire du restaurant !</p>
<p>On imagine la bataille virtuelle entre les utilisateurs&#8230; !</p>
<p><strong>5) Avoir un temps d&#8217;avance sur vos concurrents</strong></p>
<p style="font-weight: bold;"><a href="http://blog.tequilarapido.com/wp-content/uploads/2011/11/SORGE.jpg"><img class="aligncenter size-medium wp-image-4542" title="SORGE" src="http://blog.tequilarapido.com/wp-content/uploads/2011/11/SORGE-300x226.jpg" alt="SORGE" width="300" height="226" /></a></p>
<p>Carmine Gallo se concentre sur l&#8217;histoire d&#8217;un jeune homme, Luke Holden. Ayant quitté son job à Wall Street en 2009 pour se consacrer à sa passion, la restauration (comme dans une bonne success story américaine), il montre comment <strong>Luke a réussi à générer 11 000 checkins </strong>dans ses 3 restaurants en seulement 2 ans.</p>
<p>Comment ? Grâce à un <strong>mix équilibré entre expérience, évènement et émotions afin d&#8217;impliquer totalement son consommateur (slide 56).</strong></p>
<p><strong>6) Incitez vos consommateurs à checker le plus possible</strong></p>
<p style="font-weight: bold;"><a href="http://blog.tequilarapido.com/wp-content/uploads/2011/11/straw-pizza.jpg"><img class="aligncenter size-medium wp-image-4538" title="straw pizza" src="http://blog.tequilarapido.com/wp-content/uploads/2011/11/straw-pizza-300x225.jpg" alt="straw pizza" width="300" height="225" /></a></p>
<p><strong><a href="http://earthjustice.org/" target="_blank">Earthjustice</a></strong>, une association à but non lucratif en Californie a placé un<strong> billboard dans une station de métro afin de générer des dons pour la protection de l&#8217;environnement</strong>.</p>
<p>La mécanique : il suffisait de checker devant le billboard et un don de 10 dollars était automatiquement reversé à l&#8217;association.</p>
<p><strong>Total : 50 000 dollars récoltés en quelques semaines.</strong> On imagine évidemment qu&#8217;une telle opérations n&#8217;a pas pu se faire sans partenaires.</p>
<p>Autre exemple avec<strong> Straw Hat Pizza</strong> une chaîne de pizzeria en Californie du Nord qui a vu ses campagnes promotionnelles avec un <strong>meilleur ROI sur Foursquare par rapport à ses e-mailing traditionnels. </strong></p>
<p><strong>7) Ne jamais arrêter de distraire sa communauté</strong></p>
<p><a href="http://blog.tequilarapido.com/wp-content/uploads/2011/11/choo.jpg"><img class="aligncenter size-medium wp-image-4543" title="choo" src="http://blog.tequilarapido.com/wp-content/uploads/2011/11/choo-300x223.jpg" alt="choo" width="300" height="223" /></a></p>
<p><strong>Jimmy Choo</strong>, la marque de luxe des fashionistas, a organisé une chasse au trésor dans les rues de Londres en utilisant Foursquare. L&#8217;idée : suivre une liste de check-in et de lieux conseillés par la marque pour suive une paire de Jimmy Choo. La gagnante remporte évidemment une paire de Jimmy Choo.</p>
<p><strong> Résultat : 4 000 participants (slide 75).</strong></p>
<p>Retrouvez l&#8217;ensemble du Slideshare en anglais par <a href="http://www.slideshare.net/cvgallo/the-power-of-foursquare-9651408">ici</a>.</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.tequilarapido.com/2011/11/07/7-conseils-pour-reussir-sur-foursquare/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Développer en AIR pour le Blackberry PlayBook</title>
		<link>http://blog.tequilarapido.com/2010/11/19/developper-en-air-pour-le-blackberry-playbook/</link>
		<comments>http://blog.tequilarapido.com/2010/11/19/developper-en-air-pour-le-blackberry-playbook/#comments</comments>
		<pubDate>Fri, 19 Nov 2010 14:02:07 +0000</pubDate>
		<dc:creator>Mathieu Bossan</dc:creator>
				<category><![CDATA[Interfaces riches]]></category>
		<category><![CDATA[L'agence]]></category>
		<category><![CDATA[Techno]]></category>
		<category><![CDATA[Usages émergeants]]></category>

		<guid isPermaLink="false">http://blog.tequilarapido.com/?p=3913</guid>
		<description><![CDATA[RIM a dévoilé il y a quelques mois son Blackberry PlayBook, une tablette dotée de spécifications techniques exceptionnelles et d&#8217;un support complet des technologies flash (en tant qu&#8217;applications AIR ainsi qu&#8217;en navigation web).
Avec le choix judicieux d&#8217;ouvrir son market place (appworld) aux quelques 3 millions de développeurs Flash, le PlayBook va sans aucun doute bousculer [...]]]></description>
			<content:encoded><![CDATA[<p>RIM a dévoilé il y a quelques mois son Blackberry PlayBook, une tablette dotée de spécifications techniques exceptionnelles et d&#8217;un support complet des technologies flash (en tant qu&#8217;applications AIR ainsi qu&#8217;en navigation web).</p>
<p>Avec le choix judicieux d&#8217;ouvrir son market place (appworld) aux quelques 3 millions de développeurs Flash, le PlayBook va sans aucun doute bousculer le marché actuel de la tablette.</p>
<p><span id="more-3913"></span></p>
<p>Si la tablette vous motive et que vous voulez commencer à développer, sachez que la sortie du PlayBook est prévue pour le début d&#8217;année 2011, mais le SDK et le simulateur sont dores et déjà disponibles. De plus, pour motiver les développeurs à sortir des applications avant la sortie, RIM a fait une annonce extraordinaire durant <a href="http://devblog.blackberry.com/2010/10/blackberry-playbook-demo-highlights-from-adobe-max/" target="_blank">la première présentation live du produit</a> à la conférence ADOBE Max:</p>
<p><strong>Si votre application est acceptée sur l&#8217;appWorld avant la sortie du produit, vous recevrez un Blackberry PlayBook gratuit ! </strong><br />
Plus de détails ici : <a href="http://devblog.blackberry.com/2010/10/blackberry-playbook-developer-promotion-information/" target="_blank">http://devblog.blackberry.com/2010/10/blackberry-playbook-developer-promotion-information/</a></p>
<p>Pour commencer à développer, vous trouverez les ressources nécessaires ici :<a href="http://us.blackberry.com/developers/tablet/" target="_blank"><br />
</a><a href="http://us.blackberry.com/developers/tablet/" target="_blank">http://us.blackberry.com/developers/tablet/</a></p>
<p>et ici :<br />
<a href="http://us.blackberry.com/developers/tablet/devresources.jsp" target="_blank">http://us.blackberry.com/developers/tablet/devresources.jsp</a></p>
<p>Et pour en savoir plus sur cette magnifique tablette, rendez-vous ici :<br />
<a href="http://us.blackberry.com/playbook-tablet/" target="_blank">http://us.blackberry.com/playbook-tablet/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tequilarapido.com/2010/11/19/developper-en-air-pour-le-blackberry-playbook/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Créez un template de ListBox</title>
		<link>http://blog.tequilarapido.com/2010/10/27/creez-un-template-de-listbox/</link>
		<comments>http://blog.tequilarapido.com/2010/10/27/creez-un-template-de-listbox/#comments</comments>
		<pubDate>Wed, 27 Oct 2010 12:47:31 +0000</pubDate>
		<dc:creator>Yann Gilliot</dc:creator>
				<category><![CDATA[L'agence]]></category>
		<category><![CDATA[Techno]]></category>
		<category><![CDATA[listbox]]></category>
		<category><![CDATA[phone]]></category>
		<category><![CDATA[template]]></category>
		<category><![CDATA[wp7]]></category>

		<guid isPermaLink="false">http://blog.tequilarapido.com/?p=3869</guid>
		<description><![CDATA[Silverlight offre la possibilité de modifier à sa guise l’aspect  graphique des composants. C’est pourquoi, je vous propose de modifier   une listbox et de la faire ressembler… à une Voiture !!
Le but étant de faire en sorte que chaque pièce auto soit un listboxItem de notre listbox.


Etape 1
Commençons par une petite séance d’observation.
Récupérez  le fichier [...]]]></description>
			<content:encoded><![CDATA[<p>Silverlight offre la possibilité de modifier à sa guise l’aspect  graphique des composants. C’est pourquoi, je vous propose de modifier   une listbox et de la faire ressembler… à une Voiture !!</p>
<p>Le but étant de faire en sorte que chaque pièce auto soit un listboxItem de notre listbox.</p>
<p><span id="more-3869"></span></p>
<p><img title="Lire la suite…" src="http://london.tequilarapido.net/wp-includes/js/tinymce/plugins/wordpress/img/trans.gif" alt="" /></p>
<p><strong>Etape 1</strong></p>
<p>Commençons par une petite séance d’observation.</p>
<p>Récupérez  le fichier <a href="http://blog.tequilarapido.com/wp-content/uploads/2010/10/yellow-car.zip">Design de la voiture ici</a> et ouvrez-le avec Expression Design (pour l’article nous utiliserons  Expression Design 3). Voici ce que vous devriez voir apparaître :</p>
<p><a href="http://blog.tequilarapido.com/wp-content/uploads/2010/10/Design.png"><img class="alignnone size-medium wp-image-3877" title="Design" src="http://blog.tequilarapido.com/wp-content/uploads/2010/10/Design-300x180.png" alt="Design" width="300" height="180" /></a></p>
<p>Comme  vous pouvez le voir la voiture est composée d’une multitude d’objets  (cadre rouge). Dans la prochaine étape nous nous occuperons de regrouper  ces objets en parties voiture (ou pas pour les fainéants).</p>
<p>Exportez le fichier (Fichier/Exporter…) au format « Canevas XAML Silverlight 3 ».</p>
<p><strong>Etape 2</strong></p>
<p>Avec  Expression Blend 4 (version Windows Phone) créez un nouveau projet  Windows Phone que l’on nommera « TutoVoiture » (remarquez  l’originalité), et ajoutez le fichier XAML fraichement exporté au  projet.</p>
<p>Affichez ce fichier XAML (yellow-car.xaml). Pour  délimiter clairement les parties de la voiture, nous allons regrouper  dans des canvas (chassis, roue avant/arriere, vitres, retro) chaque path  du XAML. Cette opération étant longue et fastidieuse, je vous encourage  fortement à récupérer le fichier fini ici : <a href="http://blog.tequilarapido.com/wp-content/uploads/2010/10/yellow-car1.zip">YellowCar.xaml</a>.</p>
<p>Et voilà à quoi doit ressembler le fichier.</p>
<p><a href="http://blog.tequilarapido.com/wp-content/uploads/2010/10/YellowCarXAML.png"><img class="alignnone size-medium wp-image-3880" title="YellowCarXAML" src="http://blog.tequilarapido.com/wp-content/uploads/2010/10/YellowCarXAML-300x180.png" alt="YellowCarXAML" width="300" height="180" /></a></p>
<p><strong>Etape 3</strong></p>
<p>Maintenant  que le fichier est correctement mis en forme, copiez tous les canvas du  code XAML pour les coller dans le fichier App.xaml, dans la balise  &lt;Application.Resources&gt;.</p>
<p>Nous à allons présent  « DataTemplatiser » ces canvas. Englobez chacun des canvas dans un  DataTemplate qui aura pour Key le nom du canvas  (à savoir Chassis,  Vitres, RoueAvant, RoueArriere, Retro). Voici un exemple du résultat  pour le canvas Vitres :</p>
<p><a href="http://blog.tequilarapido.com/wp-content/uploads/2010/10/CanvasVitre.PNG"><img class="alignnone size-medium wp-image-3881" title="CanvasVitre" src="http://blog.tequilarapido.com/wp-content/uploads/2010/10/CanvasVitre-300x69.PNG" alt="CanvasVitre" width="300" height="69" /></a></p>
<p>Voyez  qu’il y a un petit quelque chose en plus dans ces lignes :  « Margin=&nbsp;&raquo;{Binding Converter={StaticResource ConvertPosition}}&nbsp;&raquo; »</p>
<p>Vous  pouvez d’ores et déjà l’ajouter sur chacun des canvas. Chaque  ListboxItem de notre future liste en forme de voiture, aura un  DataTemplate qui sera un de ceux de l’App.xaml et l’attribut Margin  permettra de placer notre listboxitem dans l’espace et pour cela nous  utiliserons un Converter que nous verrons plus tard.</p>
<p><strong>Etape 4</strong></p>
<p>Chaque  pièce de la voiture que nous afficherons, doit posséder des données,  c’est le but de cette ListBox, sinon une simple image aurait suffit J.  Nous allons donc maintenant créer les données qui seront associées à la  voiture.</p>
<p>Créez un nouveau dossier Model dans le projet et ajoutez-y la classe PieceCarrosserie.</p>
<p>Voila le code associé à cette classe :</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> PieceCarrosserie
<span style="color: #000000;">&#123;</span>
&nbsp;
<span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> Name <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
<span style="color: #0600FF;">public</span> <span style="color: #FF0000;">double</span> Left <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
<span style="color: #0600FF;">public</span> <span style="color: #FF0000;">double</span> Top <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0600FF;">public</span> <span style="color: #0600FF;">static</span> List<span style="color: #008000;">&amp;</span>lt<span style="color: #008000;">;</span>PieceCarrosserie<span style="color: #008000;">&amp;</span>gt<span style="color: #008000;">;</span> Mockup<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #0600FF;">return</span> <span style="color: #008000;">new</span> List<span style="color: #008000;">&amp;</span>lt<span style="color: #008000;">;</span>PieceCarrosserie<span style="color: #008000;">&amp;</span>gt<span style="color: #008000;">;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #008000;">new</span> PieceCarrosserie<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> Name <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Chassis&quot;</span>, Left<span style="color: #008000;">=</span><span style="color: #FF0000;">9.664</span>, Top <span style="color: #008000;">=</span><span style="color: #FF0000;">118.712</span> <span style="color: #000000;">&#125;</span>,
<span style="color: #008000;">new</span> PieceCarrosserie<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> Name <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Vitres&quot;</span>, Left<span style="color: #008000;">=</span><span style="color: #FF0000;">265.457</span>, Top<span style="color: #008000;">=</span><span style="color: #FF0000;">124.693</span> <span style="color: #000000;">&#125;</span>,
<span style="color: #008000;">new</span> PieceCarrosserie<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> Name <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;RoueAvant&quot;</span>, Left<span style="color: #008000;">=</span><span style="color: #FF0000;">121.516</span>, Top<span style="color: #008000;">=</span><span style="color: #FF0000;">227.142</span> <span style="color: #000000;">&#125;</span>,
<span style="color: #008000;">new</span> PieceCarrosserie<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> Name <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;RoueArriere&quot;</span>, Left<span style="color: #008000;">=</span><span style="color: #FF0000;">567.99</span>, Top<span style="color: #008000;">=</span><span style="color: #FF0000;">227.142</span> <span style="color: #000000;">&#125;</span>,
<span style="color: #008000;">new</span> PieceCarrosserie<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> Name <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Retro&quot;</span>, Left <span style="color: #008000;">=</span> <span style="color: #FF0000;">325.089</span>, Top<span style="color: #008000;">=</span><span style="color: #FF0000;">164.715</span> <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Name  sera le nom de la pièce auto, Left et Right serviront à positionner  cette pièce dans l’espace, enfin nous nous servirons de la méthode  Mockup() pour alimenter la source de la ListBox.</p>
<p><strong>Etape 5</strong></p>
<p>Nous  avons maintenant, les DataTemplates et les données, il manque encore le  Converter pour le positionnement des Canvas. Ajoutez un dossier  Converters au projet et créez la classe ConvertPosition.</p>
<p>Voilà le code associé à cette classe :</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> ConvertPosition <span style="color: #008000;">:</span> IValueConverter
<span style="color: #000000;">&#123;</span>
<span style="color: #008080;">#region IValueConverter Members</span>
<span style="color: #0600FF;">public</span> <span style="color: #FF0000;">object</span> Convert<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">object</span> value, Type targetType, <span style="color: #FF0000;">object</span> parameter, <span style="color: #000000;">System.<span style="color: #0000FF;">Globalization</span></span>.<span style="color: #0000FF;">CultureInfo</span> culture<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>value.<span style="color: #0000FF;">GetType</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">==</span> <span style="color: #008000;">typeof</span><span style="color: #000000;">&#40;</span>PieceCarrosserie<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #0600FF;">return</span> <span style="color: #008000;">new</span> Thickness<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>PieceCarrosserie<span style="color: #000000;">&#41;</span>value<span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Left</span>, <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>PieceCarrosserie<span style="color: #000000;">&#41;</span>value<span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Top</span>, <span style="color: #FF0000;">0</span>, <span style="color: #FF0000;">0</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #0600FF;">return</span> DependencyProperty.<span style="color: #0000FF;">UnsetValue</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0600FF;">public</span> <span style="color: #FF0000;">object</span> ConvertBack<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">object</span> value, Type targetType, <span style="color: #FF0000;">object</span> parameter, <span style="color: #000000;">System.<span style="color: #0000FF;">Globalization</span></span>.<span style="color: #0000FF;">CultureInfo</span> culture<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #0600FF;">return</span> value<span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #008080;">#endregion</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>N’oubliez pas d’ajouter cette classe en ressource statique dans l’App.xaml</p>
<p><strong>Etape 6</strong></p>
<p>Nous  avons encore besoin d’un élément avant de créer notre ListBox, qui  servira à appliquer le bon DataTemplate sur la bonne pièce de la  voiture. Ajoutez un dossier Lib au projet et créez la classe  DataTemplateExtensions.</p>
<p>Voilà le code associé à cette classe :</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> DataTemplateExtensions <span style="color: #008000;">:</span> ContentControl
<span style="color: #000000;">&#123;</span>
<span style="color: #0600FF;">protected</span> <span style="color: #0600FF;">override</span> <span style="color: #0600FF;">void</span> OnContentChanged<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">object</span> oldContent, <span style="color: #FF0000;">object</span> newContent<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>newContent.<span style="color: #0000FF;">GetType</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">==</span> <span style="color: #008000;">typeof</span><span style="color: #000000;">&#40;</span>PieceCarrosserie<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
ContentTemplate <span style="color: #008000;">=</span> Application.<span style="color: #0000FF;">Current</span>.<span style="color: #0000FF;">Resources</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>PieceCarrosserie<span style="color: #000000;">&#41;</span>newContent<span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Name</span><span style="color: #000000;">&#93;</span> <span style="color: #0600FF;">as</span> DataTemplate<span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #0600FF;">base</span>.<span style="color: #0000FF;">OnContentChanged</span><span style="color: #000000;">&#40;</span>oldContent, newContent<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p><strong>Etape 7</strong></p>
<p>Nous  pouvons enfin toucher à la MainPage.xaml, commençons par ajouter les  styles aux ressources de la page. Ajoutez ce code dans le haut de la  page :</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;phone:PhoneApplicationPage.Resources<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Style</span> <span style="color: #000066;">x:Key</span>=<span style="color: #ff0000;">&quot;ListBoxStyleVoiture&quot;</span> <span style="color: #000066;">TargetType</span>=<span style="color: #ff0000;">&quot;ListBox&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Setter</span> <span style="color: #000066;">Property</span>=<span style="color: #ff0000;">&quot;Background&quot;</span> <span style="color: #000066;">Value</span>=<span style="color: #ff0000;">&quot;Transparent&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Setter</span> <span style="color: #000066;">Property</span>=<span style="color: #ff0000;">&quot;Foreground&quot;</span> <span style="color: #000066;">Value</span>=<span style="color: #ff0000;">&quot;{StaticResource PhoneForegroundBrush}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Setter</span> <span style="color: #000066;">Property</span>=<span style="color: #ff0000;">&quot;ScrollViewer.HorizontalScrollBarVisibility&quot;</span> <span style="color: #000066;">Value</span>=<span style="color: #ff0000;">&quot;Disabled&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Setter</span> <span style="color: #000066;">Property</span>=<span style="color: #ff0000;">&quot;ScrollViewer.VerticalScrollBarVisibility&quot;</span> <span style="color: #000066;">Value</span>=<span style="color: #ff0000;">&quot;Auto&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Setter</span> <span style="color: #000066;">Property</span>=<span style="color: #ff0000;">&quot;BorderThickness&quot;</span> <span style="color: #000066;">Value</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Setter</span> <span style="color: #000066;">Property</span>=<span style="color: #ff0000;">&quot;BorderBrush&quot;</span> <span style="color: #000066;">Value</span>=<span style="color: #ff0000;">&quot;Transparent&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Setter</span> <span style="color: #000066;">Property</span>=<span style="color: #ff0000;">&quot;Padding&quot;</span> <span style="color: #000066;">Value</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Setter</span> <span style="color: #000066;">Property</span>=<span style="color: #ff0000;">&quot;ItemsPanel&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Setter.Value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ItemsPanelTemplate<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Grid</span> <span style="color: #000066;">x:Name</span>=<span style="color: #ff0000;">&quot;testContainer&quot;</span> <span style="color: #000066;">Width</span>=<span style="color: #ff0000;">&quot;590&quot;</span> <span style="color: #000066;">Height</span>=<span style="color: #ff0000;">&quot;590&quot;</span> <span style="color: #000066;">Background</span>=<span style="color: #ff0000;">&quot;Black&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ItemsPanelTemplate<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Setter.Value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Setter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Setter</span> <span style="color: #000066;">Property</span>=<span style="color: #ff0000;">&quot;Template&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Setter.Value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ControlTemplate</span> <span style="color: #000066;">TargetType</span>=<span style="color: #ff0000;">&quot;ListBox&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
                        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ScrollViewer</span> <span style="color: #000066;">x:Name</span>=<span style="color: #ff0000;">&quot;ScrollViewer&quot;</span> <span style="color: #000066;">BorderBrush</span>=<span style="color: #ff0000;">&quot;{TemplateBinding BorderBrush}&quot;</span> <span style="color: #000066;">BorderThickness</span>=<span style="color: #ff0000;">&quot;{TemplateBinding BorderThickness}&quot;</span> <span style="color: #000066;">Background</span>=<span style="color: #ff0000;">&quot;{TemplateBinding Background}&quot;</span> <span style="color: #000066;">Foreground</span>=<span style="color: #ff0000;">&quot;{TemplateBinding Foreground}&quot;</span> <span style="color: #000066;">Padding</span>=<span style="color: #ff0000;">&quot;{TemplateBinding Padding}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
                            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ItemsPresenter</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
                        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ScrollViewer<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ControlTemplate<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Setter.Value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Setter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
         <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Style<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
         <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Style</span> <span style="color: #000066;">x:Key</span>=<span style="color: #ff0000;">&quot;ListBoxItemStylePiece&quot;</span> <span style="color: #000066;">TargetType</span>=<span style="color: #ff0000;">&quot;ListBoxItem&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Setter</span> <span style="color: #000066;">Property</span>=<span style="color: #ff0000;">&quot;Background&quot;</span> <span style="color: #000066;">Value</span>=<span style="color: #ff0000;">&quot;Transparent&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Setter</span> <span style="color: #000066;">Property</span>=<span style="color: #ff0000;">&quot;BorderThickness&quot;</span> <span style="color: #000066;">Value</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Setter</span> <span style="color: #000066;">Property</span>=<span style="color: #ff0000;">&quot;BorderBrush&quot;</span> <span style="color: #000066;">Value</span>=<span style="color: #ff0000;">&quot;Transparent&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Setter</span> <span style="color: #000066;">Property</span>=<span style="color: #ff0000;">&quot;Padding&quot;</span> <span style="color: #000066;">Value</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Setter</span> <span style="color: #000066;">Property</span>=<span style="color: #ff0000;">&quot;HorizontalContentAlignment&quot;</span> <span style="color: #000066;">Value</span>=<span style="color: #ff0000;">&quot;Left&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Setter</span> <span style="color: #000066;">Property</span>=<span style="color: #ff0000;">&quot;VerticalContentAlignment&quot;</span> <span style="color: #000066;">Value</span>=<span style="color: #ff0000;">&quot;Top&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Setter</span> <span style="color: #000066;">Property</span>=<span style="color: #ff0000;">&quot;Template&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Setter.Value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ControlTemplate</span> <span style="color: #000066;">TargetType</span>=<span style="color: #ff0000;">&quot;ListBoxItem&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;lib:DataTemplateExtensions</span> <span style="color: #000066;">Content</span>=<span style="color: #ff0000;">&quot;{Binding}&quot;</span> <span style="color: #000066;">HorizontalAlignment</span>=<span style="color: #ff0000;">&quot;Left&quot;</span> <span style="color: #000066;">VerticalAlignment</span>=<span style="color: #ff0000;">&quot;Top&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ControlTemplate<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Setter.Value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Setter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Style<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/phone:PhoneApplicationPage.Resources<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Dans la Grid « Contentpanel » il ne nous reste plus qu’à ajouter la ListBox :</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ListBox</span> <span style="color: #000066;">x:Name</span>=<span style="color: #ff0000;">&quot;Voiture&quot;</span> <span style="color: #000066;">Style</span>=<span style="color: #ff0000;">&quot;{StaticResource ListBoxStyleVoiture}&quot;</span> <span style="color: #000066;">SelectionChanged</span>=<span style="color: #ff0000;">&quot;Voiture_SelectionChanged&quot;</span> <span style="color: #000066;">ItemContainerStyle</span>=<span style="color: #ff0000;">&quot;{StaticResource ListBoxItemStylePiece}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<p><strong>Etape 8</strong></p>
<p>Allez  dans le code behind de la page, il ne reste plus qu’à affecter les  données à la ListBox et définir ce que l’on veut faire à la selection  d’une pièce (ici afficher le nom). Ajoutez donc ces dernières lignes  avant de lancer le projet.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> MainPage<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
InitializeComponent<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
Voiture.<span style="color: #0000FF;">ItemsSource</span> <span style="color: #008000;">=</span> PieceCarrosserie.<span style="color: #0000FF;">Mockup</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0600FF;">private</span> <span style="color: #0600FF;">void</span> Voiture_SelectionChanged<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">object</span> sender, SelectionChangedEventArgs e<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
MessageBox.<span style="color: #0000FF;">Show</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>PieceCarrosserie<span style="color: #000000;">&#41;</span>Voiture.<span style="color: #0000FF;">SelectedItem</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Name</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Voici une image du résultat :</p>
<p><a href="http://blog.tequilarapido.com/wp-content/uploads/2010/10/Resultat.png"><img class="alignnone size-full wp-image-3882" title="Resultat" src="http://blog.tequilarapido.com/wp-content/uploads/2010/10/Resultat.png" alt="Resultat" width="402" height="731" /></a></p>
<p>Voilà  ce tuto est terminé, vous pouvez maintenant appliquer le principe sur  tout et n’importe quoi : une carte, le système solaire et que sais-je  encore !</p>
<p>Téléchargez le projet : <a href="http://blog.tequilarapido.com/wp-content/uploads/2010/10/TutoVoiture.zip">TutoVoiture.rar</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tequilarapido.com/2010/10/27/creez-un-template-de-listbox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AI &gt; Canvas</title>
		<link>http://blog.tequilarapido.com/2010/10/18/ai-canvas/</link>
		<comments>http://blog.tequilarapido.com/2010/10/18/ai-canvas/#comments</comments>
		<pubDate>Mon, 18 Oct 2010 14:38:56 +0000</pubDate>
		<dc:creator>Laurent Vénérosy</dc:creator>
				<category><![CDATA[Design, Création, Art]]></category>
		<category><![CDATA[Interfaces riches]]></category>
		<category><![CDATA[Techno]]></category>

		<guid isPermaLink="false">http://blog.tequilarapido.com/?p=3819</guid>
		<description><![CDATA[En voilà un outil qui va faire des heureux! Ai &#62; Canvas est un plugin qui permet d&#8217;exporter un fichier .AI en template HTML 5 avec directement les données genre dégradé, transparence retranscrit en HTML! Youuuuhou! Un outil qui va permettre aux intégrateurs et designers de travailler en parfaite symbiose&#8230;enfin on l&#8217;espère! En attendant vous [...]]]></description>
			<content:encoded><![CDATA[<p>En voilà un outil qui va faire des heureux! <strong>Ai &gt; Canva</strong>s est un plugin qui permet d&#8217;<strong>exporter un fichier .AI en template HTML 5</strong> avec directement les données genre dégradé, transparence retranscrit en HTML! Youuuuhou! Un outil qui va permettre aux <strong>intégrateurs et designers de travailler en parfaite symbiose</strong>&#8230;enfin on l&#8217;espère! En attendant vous pouvez le télécharger<strong><a href="http://visitmix.com/labs/ai2canvas/common/downloads/Ai2Canvas_1.0_PC.zip" target="_blank"> ici</a></strong> (si vous êtes PC et puis c&#8217;est tout) ou<strong><a href="http://visitmix.com/labs/ai2canvas/common/downloads/Ai2Canvas_1.0_PC.zip" target="_blank"> ici</a></strong> (si vous êtes MAC et oui il y a une appli pour ça!)</p>
<p style="text-align: center;"><span id="more-3819"></span></p>
<p style="text-align: center;"><a href="http://visitmix.com/labs/ai2canvas/index.html" target="_blank"><img src="http://visitmix.com/labs/ai2canvas/common/img/masthead.jpg" alt="Ai2Canvas" /></a></p>
<p style="text-align: center;">
<p style="text-align: center;"><img class="aligncenter" src="http://visitmix.com/labs/ai2canvas/common/img/howitworks.jpg" alt="How it works" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tequilarapido.com/2010/10/18/ai-canvas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wizup finaliste au challenge Windows Phone 7 !</title>
		<link>http://blog.tequilarapido.com/2010/09/28/wizup-finaliste-au-challenge-windows-phone-7/</link>
		<comments>http://blog.tequilarapido.com/2010/09/28/wizup-finaliste-au-challenge-windows-phone-7/#comments</comments>
		<pubDate>Tue, 28 Sep 2010 17:56:25 +0000</pubDate>
		<dc:creator>Marion Barthes</dc:creator>
				<category><![CDATA[Ergonomie]]></category>
		<category><![CDATA[Evénements]]></category>
		<category><![CDATA[Interfaces riches]]></category>
		<category><![CDATA[L'agence]]></category>
		<category><![CDATA[Techno]]></category>
		<category><![CDATA[Usages émergeants]]></category>

		<guid isPermaLink="false">http://blog.tequilarapido.com/?p=3663</guid>
		<description><![CDATA[Wizup se classe donc parmi les sélectionnés, bravo à toute l’équipe dédiée aux technologies Microsoft qui ont participé au succès de cette KillerApps.
Rendez-vous le 7 octobre prochain, pour la présentation de l’application devant le jury final, présidé par Steeve Balmer, CEO de Microsoft.]]></description>
			<content:encoded><![CDATA[<p>Après quelques semaines de suspens, voici enfin la liste des 7 finalistes du challenge organisé par Microsoft :</p>
<p><span id="more-3663"></span></p>
<ul>
<li><a href="http://www.facebook.com/video/video.php?v=1566670888802&amp;oid=129459787073480" target="_blank">Arcane TowerDefense</a> : un jeu de Tower Defense très impressionnant graphiquement</li>
<li><a href="http://www.facebook.com/video/video.php?v=433310289184&amp;oid=129459787073480" target="_blank">Ahead</a> : un gestionnaire de projet proposant la synchronisation avec la version PC</li>
<li><a href="http://www.facebook.com/video/video.php?v=10150273491855249" target="_blank">Deed Day</a> :une application sociale qui a pour objectif d&#8217;améliorer le monde en le rendant meilleurs</li>
<li><a href="http://www.facebook.com/video/video.php?v=474823741010" target="_blank">Snoop It</a> (Quicksilver) : prenez une photo d&#8217;un vêtement (QuickSilver) et trouver la boutique la plus proche</li>
<li><a href="http://www.facebook.com/video/video.php?v=474533036010" target="_blank">Winmote </a>: une télécommande pour Windows 7 : sites web, musique, vidéo&#8230; piloter votre PC depuis votre smartphone</li>
<li><a href="http://www.facebook.com/video/video.php?v=436437458926" target="_blank">Wizup </a>: un shazam like pour tout : publicité, vidéo, radio&#8230; très impressionnant</li>
<li><a href="http://www.facebook.com/video/video.php?v=434562073926" target="_blank">I-Dispo</a> : un outil de réservation de services : restaurant, médecin, garage&#8230;</li>
</ul>
<p>Wizup se classe donc parmi les sélectionnés, bravo à toute l’équipe dédiée aux technologies Microsoft qui ont participé au succès de cette KillerApps.</p>
<p>Rendez-vous le 7 octobre prochain, pour la présentation de l’application devant le jury final, présidé par Steeve Balmer, CEO de Microsoft.</p>
<p>La vidéo de présentation de l&#8217;application:</p>
<a href="http://blog.tequilarapido.com/2010/09/28/wizup-finaliste-au-challenge-windows-phone-7/"><p><em>Cliquer ici pour voir la vidéo.</em></p></a>
]]></content:encoded>
			<wfw:commentRss>http://blog.tequilarapido.com/2010/09/28/wizup-finaliste-au-challenge-windows-phone-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wizup Apps présentée au challenge Windows Phone 7 !</title>
		<link>http://blog.tequilarapido.com/2010/09/24/wizup-apps-presentee-au-challenge-windows-phone-7/</link>
		<comments>http://blog.tequilarapido.com/2010/09/24/wizup-apps-presentee-au-challenge-windows-phone-7/#comments</comments>
		<pubDate>Fri, 24 Sep 2010 17:02:03 +0000</pubDate>
		<dc:creator>Marion Barthes</dc:creator>
				<category><![CDATA[Ergonomie]]></category>
		<category><![CDATA[Evénements]]></category>
		<category><![CDATA[Interfaces riches]]></category>
		<category><![CDATA[L'agence]]></category>
		<category><![CDATA[Techno]]></category>
		<category><![CDATA[Usages émergeants]]></category>
		<category><![CDATA[expertise]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[wp7]]></category>

		<guid isPermaLink="false">http://blog.tequilarapido.com/?p=3636</guid>
		<description><![CDATA[Tequilarapido confirme son expertise dans la conception et le développement d’applications sur WP7 avec la présentation du prototype Wizup au Challenge Miscrosoft.
Wizup … kezako ?  Wizup c’est la 1ere application révolutionnant  la reconnaissance d’item depuis un mobile. ]]></description>
			<content:encoded><![CDATA[<p>Tequilarapido confirme son expertise dans la conception et le développement d’applications sur WP7 avec la présentation du prototype Wizup au Challenge Miscrosoft.</p>
<p><span id="more-3636"></span></p>
<p>Wizup révolutionne la reconnaissance depuis un mobile. Elle analyse et reconnait, en temps réel<strong><em>,</em></strong> les contenus de:</p>
<ul>
<li>150 radios soit 97% de l’audience nationale</li>
<li>1200 titres presse soit 99% de l’audience nationale</li>
<li>100 chaines TV soit 96% de l’audience nationale</li>
<li>8 500 000 titres</li>
<li>4 grands réseaux d’affichage nationaux</li>
</ul>
<p>Publicité, titres musicaux, programme TV, radio, magazine, affiches, emballages, produits de consommation: Wizup délivre autant d’informations que nécessaire sur n’importe quel élément sonore et/ou visuel. L’application permet ainsi<strong><em> </em></strong>d’enrichir toutes sortes de médias par une multitude de services.</p>
<p>Parce que nous savons que demain sera mobile et encore plus nomade, tequilarapido a engagé l’ensemble de son équipe dédiée aux technologies Microsoft dans l’aventure. En partenariat avec Wizup, nous avons crée une application d’utilité quotidienne, ludique et en phase avec les usages à venir.</p>
<p>Vivez l’expérience Wizup !</p>
<p>Devenez fan et votez ici <a href="http://www.facebook.com/video/video.php?v=436437458926&amp;ref=mf">http://www.facebook.com/video/video.php?v=436437458926&amp;ref=mf</a></p>
<p>Rendez-vous le 07 octobre !</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tequilarapido.com/2010/09/24/wizup-apps-presentee-au-challenge-windows-phone-7/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Apple revoit ses restrictions à la baisse !</title>
		<link>http://blog.tequilarapido.com/2010/09/10/apple-revoit-ses-restrictions-a-la-baisse/</link>
		<comments>http://blog.tequilarapido.com/2010/09/10/apple-revoit-ses-restrictions-a-la-baisse/#comments</comments>
		<pubDate>Fri, 10 Sep 2010 20:04:22 +0000</pubDate>
		<dc:creator>Mathieu Bossan</dc:creator>
				<category><![CDATA[Interfaces riches]]></category>
		<category><![CDATA[L'agence]]></category>
		<category><![CDATA[Techno]]></category>
		<category><![CDATA[Usages émergeants]]></category>

		<guid isPermaLink="false">http://blog.tequilarapido.com/?p=3516</guid>
		<description><![CDATA[Un peu plus tôt cette année, la compagnie Apple a mis en place des nouvelles contraintes concernant le développement sur iOS (iPhone, iPod, iPad), une décision qui avait fait polémique au près des développeurs et déclenché une pseudo gué-guerre médiatique entre les compagnies Apple et Adobe.
C&#8217;est hier qu&#8217;Apple est revenu sur sa décision en publiant [...]]]></description>
			<content:encoded><![CDATA[<p>Un peu plus tôt cette année, la compagnie Apple a mis en place des nouvelles contraintes concernant le développement sur iOS (iPhone, iPod, iPad), une décision qui avait fait polémique au près des développeurs et déclenché une pseudo gué-guerre médiatique entre les compagnies Apple et Adobe.</p>
<p>C&#8217;est hier qu&#8217;Apple est revenu sur sa décision en publiant des nouvelles &laquo;&nbsp;lignes de conduite&nbsp;&raquo;. La firme a revu ses exigences à la baisse en autorisant les applications basées sur un framework externe.</p>
<p><span id="more-3516"></span>Les librairies compatibles avec de multiples plates-formes sont dorénavant acceptées</p>
<p>Cette nouvelle ouvre la porte aux frameworks, jusque ici laissés sur le banc de touche, tels que Creative Suite 5, iSpectrum, MonoTouch, Titanium ou Unity qui permettent de convertir du code ActionScript, Java, .Net, ou Javascript en Objective-C.</p>
<p>Ces frameworks facilitent grandement le développement et les librairies qu&#8217;ils contiennent étant milti plate-formes, ils favorisent la portabilité des applications.</p>
<p>C&#8217;est donc une grande nouvelle pour nous autres développeurs, ainsi que pour l&#8217;utilisateur final qui va voir débarquer une multitude de nouvelles applications dans les prochaines semaines.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tequilarapido.com/2010/09/10/apple-revoit-ses-restrictions-a-la-baisse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Seesmic Desktop 2 : c&#8217;est parti !</title>
		<link>http://blog.tequilarapido.com/2010/09/10/seesmic-desktop-2-cest-parti/</link>
		<comments>http://blog.tequilarapido.com/2010/09/10/seesmic-desktop-2-cest-parti/#comments</comments>
		<pubDate>Fri, 10 Sep 2010 13:37:40 +0000</pubDate>
		<dc:creator>Yann Gilliot</dc:creator>
				<category><![CDATA[Evénements]]></category>
		<category><![CDATA[L'agence]]></category>
		<category><![CDATA[Techno]]></category>
		<category><![CDATA[Usages émergeants]]></category>

		<guid isPermaLink="false">http://blog.tequilarapido.com/?p=3479</guid>
		<description><![CDATA[Prévue depuis un moment déjà, la nouvelle version de Seesmic Desktop vient de sortir aujourd'hui.]]></description>
			<content:encoded><![CDATA[<p>Prévue depuis un moment déjà, la nouvelle version de Seesmic Desktop vient de sortir aujourd&#8217;hui.</p>
<p>Pour définir rapidement cette application, Seesmic Desktop 2 permet de réunir tous les flux de vos comptes sociaux dans un seul et unique programme, vous permettant ainsi de visualiser rapidement les informations, de pouvoir les comparer et de les partager sur un ou plus, voir même tous vos compte (Twitter, Facebook, Google Reader&#8230;).</p>
<p><span id="more-3479"></span></p>
<p>TequilaRapido a participé à cette aventure en réalisant plusieurs plugins : Flickr, Myspace, Youtube, Google Reader et Techmeme.<br />
Seesmic Desktop 2 est disponible en téléchargement à cette adresse : <a title="Seesmic Desktop 2" href="http://seesmic.com/seesmic_desktop/sd2/">http://seesmic.com/seesmic_desktop/sd2/</a></p>
<p>Au total c&#8217;est une application rassemblant plus de 40 plugins que <a title="loïc le meur" href="http://loiclemeur.com/france/">Loïc Le Meur</a> a présenté ce matin sur <a title="techcrunch" href="http://techcrunch.com/2010/09/09/seesmic-desktop-2/">TechCrunch</a>. On voit d&#8217;ailleurs dans la vidéo ci-dessous une démo de Seesmic Desktop 2 dans laquelle on voit apparaître nos plugins Google Reader et Youtube !!</p>
<p><script src="http://player.ooyala.com/player.js?embedCode=4wNWxwMTqRQHUGFfSPnCQtHuJBO_nosV&amp;width=630&amp;deepLinkEmbedCode=4wNWxwMTqRQHUGFfSPnCQtHuJBO_nosV&amp;height=354"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tequilarapido.com/2010/09/10/seesmic-desktop-2-cest-parti/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Tutoriel de développement XNA / Partie II : Mon premier jeu avec XNA 4.0 (Part 4)</title>
		<link>http://blog.tequilarapido.com/2010/08/30/tutoriel-de-developpement-xna-partie-ii-mon-premier-jeu-avec-xna-4-0-part-4/</link>
		<comments>http://blog.tequilarapido.com/2010/08/30/tutoriel-de-developpement-xna-partie-ii-mon-premier-jeu-avec-xna-4-0-part-4/#comments</comments>
		<pubDate>Mon, 30 Aug 2010 12:29:07 +0000</pubDate>
		<dc:creator>Yann Gilliot</dc:creator>
				<category><![CDATA[L'agence]]></category>
		<category><![CDATA[Techno]]></category>

		<guid isPermaLink="false">http://blog.tequilarapido.com/?p=3226</guid>
		<description><![CDATA[Dans le chapitre précédent, nous avons vu comment faire défiler un background. Comme vous avez pu vous en rendre compte, le style du jeu se rapproche petit à petit d’un shoot’em up. C’est pourquoi, dans cette partie, nous allons apprendre à notre petit vaisseau Tequila Rapido, à faire feu.]]></description>
			<content:encoded><![CDATA[<p>Dans le chapitre précédent, nous avons vu comment faire défiler un background. Comme vous avez pu vous en rendre compte, le style du jeu se rapproche petit à petit d’un shoot’em up. C’est pourquoi, dans cette partie, nous allons apprendre à notre petit vaisseau Tequila Rapido, à faire feu.</p>
<p><span id="more-3226"></span></p>
<p>Ce chapitre va être l’occasion structurer un peu notre code, la base étant toujours la classe <strong>Sprite</strong>. Nous allons créer une classe <strong>Ship</strong> et une classe <strong>Bullet</strong> qui héritent de <strong>Sprite</strong>.</p>
<p><strong>Modifier la classe Sprite</strong></p>
<p>Pour commencer, modifiez la classe Sprite en fonction des lignes suivantes :</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #FF0000;">class</span> Sprite
<span style="color: #000000;">&#123;</span>
<span style="color: #008080; font-style: italic;">//Position actuelle du sprite</span>
<span style="color: #0600FF;">public</span> Vector2 Position <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Vector2<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">0</span>,<span style="color: #FF0000;">0</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #008080; font-style: italic;">//Texture utilisée lors de l'affichage dans la méthode Draw</span>
<span style="color: #0600FF;">private</span> Texture2D _texture<span style="color: #008000;">;</span>
&nbsp;
<span style="color: #008080; font-style: italic;">//Taille du Sprite</span>
<span style="color: #0600FF;">public</span> Rectangle Size<span style="color: #008000;">;</span>
&nbsp;
<span style="color: #008080; font-style: italic;">//Utilisé pour augmenter ou diminuer la taille du Sprite</span>
<span style="color: #0600FF;">private</span> <span style="color: #FF0000;">float</span> _scale <span style="color: #008000;">=</span> 1.0f<span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF;">public</span> <span style="color: #FF0000;">float</span> Scale
<span style="color: #000000;">&#123;</span>
get <span style="color: #000000;">&#123;</span> <span style="color: #0600FF;">return</span> _scale<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
set
<span style="color: #000000;">&#123;</span>
_scale <span style="color: #008000;">=</span> value<span style="color: #008000;">;</span>
<span style="color: #008080; font-style: italic;">//Recalule la taille du Sprite avec la nouvelle echelle (scale)</span>
Size <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Rectangle<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">0</span>, <span style="color: #FF0000;">0</span>, <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">int</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#40;</span>_texture.<span style="color: #0000FF;">Width</span> <span style="color: #008000;">*</span> Scale<span style="color: #000000;">&#41;</span>, <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">int</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#40;</span>_texture.<span style="color: #0000FF;">Height</span> <span style="color: #008000;">*</span> Scale<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #008080; font-style: italic;">//Nom de l'image en ressource</span>
<span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> AssetName<span style="color: #008000;">;</span>
&nbsp;
<span style="color: #008080; font-style: italic;">//Charge la texture du sprite en utilsant le ContentPipeLine</span>
<span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> LoadContent<span style="color: #000000;">&#40;</span>ContentManager monContentManager, <span style="color: #FF0000;">string</span> nomTexture<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
_texture <span style="color: #008000;">=</span> monContentManager.<span style="color: #0000FF;">Load</span><span style="color: #008000;">&amp;</span>lt<span style="color: #008000;">;</span>Texture2D<span style="color: #008000;">&amp;</span>gt<span style="color: #008000;">;</span><span style="color: #000000;">&#40;</span>nomTexture<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
AssetName <span style="color: #008000;">=</span> nomTexture<span style="color: #008000;">;</span>
Size <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Rectangle<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">0</span>, <span style="color: #FF0000;">0</span>, <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">int</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#40;</span>_texture.<span style="color: #0000FF;">Width</span> <span style="color: #008000;">*</span> Scale<span style="color: #000000;">&#41;</span>, <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">int</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#40;</span>_texture.<span style="color: #0000FF;">Height</span> <span style="color: #008000;">*</span> Scale<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> Update<span style="color: #000000;">&#40;</span>GameTime theGameTime, Vector2 theSpeed, Vector2 theDirection<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
Position <span style="color: #008000;">+=</span> theDirection <span style="color: #008000;">*</span> theSpeed <span style="color: #008000;">*</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">float</span><span style="color: #000000;">&#41;</span>theGameTime.<span style="color: #0000FF;">ElapsedGameTime</span>.<span style="color: #0000FF;">TotalSeconds</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #008080; font-style: italic;">//Affiche le sprite à l’écran</span>
<span style="color: #0600FF;">public</span> <span style="color: #0600FF;">virtual</span> <span style="color: #0600FF;">void</span> Draw<span style="color: #000000;">&#40;</span>SpriteBatch monSpriteBatch<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
monSpriteBatch.<span style="color: #0000FF;">Draw</span><span style="color: #000000;">&#40;</span>_texture, Position, <span style="color: #008000;">new</span> Rectangle<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">0</span>,<span style="color: #FF0000;">0</span>,_texture.<span style="color: #0000FF;">Width</span>,_texture.<span style="color: #0000FF;">Height</span><span style="color: #000000;">&#41;</span>
, Color.<span style="color: #0000FF;">White</span>,0.0f,Vector2.<span style="color: #0000FF;">Zero</span>,Scale,SpriteEffects.<span style="color: #0000FF;">None</span>,<span style="color: #FF0000;">0</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Notez le mot-clé virtual de la méthode Draw. Cela permettra de réaliser un override de cette méthode dans les classes héritées.</p>
<p><strong>Ajouter la classe Bullet</strong></p>
<p>Maintenant ajoutez la classe Bullet, celle-ci hérite de la classe Sprite et va correspondre à un tir de vaisseau. Dans cette classe nous allons gérer la vitesse du tir ainsi que son affichage en fonction sa position. C’est-à-dire que si le tire sort de l’écran on ne l’affiche plus. Il serait dommage de perdre des ressources en affichant quelque chose que l’on ne voit pas!</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #FF0000;">class</span> Bullet <span style="color: #008000;">:</span> Sprite
<span style="color: #000000;">&#123;</span>
<span style="color: #0600FF;">const</span> <span style="color: #FF0000;">int</span> MAX_DISTANCE <span style="color: #008000;">=</span> <span style="color: #FF0000;">500</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">public</span> <span style="color: #FF0000;">bool</span> Visible <span style="color: #008000;">=</span> false<span style="color: #008000;">;</span>
Vector2 _startPosition<span style="color: #008000;">;</span>
Vector2 _speed<span style="color: #008000;">;</span>
Vector2 _direction<span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> LoadContent<span style="color: #000000;">&#40;</span>ContentManager theContentManager<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #0600FF;">base</span>.<span style="color: #0000FF;">LoadContent</span><span style="color: #000000;">&#40;</span>theContentManager, <span style="color: #666666;">&quot;red_bullet&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
Scale <span style="color: #008000;">=</span> 1.0f<span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> Update<span style="color: #000000;">&#40;</span>GameTime theGameTime<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>Vector2.<span style="color: #0000FF;">Distance</span><span style="color: #000000;">&#40;</span>_startPosition, Position<span style="color: #000000;">&#41;</span> <span style="color: #008000;">&amp;</span>gt<span style="color: #008000;">;</span> MAX_DISTANCE<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
Visible <span style="color: #008000;">=</span> false<span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>Visible <span style="color: #008000;">==</span> <span style="color: #0600FF;">true</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #0600FF;">base</span>.<span style="color: #0000FF;">Update</span><span style="color: #000000;">&#40;</span>theGameTime, _speed, _direction<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0600FF;">public</span> <span style="color: #0600FF;">override</span> <span style="color: #0600FF;">void</span> Draw<span style="color: #000000;">&#40;</span>SpriteBatch theSpriteBatch<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>Visible <span style="color: #008000;">==</span> <span style="color: #0600FF;">true</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #0600FF;">base</span>.<span style="color: #0000FF;">Draw</span><span style="color: #000000;">&#40;</span>theSpriteBatch<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> Fire<span style="color: #000000;">&#40;</span>Vector2 theStartPosition, Vector2 theSpeed, Vector2 theDirection<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
Position <span style="color: #008000;">=</span> theStartPosition<span style="color: #008000;">;</span>
_startPosition <span style="color: #008000;">=</span> theStartPosition<span style="color: #008000;">;</span>
_speed <span style="color: #008000;">=</span> theSpeed<span style="color: #008000;">;</span>
_direction <span style="color: #008000;">=</span> theDirection<span style="color: #008000;">;</span>
Visible <span style="color: #008000;">=</span> true<span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Comme vous pouvez le constater, la méthode Draw  de notre classe <strong>Bullet </strong>remplace celle de la classe <strong>Sprite</strong>. On ne lance la méthode Draw de la classe Sprite uniquement si notre objet Bullet est visible ou du moins si la distance parcourue est inférieure à MAX_DISTANCE.</p>
<p><strong>Ajouter la classe Ship</strong></p>
<p>Nous allons maintenant ajouter la classe <strong>Ship</strong> qui elle aussi hérite de la classe <strong>Sprite</strong>. La classe Ship représente le vaisseau et possède dans ses propriétés une liste de Bullet, ainsi on peut savoir à qui appartiennent les tirs.</p>
<p>Commencez par ajouter ces quelques lignes en haut de la classe</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #FF0000;">class</span> Ship <span style="color: #008000;">:</span>Sprite
<span style="color: #000000;">&#123;</span>
<span style="color: #0600FF;">const</span> <span style="color: #FF0000;">string</span> SHIP_ASSETNAME <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;logo_HD&quot;</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">const</span> <span style="color: #FF0000;">int</span> START_POSITION_X <span style="color: #008000;">=</span> <span style="color: #FF0000;">240</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">const</span> <span style="color: #FF0000;">int</span> START_POSITION_Y <span style="color: #008000;">=</span> <span style="color: #FF0000;">400</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">const</span> <span style="color: #FF0000;">int</span> SHIP_SPEED <span style="color: #008000;">=</span> <span style="color: #FF0000;">160</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">const</span> <span style="color: #FF0000;">int</span> MOVE_UP <span style="color: #008000;">=</span> <span style="color: #008000;">-</span><span style="color: #FF0000;">1</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">const</span> <span style="color: #FF0000;">int</span> MOVE_DOWN <span style="color: #008000;">=</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">const</span> <span style="color: #FF0000;">int</span> MOVE_LEFT <span style="color: #008000;">=</span> <span style="color: #008000;">-</span><span style="color: #FF0000;">1</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">const</span> <span style="color: #FF0000;">int</span> MOVE_RIGHT <span style="color: #008000;">=</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">const</span> <span style="color: #FF0000;">int</span> BackBufferWidth <span style="color: #008000;">=</span> Game1.<span style="color: #0000FF;">BackBufferWidth</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">const</span> <span style="color: #FF0000;">int</span> BackBufferHeight <span style="color: #008000;">=</span> Game1.<span style="color: #0000FF;">BackBufferHeight</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #FF0000;">enum</span> State
<span style="color: #000000;">&#123;</span>
Moving
<span style="color: #000000;">&#125;</span>
&nbsp;
State _currentState <span style="color: #008000;">=</span> State.<span style="color: #0000FF;">Moving</span><span style="color: #008000;">;</span>
Vector2 _direction <span style="color: #008000;">=</span> Vector2.<span style="color: #0000FF;">Zero</span><span style="color: #008000;">;</span>
Vector2 _speed <span style="color: #008000;">=</span> Vector2.<span style="color: #0000FF;">Zero</span><span style="color: #008000;">;</span>
TouchCollection _previousTouchCollection<span style="color: #008000;">;</span>
List _bullets <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> List<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
ContentManager _contentManager<span style="color: #008000;">;</span></pre></div></div>

<p>Les constantes (position de départ, vitesse max , etc) ainsi que l’état (State) serviront à définir le comportement du vaisseau. Le vaisseau possède également une liste de <strong>Bullet</strong> correspondant aux tirs.</p>
<p>Dans la méthode LoadContent, nous allons charger les textures, initialiser la position du vaisseau et récupérer l’état de l’écran (via TouchPanel). Ajoutez les lignes suivantes :</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> LoadContent<span style="color: #000000;">&#40;</span>ContentManager theContentManager<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
_contentManager <span style="color: #008000;">=</span> theContentManager<span style="color: #008000;">;</span>
<span style="color: #0600FF;">foreach</span> <span style="color: #000000;">&#40;</span>Bullet aBullet <span style="color: #0600FF;">in</span> _bullets<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
aBullet.<span style="color: #0000FF;">LoadContent</span><span style="color: #000000;">&#40;</span>theContentManager<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
Position <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Vector2<span style="color: #000000;">&#40;</span>START_POSITION_X, START_POSITION_Y<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">base</span>.<span style="color: #0000FF;">LoadContent</span><span style="color: #000000;">&#40;</span>theContentManager, SHIP_ASSETNAME<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
_previousTouchCollection <span style="color: #008000;">=</span> TouchPanel.<span style="color: #0000FF;">GetState</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Vous remarquerez cette ligne base.LoadContent(theContentManager, SHIP_ASSETNAME). Elle permet de faire appel à la méthode LoadContent de la classe mère autrement dit la classe <strong>Sprite.</strong></p>
<p>Nous allons à présent ajouter la méthode Update.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> Update<span style="color: #000000;">&#40;</span>GameTime theGameTime<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
TouchCollection _currentTouchCollection <span style="color: #008000;">=</span> TouchPanel.<span style="color: #0000FF;">GetState</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
UpdateMovement<span style="color: #000000;">&#40;</span>_currentTouchCollection<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
UpdateBullet<span style="color: #000000;">&#40;</span>theGameTime, _currentTouchCollection<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
_previousTouchCollection <span style="color: #008000;">=</span> _currentTouchCollection<span style="color: #008000;">;</span>
<span style="color: #0600FF;">base</span>.<span style="color: #0000FF;">Update</span><span style="color: #000000;">&#40;</span>theGameTime, _speed, _direction<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>La première chose à faire est de mettre à jour l’état de l’écran pour pouvoir gérer les commandes (Déplacement). C’est ce que font les deux premières lignes. La méthode UpdateMovement sera détaillée dans quelques secondes suivie de la méthode UpdateBullet. La 4<sup>e</sup> ligne  permettra de comparer au prochain tour de boucle, l’état actuel et l’état précédent.</p>
<p>Voilà la méthode UpdateMovement. Ajoutez la à votre code.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">private</span> <span style="color: #0600FF;">void</span> UpdateMovement<span style="color: #000000;">&#40;</span>TouchCollection _currentTouchCollection<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #FF0000;">bool</span> buttonTouched <span style="color: #008000;">=</span> false<span style="color: #008000;">;</span>
<span style="color: #008080; font-style: italic;">//interprete le touch sur l'écran</span>
<span style="color: #0600FF;">foreach</span> <span style="color: #000000;">&#40;</span>TouchLocation location <span style="color: #0600FF;">in</span> _currentTouchCollection<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #0600FF;">switch</span> <span style="color: #000000;">&#40;</span>location.<span style="color: #0000FF;">State</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #0600FF;">case</span> TouchLocationState.<span style="color: #0000FF;">Pressed</span><span style="color: #008000;">:</span>
buttonTouched <span style="color: #008000;">=</span> true<span style="color: #008000;">;</span>
break<span style="color: #008000;">;</span>
<span style="color: #0600FF;">case</span> TouchLocationState.<span style="color: #0000FF;">Moved</span><span style="color: #008000;">:</span>
buttonTouched <span style="color: #008000;">=</span> true<span style="color: #008000;">;</span>
break<span style="color: #008000;">;</span>
<span style="color: #0600FF;">case</span> TouchLocationState.<span style="color: #0000FF;">Released</span><span style="color: #008000;">:</span>
break<span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>_currentState <span style="color: #008000;">==</span> State.<span style="color: #0000FF;">Moving</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
_speed <span style="color: #008000;">=</span> Vector2.<span style="color: #0000FF;">Zero</span><span style="color: #008000;">;</span>
_direction <span style="color: #008000;">=</span> Vector2.<span style="color: #0000FF;">Zero</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>buttonTouched<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>_currentTouchCollection<span style="color: #000000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #000000;">&#93;</span>.<span style="color: #0000FF;">Position</span>.<span style="color: #0000FF;">X</span> <span style="color: #008000;">&amp;</span>lt<span style="color: #008000;">;</span> <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Position</span>.<span style="color: #0000FF;">X</span> <span style="color: #008000;">&amp;</span>amp<span style="color: #008000;">;&amp;</span>amp<span style="color: #008000;">;</span> <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Position</span>.<span style="color: #0000FF;">X</span> <span style="color: #008000;">&amp;</span>gt<span style="color: #008000;">;</span> <span style="color: #FF0000;">0</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
_speed.<span style="color: #0000FF;">X</span> <span style="color: #008000;">=</span> SHIP_SPEED<span style="color: #008000;">;</span>
_direction.<span style="color: #0000FF;">X</span> <span style="color: #008000;">=</span> MOVE_LEFT<span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>_currentTouchCollection<span style="color: #000000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #000000;">&#93;</span>.<span style="color: #0000FF;">Position</span>.<span style="color: #0000FF;">X</span> <span style="color: #008000;">&amp;</span>gt<span style="color: #008000;">;</span> <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Position</span>.<span style="color: #0000FF;">X</span> <span style="color: #008000;">&amp;</span>amp<span style="color: #008000;">;&amp;</span>amp<span style="color: #008000;">;</span> <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Position</span>.<span style="color: #0000FF;">X</span> <span style="color: #008000;">&amp;</span>lt<span style="color: #008000;">;</span> BackBufferWidth <span style="color: #008000;">-</span> <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Size</span>.<span style="color: #0000FF;">Width</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
_speed.<span style="color: #0000FF;">X</span> <span style="color: #008000;">=</span> SHIP_SPEED<span style="color: #008000;">;</span>
_direction.<span style="color: #0000FF;">X</span> <span style="color: #008000;">=</span> MOVE_RIGHT<span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>_currentTouchCollection<span style="color: #000000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #000000;">&#93;</span>.<span style="color: #0000FF;">Position</span>.<span style="color: #0000FF;">Y</span> <span style="color: #008000;">&amp;</span>lt<span style="color: #008000;">;</span> <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Position</span>.<span style="color: #0000FF;">Y</span> <span style="color: #008000;">&amp;</span>amp<span style="color: #008000;">;&amp;</span>amp<span style="color: #008000;">;</span> <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Position</span>.<span style="color: #0000FF;">Y</span> <span style="color: #008000;">&amp;</span>gt<span style="color: #008000;">;</span> <span style="color: #FF0000;">0</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
_speed.<span style="color: #0000FF;">Y</span> <span style="color: #008000;">=</span> SHIP_SPEED<span style="color: #008000;">;</span>
_direction.<span style="color: #0000FF;">Y</span> <span style="color: #008000;">=</span> MOVE_UP<span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>_currentTouchCollection<span style="color: #000000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #000000;">&#93;</span>.<span style="color: #0000FF;">Position</span>.<span style="color: #0000FF;">Y</span> <span style="color: #008000;">&amp;</span>gt<span style="color: #008000;">;</span> <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Position</span>.<span style="color: #0000FF;">Y</span> <span style="color: #008000;">&amp;</span>amp<span style="color: #008000;">;&amp;</span>amp<span style="color: #008000;">;</span> <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Position</span>.<span style="color: #0000FF;">Y</span> <span style="color: #008000;">&amp;</span>lt<span style="color: #008000;">;</span> BackBufferHeight <span style="color: #008000;">-</span> <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Size</span>.<span style="color: #0000FF;">Height</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
_speed.<span style="color: #0000FF;">Y</span> <span style="color: #008000;">=</span> SHIP_SPEED<span style="color: #008000;">;</span>
_direction.<span style="color: #0000FF;">Y</span> <span style="color: #008000;">=</span> MOVE_DOWN<span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>La première partie de la méthode détermine la nature des « touch » sur l’écran et la seconde partie permet de déplacer le vaisseau en fonction de la position du « touch » sur l’écran.</p>
<p>Nous allons maintenant passer à la méthode UpdateBullet qui va mettre à jour la liste de <strong>Bullet </strong>en fonction du TouchPanel. Ajoutez ces lignes :</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">private</span> <span style="color: #0600FF;">void</span> UpdateBullet<span style="color: #000000;">&#40;</span>GameTime theGameTime, TouchCollection aCurrentTouchCollection<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #0600FF;">foreach</span> <span style="color: #000000;">&#40;</span>Bullet aBullet <span style="color: #0600FF;">in</span> _bullets<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
aBullet.<span style="color: #0000FF;">Update</span><span style="color: #000000;">&#40;</span>theGameTime<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #FF0000;">bool</span> buttonTouched <span style="color: #008000;">=</span> false<span style="color: #008000;">;</span>
<span style="color: #008080; font-style: italic;">//interprete le touch sur l'écran</span>
<span style="color: #0600FF;">foreach</span> <span style="color: #000000;">&#40;</span>TouchLocation location <span style="color: #0600FF;">in</span> aCurrentTouchCollection<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #0600FF;">switch</span> <span style="color: #000000;">&#40;</span>location.<span style="color: #0000FF;">State</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #0600FF;">case</span> TouchLocationState.<span style="color: #0000FF;">Pressed</span><span style="color: #008000;">:</span>
buttonTouched <span style="color: #008000;">=</span> true<span style="color: #008000;">;</span>
break<span style="color: #008000;">;</span>
<span style="color: #0600FF;">case</span> TouchLocationState.<span style="color: #0000FF;">Moved</span><span style="color: #008000;">:</span>
buttonTouched <span style="color: #008000;">=</span> true<span style="color: #008000;">;</span>
break<span style="color: #008000;">;</span>
<span style="color: #0600FF;">case</span> TouchLocationState.<span style="color: #0000FF;">Released</span><span style="color: #008000;">:</span>
break<span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>buttonTouched<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>aCurrentTouchCollection<span style="color: #000000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #000000;">&#93;</span>.<span style="color: #0000FF;">Position</span>.<span style="color: #0000FF;">X</span> <span style="color: #008000;">&amp;</span>gt<span style="color: #008000;">;</span> <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Position</span>.<span style="color: #0000FF;">X</span> <span style="color: #008000;">&amp;</span>amp<span style="color: #008000;">;&amp;</span>amp<span style="color: #008000;">;</span> <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Position</span>.<span style="color: #0000FF;">X</span> <span style="color: #008000;">&amp;</span>lt<span style="color: #008000;">;</span> BackBufferWidth <span style="color: #008000;">-</span> <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Size</span>.<span style="color: #0000FF;">Width</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
ShootBullet<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Comme pour la méthode UpdateMovement, la première partie du code permet de déterminer la nature des « touch ». La seconde partie fait tirer le vaisseau (ShootBullet) si ce dernier se déplace vers l’avant.</p>
<p>Et voici le code la méthode ShootBullet :</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">private</span> <span style="color: #0600FF;">void</span> ShootBullet<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>_currentState <span style="color: #008000;">==</span> State.<span style="color: #0000FF;">Moving</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #FF0000;">bool</span> aCreateNew <span style="color: #008000;">=</span> true<span style="color: #008000;">;</span>
<span style="color: #0600FF;">foreach</span> <span style="color: #000000;">&#40;</span>Bullet aBullet <span style="color: #0600FF;">in</span> _bullets<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>aBullet.<span style="color: #0000FF;">Visible</span> <span style="color: #008000;">==</span> <span style="color: #0600FF;">false</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
aCreateNew <span style="color: #008000;">=</span> false<span style="color: #008000;">;</span>
aBullet.<span style="color: #0000FF;">Fire</span><span style="color: #000000;">&#40;</span>Position <span style="color: #008000;">+</span> <span style="color: #008000;">new</span> Vector2<span style="color: #000000;">&#40;</span>Size.<span style="color: #0000FF;">Width</span> <span style="color: #008000;">/</span> <span style="color: #FF0000;">2</span>, Size.<span style="color: #0000FF;">Height</span> <span style="color: #008000;">/</span> <span style="color: #FF0000;">2</span><span style="color: #000000;">&#41;</span>,
<span style="color: #008000;">new</span> Vector2<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">200</span>, <span style="color: #FF0000;">0</span><span style="color: #000000;">&#41;</span>, <span style="color: #008000;">new</span> Vector2<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">1</span>, <span style="color: #FF0000;">0</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
break<span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>aCreateNew <span style="color: #008000;">==</span> <span style="color: #0600FF;">true</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
Bullet aFireball <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Bullet<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
aFireball.<span style="color: #0000FF;">LoadContent</span><span style="color: #000000;">&#40;</span>_contentManager<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
aFireball.<span style="color: #0000FF;">Fire</span><span style="color: #000000;">&#40;</span>Position <span style="color: #008000;">+</span> <span style="color: #008000;">new</span> Vector2<span style="color: #000000;">&#40;</span>Size.<span style="color: #0000FF;">Width</span> <span style="color: #008000;">/</span> <span style="color: #FF0000;">2</span>, Size.<span style="color: #0000FF;">Height</span> <span style="color: #008000;">/</span> <span style="color: #FF0000;">2</span><span style="color: #000000;">&#41;</span>,
<span style="color: #008000;">new</span> Vector2<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">200</span>, <span style="color: #FF0000;">200</span><span style="color: #000000;">&#41;</span>, <span style="color: #008000;">new</span> Vector2<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">1</span>, <span style="color: #FF0000;">0</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
_bullets.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span>aFireball<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Si un des <strong>Bullet</strong> se trouve en dehors de l’écran, plutôt que d’en créer un nouveau, on le déplace au niveau du vaisseau sans que le joueur ne s’en aperçoive. Ceci permet d’économiser de la ressource en évitant de créer infiniment de nouveaux objets à chaque tir. Dans le cas où aucun <strong>Bullet</strong> ne se trouve en dehors de l’écran, on crée un nouvel objet.</p>
<p>Enfin, il reste à ajouter la méthode Draw dans laquelle nous faire appel à la méthode Draw de chaque <strong>Bullet </strong>du vaisseau. Ajoutez ces lignes :</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> <span style="color: #0600FF;">override</span> <span style="color: #0600FF;">void</span> Draw<span style="color: #000000;">&#40;</span>SpriteBatch theSpriteBatch<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #0600FF;">foreach</span> <span style="color: #000000;">&#40;</span>Bullet aBullet <span style="color: #0600FF;">in</span> _bullets<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
aBullet.<span style="color: #0000FF;">Draw</span><span style="color: #000000;">&#40;</span>theSpriteBatch<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #0600FF;">base</span>.<span style="color: #0000FF;">Draw</span><span style="color: #000000;">&#40;</span>theSpriteBatch<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Voilà pour ce qui est de la classe <strong>Ship</strong>, le plus gros du travail est fait.</p>
<p><strong>Modifier la classe Game1</strong></p>
<p>Nous allons maintenant modifier la classe Game1 pour qu’elle s’occupe de coordonner tout le reste. Elle s’occupe toujours de faire défiler le Background. Modifiez la classe <strong>Game1</strong> en fonction des lignes suivantes, il n’y a pas beaucoup de changements à faire :</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> Game1 <span style="color: #008000;">:</span> Microsoft.<span style="color: #0000FF;">Xna</span>.<span style="color: #0000FF;">Framework</span>.<span style="color: #0000FF;">Game</span>
<span style="color: #000000;">&#123;</span>
GraphicsDeviceManager graphics<span style="color: #008000;">;</span>
SpriteBatch spriteBatch<span style="color: #008000;">;</span>
Ship monVaisseau<span style="color: #008000;">;</span>
&nbsp;
Sprite BackgroundOne<span style="color: #008000;">;</span>
Sprite BackgroundTwo<span style="color: #008000;">;</span>
Sprite BackgroundThree<span style="color: #008000;">;</span>
Sprite BackgroundFour<span style="color: #008000;">;</span>
Sprite BackgroundFive<span style="color: #008000;">;</span>
&nbsp;
TouchCollection touchCollection<span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF;">public</span> <span style="color: #0600FF;">const</span> <span style="color: #FF0000;">int</span> BackBufferWidth <span style="color: #008000;">=</span> <span style="color: #FF0000;">480</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">public</span> <span style="color: #0600FF;">const</span> <span style="color: #FF0000;">int</span> BackBufferHeight <span style="color: #008000;">=</span> <span style="color: #FF0000;">800</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF;">public</span> Game1<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
graphics <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> GraphicsDeviceManager<span style="color: #000000;">&#40;</span><span style="color: #0600FF;">this</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
Content.<span style="color: #0000FF;">RootDirectory</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Content&quot;</span><span style="color: #008000;">;</span>
graphics.<span style="color: #0000FF;">PreferredBackBufferWidth</span> <span style="color: #008000;">=</span> BackBufferWidth<span style="color: #008000;">;</span>
graphics.<span style="color: #0000FF;">PreferredBackBufferHeight</span> <span style="color: #008000;">=</span> BackBufferHeight<span style="color: #008000;">;</span>
&nbsp;
<span style="color: #008080; font-style: italic;">// Frame rate is 30 fps by default for Windows Phone.</span>
TargetElapsedTime <span style="color: #008000;">=</span> TimeSpan.<span style="color: #0000FF;">FromTicks</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">333333</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0600FF;">protected</span> <span style="color: #0600FF;">override</span> <span style="color: #0600FF;">void</span> Initialize<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #008080; font-style: italic;">// TODO: Add your initialization logic here</span>
touchCollection <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> TouchCollection<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
monVaisseau <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Ship<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
BackgroundOne <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Sprite<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
BackgroundTwo <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Sprite<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
BackgroundThree <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Sprite<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
BackgroundFour <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Sprite<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
BackgroundFive <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Sprite<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">base</span>.<span style="color: #0000FF;">Initialize</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0600FF;">protected</span> <span style="color: #0600FF;">override</span> <span style="color: #0600FF;">void</span> LoadContent<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #008080; font-style: italic;">// Create a new SpriteBatch, which can be used to draw textures.</span>
spriteBatch <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> SpriteBatch<span style="color: #000000;">&#40;</span>GraphicsDevice<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
monVaisseau.<span style="color: #0000FF;">LoadContent</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Content</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
monVaisseau.<span style="color: #0000FF;">Scale</span> <span style="color: #008000;">=</span> 2.0f<span style="color: #008000;">;</span>
&nbsp;
BackgroundOne.<span style="color: #0000FF;">LoadContent</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Content</span>, <span style="color: #666666;">&quot;BackgroundOne&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
BackgroundOne.<span style="color: #0000FF;">Position</span> <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Vector2<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">0</span>, <span style="color: #FF0000;">0</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
BackgroundTwo.<span style="color: #0000FF;">LoadContent</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Content</span>, <span style="color: #666666;">&quot;BackgroundTwo&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
BackgroundTwo.<span style="color: #0000FF;">Position</span> <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Vector2<span style="color: #000000;">&#40;</span>BackgroundOne.<span style="color: #0000FF;">Position</span>.<span style="color: #0000FF;">X</span> <span style="color: #008000;">+</span> BackgroundOne.<span style="color: #0000FF;">Size</span>.<span style="color: #0000FF;">Width</span>, <span style="color: #FF0000;">0</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
BackgroundThree.<span style="color: #0000FF;">LoadContent</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Content</span>, <span style="color: #666666;">&quot;BackgroundThree&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
BackgroundThree.<span style="color: #0000FF;">Position</span> <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Vector2<span style="color: #000000;">&#40;</span>BackgroundTwo.<span style="color: #0000FF;">Position</span>.<span style="color: #0000FF;">X</span> <span style="color: #008000;">+</span> BackgroundTwo.<span style="color: #0000FF;">Size</span>.<span style="color: #0000FF;">Width</span>, <span style="color: #FF0000;">0</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
BackgroundFour.<span style="color: #0000FF;">LoadContent</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Content</span>, <span style="color: #666666;">&quot;BackgroundFour&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
BackgroundFour.<span style="color: #0000FF;">Position</span> <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Vector2<span style="color: #000000;">&#40;</span>BackgroundThree.<span style="color: #0000FF;">Position</span>.<span style="color: #0000FF;">X</span> <span style="color: #008000;">+</span> BackgroundThree.<span style="color: #0000FF;">Size</span>.<span style="color: #0000FF;">Width</span>, <span style="color: #FF0000;">0</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
BackgroundFive.<span style="color: #0000FF;">LoadContent</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Content</span>, <span style="color: #666666;">&quot;BackgroundFive&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
BackgroundFive.<span style="color: #0000FF;">Position</span> <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Vector2<span style="color: #000000;">&#40;</span>BackgroundFour.<span style="color: #0000FF;">Position</span>.<span style="color: #0000FF;">X</span> <span style="color: #008000;">+</span> BackgroundFour.<span style="color: #0000FF;">Size</span>.<span style="color: #0000FF;">Width</span>, <span style="color: #FF0000;">0</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0600FF;">protected</span> <span style="color: #0600FF;">override</span> <span style="color: #0600FF;">void</span> UnloadContent<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #008080; font-style: italic;">// TODO: Unload any non ContentManager content here</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0600FF;">protected</span> <span style="color: #0600FF;">override</span> <span style="color: #0600FF;">void</span> Update<span style="color: #000000;">&#40;</span>GameTime gameTime<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #008080; font-style: italic;">// Allows the game to exit</span>
<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>GamePad.<span style="color: #0000FF;">GetState</span><span style="color: #000000;">&#40;</span>PlayerIndex.<span style="color: #0000FF;">One</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Buttons</span>.<span style="color: #0000FF;">Back</span> <span style="color: #008000;">==</span> ButtonState.<span style="color: #0000FF;">Pressed</span><span style="color: #000000;">&#41;</span>
<span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Exit</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
monVaisseau.<span style="color: #0000FF;">Update</span><span style="color: #000000;">&#40;</span>gameTime<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>BackgroundOne.<span style="color: #0000FF;">Position</span>.<span style="color: #0000FF;">X</span> <span style="color: #008000;">&amp;</span>lt<span style="color: #008000;">;</span> <span style="color: #008000;">-</span>BackgroundOne.<span style="color: #0000FF;">Size</span>.<span style="color: #0000FF;">Width</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
BackgroundOne.<span style="color: #0000FF;">Position</span>.<span style="color: #0000FF;">X</span> <span style="color: #008000;">=</span> BackgroundFive.<span style="color: #0000FF;">Position</span>.<span style="color: #0000FF;">X</span> <span style="color: #008000;">+</span> BackgroundFive.<span style="color: #0000FF;">Size</span>.<span style="color: #0000FF;">Width</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>BackgroundTwo.<span style="color: #0000FF;">Position</span>.<span style="color: #0000FF;">X</span> <span style="color: #008000;">&amp;</span>lt<span style="color: #008000;">;</span> <span style="color: #008000;">-</span>BackgroundTwo.<span style="color: #0000FF;">Size</span>.<span style="color: #0000FF;">Width</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
BackgroundTwo.<span style="color: #0000FF;">Position</span>.<span style="color: #0000FF;">X</span> <span style="color: #008000;">=</span> BackgroundOne.<span style="color: #0000FF;">Position</span>.<span style="color: #0000FF;">X</span> <span style="color: #008000;">+</span> BackgroundOne.<span style="color: #0000FF;">Size</span>.<span style="color: #0000FF;">Width</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>BackgroundThree.<span style="color: #0000FF;">Position</span>.<span style="color: #0000FF;">X</span> <span style="color: #008000;">&amp;</span>lt<span style="color: #008000;">;</span> <span style="color: #008000;">-</span>BackgroundThree.<span style="color: #0000FF;">Size</span>.<span style="color: #0000FF;">Width</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
BackgroundThree.<span style="color: #0000FF;">Position</span>.<span style="color: #0000FF;">X</span> <span style="color: #008000;">=</span> BackgroundTwo.<span style="color: #0000FF;">Position</span>.<span style="color: #0000FF;">X</span> <span style="color: #008000;">+</span> BackgroundTwo.<span style="color: #0000FF;">Size</span>.<span style="color: #0000FF;">Width</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>BackgroundFour.<span style="color: #0000FF;">Position</span>.<span style="color: #0000FF;">X</span> <span style="color: #008000;">&amp;</span>lt<span style="color: #008000;">;</span> <span style="color: #008000;">-</span>BackgroundFour.<span style="color: #0000FF;">Size</span>.<span style="color: #0000FF;">Width</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
BackgroundFour.<span style="color: #0000FF;">Position</span>.<span style="color: #0000FF;">X</span> <span style="color: #008000;">=</span> BackgroundThree.<span style="color: #0000FF;">Position</span>.<span style="color: #0000FF;">X</span> <span style="color: #008000;">+</span> BackgroundThree.<span style="color: #0000FF;">Size</span>.<span style="color: #0000FF;">Width</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>BackgroundFive.<span style="color: #0000FF;">Position</span>.<span style="color: #0000FF;">X</span> <span style="color: #008000;">&amp;</span>lt<span style="color: #008000;">;</span> <span style="color: #008000;">-</span>BackgroundFive.<span style="color: #0000FF;">Size</span>.<span style="color: #0000FF;">Width</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
BackgroundFive.<span style="color: #0000FF;">Position</span>.<span style="color: #0000FF;">X</span> <span style="color: #008000;">=</span> BackgroundFour.<span style="color: #0000FF;">Position</span>.<span style="color: #0000FF;">X</span> <span style="color: #008000;">+</span> BackgroundFour.<span style="color: #0000FF;">Size</span>.<span style="color: #0000FF;">Width</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
Vector2 aDirection <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Vector2<span style="color: #000000;">&#40;</span><span style="color: #008000;">-</span><span style="color: #FF0000;">1</span>, <span style="color: #FF0000;">0</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
Vector2 aSpeed <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Vector2<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">160</span>, <span style="color: #FF0000;">0</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
BackgroundOne.<span style="color: #0000FF;">Position</span> <span style="color: #008000;">+=</span> aDirection <span style="color: #008000;">*</span> aSpeed <span style="color: #008000;">*</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">float</span><span style="color: #000000;">&#41;</span>gameTime.<span style="color: #0000FF;">ElapsedGameTime</span>.<span style="color: #0000FF;">TotalSeconds</span><span style="color: #008000;">;</span>
BackgroundTwo.<span style="color: #0000FF;">Position</span> <span style="color: #008000;">+=</span> aDirection <span style="color: #008000;">*</span> aSpeed <span style="color: #008000;">*</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">float</span><span style="color: #000000;">&#41;</span>gameTime.<span style="color: #0000FF;">ElapsedGameTime</span>.<span style="color: #0000FF;">TotalSeconds</span><span style="color: #008000;">;</span>
BackgroundThree.<span style="color: #0000FF;">Position</span> <span style="color: #008000;">+=</span> aDirection <span style="color: #008000;">*</span> aSpeed <span style="color: #008000;">*</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">float</span><span style="color: #000000;">&#41;</span>gameTime.<span style="color: #0000FF;">ElapsedGameTime</span>.<span style="color: #0000FF;">TotalSeconds</span><span style="color: #008000;">;</span>
BackgroundFour.<span style="color: #0000FF;">Position</span> <span style="color: #008000;">+=</span> aDirection <span style="color: #008000;">*</span> aSpeed <span style="color: #008000;">*</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">float</span><span style="color: #000000;">&#41;</span>gameTime.<span style="color: #0000FF;">ElapsedGameTime</span>.<span style="color: #0000FF;">TotalSeconds</span><span style="color: #008000;">;</span>
BackgroundFive.<span style="color: #0000FF;">Position</span> <span style="color: #008000;">+=</span> aDirection <span style="color: #008000;">*</span> aSpeed <span style="color: #008000;">*</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">float</span><span style="color: #000000;">&#41;</span>gameTime.<span style="color: #0000FF;">ElapsedGameTime</span>.<span style="color: #0000FF;">TotalSeconds</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">base</span>.<span style="color: #0000FF;">Update</span><span style="color: #000000;">&#40;</span>gameTime<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0600FF;">protected</span> <span style="color: #0600FF;">override</span> <span style="color: #0600FF;">void</span> Draw<span style="color: #000000;">&#40;</span>GameTime gameTime<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
GraphicsDevice.<span style="color: #0000FF;">Clear</span><span style="color: #000000;">&#40;</span>Color.<span style="color: #0000FF;">CornflowerBlue</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
spriteBatch.<span style="color: #0000FF;">Begin</span><span style="color: #000000;">&#40;</span>SpriteSortMode.<span style="color: #0000FF;">Immediate</span>, BlendState.<span style="color: #0000FF;">AlphaBlend</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
BackgroundOne.<span style="color: #0000FF;">Draw</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">spriteBatch</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
BackgroundTwo.<span style="color: #0000FF;">Draw</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">spriteBatch</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
BackgroundThree.<span style="color: #0000FF;">Draw</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">spriteBatch</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
BackgroundFour.<span style="color: #0000FF;">Draw</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">spriteBatch</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
BackgroundFive.<span style="color: #0000FF;">Draw</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">spriteBatch</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
monVaisseau.<span style="color: #0000FF;">Draw</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">spriteBatch</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
spriteBatch.<span style="color: #0000FF;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF;">base</span>.<span style="color: #0000FF;">Draw</span><span style="color: #000000;">&#40;</span>gameTime<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Et voilà, c’est terminé. Lancez un Debug et lorsque vous vous déplacez d’arrière en avant vous devriez voir le vaisseau Tequila apparaître à l’écran tirant des boules de feu !</p>
<div id="attachment_3227" class="wp-caption alignnone" style="width: 310px"><a href="http://blog.tequilarapido.com/wp-content/uploads/2010/08/Shoot.png"><img class="size-full wp-image-3227" title="Shoot" src="http://blog.tequilarapido.com/wp-content/uploads/2010/08/Shoot.png" alt="tequilashoot" width="300" height="552" /></a><p class="wp-caption-text">tequilashoot</p></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.tequilarapido.com/2010/08/30/tutoriel-de-developpement-xna-partie-ii-mon-premier-jeu-avec-xna-4-0-part-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

