Hébergeur de fichiers indépendant

programing guide03 en.html

À propos

Type de fichier
Fichier HTML de 15 Ko (text/html)
Confidentialité
Fichier public, envoyé le 17 mai 2012 à 14:50, depuis l'adresse IP 86.63.x.x (France)
Sécurité
Ne contient aucun Virus ou Malware connus - Dernière vérification: 2 jours
Statistiques
La présente page de téléchargement a été vue 1097 fois depuis l'envoi du fichier
Page de téléchargement

Aperçu du fichier


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>PS Suite SDK: 3. 3. Entrée utilisateur (touche)</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>

<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 40px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname"><img src="image/title.png" alt="" width="289" height="40" /></div>
  </td>
  <td>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- Generated by Doxygen 1.7.3 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Search');
--></script>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('programing_guide03_en.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<h1>3. Entrée utilisateur </h1>  </div>
</div>
<div class="contents">
<div class="textblock"><p>Ce chapitre fournit une explication concernant les entrées utilisateur.</p>
<div class="contents topic" id="contents">
<p class="topic-title first">Contenu</p>
<ul class="simple">
<li><a class="reference internal" href="#detecting-user-inputs" id="id1">Détecter les entrées utilisateur</a><ul>
<li><a class="reference internal" href="#detecting-controller-input" id="id2">Détecter commande d'entrée</a></li>
<li><a class="reference internal" href="#keyboard-assignment" id="id3">Affectation du clavier</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="detecting-user-inputs">
<h1><a class="toc-backref" href="#id1">Détecter les entrées utilisateur</a></h1>
<p>Le texte suivant explique comment activer l'opération de contrôle pour le sprite affiché.</p>
<p>Ouvrez Sample/Tutorial/Sample03_01.</p>
<p>Sample/Tutorial/Sample03_01/AppMain.cs</p>
<div class="highlight"><pre><span class="k">public</span> <span class="k">static</span> <span class="k">void</span> <span class="nf">Initialize</span> <span class="p">()</span>
<span class="p">{</span>
        <span class="n">graphics</span> <span class="p">=</span> <span class="k">new</span> <span class="n">GraphicsContext</span><span class="p">();</span>

        <span class="n">shaderProgram</span> <span class="p">=</span> <span class="k">new</span> <span class="n">ShaderProgram</span><span class="p">(</span><span class="s">&quot;/Application/shaders/sprite.cgx&quot;</span><span class="p">);</span>
        <span class="n">shaderProgram</span><span class="p">.</span><span class="n">SetUniformBinding</span><span class="p">(</span><span class="m">0</span><span class="p">,</span> <span class="s">&quot;u_WorldMatrix&quot;</span><span class="p">);</span>

        <span class="n">ImageRect</span> <span class="n">rectScreen</span> <span class="p">=</span> <span class="n">graphics</span><span class="p">.</span><span class="n">Screen</span><span class="p">.</span><span class="n">Rectangle</span><span class="p">;</span>

        <span class="n">texture</span> <span class="p">=</span> <span class="k">new</span> <span class="n">Texture2D</span><span class="p">(</span><span class="s">&quot;/Application/resources/Player.png&quot;</span><span class="p">,</span> <span class="k">false</span><span class="p">);</span>
        <span class="n">spritePlayer</span> <span class="p">=</span> <span class="k">new</span> <span class="n">SimpleSprite</span><span class="p">(</span><span class="n">graphics</span><span class="p">,</span> <span class="n">texture</span><span class="p">);</span>
        <span class="n">spritePlayer</span><span class="p">.</span><span class="n">Position</span><span class="p">.</span><span class="n">X</span> <span class="p">=</span> <span class="n">rectScreen</span><span class="p">.</span><span class="n">Width</span><span class="p">/</span><span class="m">2.0f</span><span class="p">;</span>
        <span class="n">spritePlayer</span><span class="p">.</span><span class="n">Position</span><span class="p">.</span><span class="n">Y</span> <span class="p">=</span> <span class="n">rectScreen</span><span class="p">.</span><span class="n">Height</span><span class="p">/</span><span class="m">2.0f</span><span class="p">;</span>
        <span class="n">spritePlayer</span><span class="p">.</span><span class="n">Position</span><span class="p">.</span><span class="n">Z</span> <span class="p">=</span> <span class="m">0.0f</span><span class="p">;</span>

        <span class="n">unitScreenMatrix</span> <span class="p">=</span> <span class="k">new</span> <span class="n">Matrix4</span><span class="p">(</span>
                 <span class="m">2.0f</span><span class="p">/</span><span class="n">rectScreen</span><span class="p">.</span><span class="n">Width</span><span class="p">,</span> <span class="m">0.0f</span><span class="p">,</span>   <span class="m">0.0f</span><span class="p">,</span> <span class="m">0.0f</span><span class="p">,</span>
                 <span class="m">0.0f</span><span class="p">,</span> <span class="p">-</span><span class="m">2.0f</span><span class="p">/</span><span class="n">rectScreen</span><span class="p">.</span><span class="n">Height</span><span class="p">,</span> <span class="m">0.0f</span><span class="p">,</span> <span class="m">0.0f</span><span class="p">,</span>
                 <span class="m">0.0f</span><span class="p">,</span>  <span class="m">0.0f</span><span class="p">,</span> <span class="m">1.0f</span><span class="p">,</span> <span class="m">0.0f</span><span class="p">,</span>
                <span class="p">-</span><span class="m">1.0f</span><span class="p">,</span> <span class="m">1.0f</span><span class="p">,</span> <span class="m">0.0f</span><span class="p">,</span> <span class="m">1.0f</span>
        <span class="p">);</span>
<span class="p">}</span>
</pre></div>
<!-- end-of-code-block -->
<p>Le SimpleSprite défini dans le chapitre précédent sera utilisé pour afficher un sprite. Transmettre une référence à GraphicsContext et des exemples de Texture2D au constructeur de sprite. Après avoir généré une instance SimpleSprite, insérez une valeur de position et spécifiez les coordonnées.</p>
<div class="section" id="detecting-controller-input">
<h2><a class="toc-backref" href="#id2">Détecter commande d'entrée</a></h2>
<p>GamePad.GetData() est utilisé pour détecter les contrôles entrées.
Les entrées sont détectées dans Update().</p>
<p>Sample/Tutorial/Sample03_01/AppMain.cs</p>
<div class="highlight"><pre><span class="k">public</span> <span class="k">static</span> <span class="k">void</span> <span class="nf">Update</span> <span class="p">()</span>
<span class="p">{</span>
        <span class="n">gamePadData</span> <span class="p">=</span> <span class="n">GamePad</span><span class="p">.</span><span class="n">GetData</span><span class="p">(</span><span class="m">0</span><span class="p">);</span>

        <span class="kt">int</span> <span class="n">speed</span> <span class="p">=</span> <span class="m">4</span><span class="p">;</span>

        <span class="k">if</span><span class="p">((</span><span class="n">gamePadData</span><span class="p">.</span><span class="n">Buttons</span> <span class="p">&amp;</span> <span class="n">GamePadButtons</span><span class="p">.</span><span class="n">Left</span><span class="p">)</span> <span class="p">!=</span> <span class="m">0</span><span class="p">)</span>
        <span class="p">{</span>
                <span class="n">spritePlayer</span><span class="p">.</span><span class="n">Position</span><span class="p">.</span><span class="n">X</span> <span class="p">-=</span> <span class="n">speed</span><span class="p">;</span>
        <span class="p">}</span>
        <span class="k">if</span><span class="p">((</span><span class="n">gamePadData</span><span class="p">.</span><span class="n">Buttons</span> <span class="p">&amp;</span> <span class="n">GamePadButtons</span><span class="p">.</span><span class="n">Right</span><span class="p">)</span> <span class="p">!=</span> <span class="m">0</span><span class="p">)</span>
        <span class="p">{</span>
                <span class="n">spritePlayer</span><span class="p">.</span><span class="n">Position</span><span class="p">.</span><span class="n">X</span> <span class="p">+=</span> <span class="n">speed</span><span class="p">;</span>
        <span class="p">}</span>
        <span class="k">if</span><span class="p">((</span><span class="n">gamePadData</span><span class="p">.</span><span class="n">Buttons</span> <span class="p">&amp;</span> <span class="n">GamePadButtons</span><span class="p">.</span><span class="n">Up</span><span class="p">)</span> <span class="p">!=</span> <span class="m">0</span><span class="p">)</span>
        <span class="p">{</span>
                <span class="n">spritePlayer</span><span class="p">.</span><span class="n">Position</span><span class="p">.</span><span class="n">Y</span> <span class="p">-=</span> <span class="n">speed</span><span class="p">;</span>
        <span class="p">}</span>
        <span class="k">if</span><span class="p">((</span><span class="n">gamePadData</span><span class="p">.</span><span class="n">Buttons</span> <span class="p">&amp;</span> <span class="n">GamePadButtons</span><span class="p">.</span><span class="n">Down</span><span class="p">)</span> <span class="p">!=</span> <span class="m">0</span><span class="p">)</span>
        <span class="p">{</span>
                <span class="n">spritePlayer</span><span class="p">.</span><span class="n">Position</span><span class="p">.</span><span class="n">Y</span> <span class="p">+=</span> <span class="n">speed</span><span class="p">;</span>
        <span class="p">}</span>
<span class="p">}</span>
</pre></div>
<!-- end-of-code-block -->
<p>Le numéro de l'appareil est défini dans l'argument de GamePad.GetData(0). En règle générale, 0 marche très bien.
Chaque état de touche entrée sera déterminée avec des instructions if. Si la touch est pressée, changez la valeur de spritePlayer.Position et mettez à jour les coordonnées du joueur (L'image de l'avion).</p>
</div>
<div class="section" id="keyboard-assignment">
<h2><a class="toc-backref" href="#id3">Affectation du clavier</a></h2>
<p>Pour l'exécution avec le simulateur PC, les touches de la manette sont chacune affectée à une touche sur le clavier.</p>
<blockquote>
<table border="1" class="docutils">
<colgroup>
<col width="45%" />
<col width="55%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">Les Touches sur la manette de jeu</th>
<th class="head"> Affectations des touches sur le simulateur PC </th>
</tr>
</thead>
<tbody valign="top">
<tr><td>Touche direction: gauche</td>
<td>Curseur: ←</td>
</tr>
<tr><td>Touche direction: haut</td>
<td>Curseur: ↑</td>
</tr>
<tr><td>Touche direction: droite</td>
<td>Curseur: →</td>
</tr>
<tr><td>Touche direction: bas</td>
<td>Curseur: ↓</td>
</tr>
<tr><td>Bouton: Carré</td>
<td>Alphabet: A</td>
</tr>
<tr><td>Bouton: Triangle</td>
<td>Alphabet: W</td>
</tr>
<tr><td>Bouton: Cercle</td>
<td>Alphabet: D</td>
</tr>
<tr><td>Bouton: Croix</td>
<td>Alphabet: S</td>
</tr>
<tr><td>Bouton: SELECT</td>
<td>Alphabet: Z</td>
</tr>
<tr><td>Bouton: START</td>
<td>Alphabet: X</td>
</tr>
<tr><td>Bouton: L</td>
<td>Alphabet: Q</td>
</tr>
<tr><td>Bouton R</td>
<td>Alphabet: E</td>
</tr>
</tbody>
</table>
</blockquote>
<p>Pour plus de détails, se référer à: <a class="reference external" href="simulator_for_pc_en.html">About the PC Simulator</a>.</p>
<p>Essayons de construire et d'exécuter.
Le déplacement du joueur est possible avec les touches directionnelles.</p>
<blockquote>
<img alt="image/program_guide/user_input.jpg" src="image/program_guide/user_input.jpg" />
</blockquote>
</div>
</div>
 </div></div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
<!--- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Properties</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Events</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<!--<div id="footer">-->
<div style='text-align : right'>
&copy;2012 Sony Computer Entertainment Inc. All Rights Reserved.&nbsp;&nbsp;&nbsp;&nbsp;SCE CONFIDENTIAL &nbsp;<br>
</div>
</body>
</html>


Partager le fichier

Télécharger programing_guide03_en.html

Télécharger le fichier (15 Ko)