本文整理汇总了PHP中h2函数的典型用法代码示例。如果您正苦于以下问题:PHP h2函数的具体用法?PHP h2怎么用?PHP h2使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了h2函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: courses_render
function courses_render($course)
{
$id = $course['Course_id'];
//h3("<a href='index.php?option=store&view=delete&v1=$id'>Remove Course</a>");
h2("Course number:" . $course['Course_number'] . " Name:" . $course['Name']);
p("<h3>Description: " . $course['Description'] . "</h3>");
//if (users_loggedIn()) {
//p("<a href='index.php?option=courses&view=delete&v1=$id'>Remove Course</a>");
//Course number:".$course['Course_number']." Name:".$course['Name'].";
//}
}
开发者ID:pmontojo,项目名称:Blackboard,代码行数:11,代码来源:admin.php
示例2: users_render
function users_render($user)
{
$role = $user['role'];
if ($role == "Professor") {
h2("<hr><b>Professors</b>");
p("User name:" . $user['username']);
p("User role:" . $role);
p("User email:" . $user['email']);
} else {
h2("<b>Students</b>");
p("User name:" . $user['username']);
p("User role:" . $role);
p("User email:" . $user['email']);
}
//h3("<a href='index.php?option=store&view=details&v1=$id'>Course number:".$course['Course_number']." Name:".$course['Name']."</a>");
//p("Description: ".$course['Description']);
//if (users_loggedIn()) {
//books_renderEnrollForm($course);
//}
}
开发者ID:pmontojo,项目名称:Blackboard,代码行数:20,代码来源:users_list.php
示例3: view
function view($data)
{
startOfPage("students list vieww");
startContent();
siteTitle("Blackboard");
p("Welcome to Blackboard - Please Log in !");
$students = $data["users"];
if (!empty($students)) {
h2("List of students:");
foreach ($students as $student) {
students_render($student);
}
h2("List of professors:");
foreach ($students as $student) {
professors_render($student);
}
}
endContent();
endOfPage();
}
开发者ID:beafus,项目名称:blackboard,代码行数:20,代码来源:students_list.php
示例4: takeaway_heading
/**
*######################################################################
*# takeaway heading
*######################################################################
*/
function takeaway_heading($atts)
{
if (isset($atts['type'])) {
switch ($atts['type']) {
case 'h1':
return h1($atts);
break;
case 'h2':
return h2($atts);
break;
case 'h3':
return h3($atts);
break;
case 'h4':
return h4($atts);
break;
case 'h5':
return h5($atts);
break;
}
}
return '';
}
开发者ID:ankitparsanaa,项目名称:foodapp,代码行数:28,代码来源:shortcodes.php
示例5: h2
The current texture is not automatic, you need to treat it like you do the other input variables, and explicitly set it from your C++ program. Since each entity can have a different
texture, and worse, there might be no way for you to get it and pass it to the shader, SFML provides a special overload of the <code>setParameter</code> function that
does this job for you.
</p>
<pre><code class="cpp">shader.setParameter("texture", sf::Shader::CurrentTexture);
</code></pre>
<p>
This special parameter automatically sets the texture of the entity being drawn to the shader variable with the given name. Every time you draw a new entity, SFML will update the shader
texture variable accordingly.
</p>
<p>
If you want to see nice examples of shaders in action, you can have a look at the Shader example in the SFML SDK.
</p>
<?php
h2('Using a sf::Shader with OpenGL code');
?>
<p>
If you're using OpenGL rather than the graphics entities of SFML, you can still use <?php
class_link("Shader");
?>
as a wrapper around an OpenGL program object and use it
within your OpenGL code.
</p>
<p>
To activate a <?php
class_link("Shader");
?>
for drawing (the equivalent of <code>glUseProgram</code>), you have to call the <code>bind</code> static function:
</p>
<pre><code class="cpp">sf::Shader shader;
开发者ID:bsaleil,项目名称:SFML-Website,代码行数:31,代码来源:graphics-shader.php
示例6: h2
</p>
<pre><code class="cpp">sound.setVolume(50);
</code></pre>
</p>
The <em>loop</em> attribute controls whether the sound/music automatically loops or not. If it loops, it will restart playing from the beginning when it's finished,
again and again until you explicitly call <code>stop</code>. If not set to loop, it will stop automatically when it's finished.
</p>
<pre><code class="cpp">sound.setLoop(true);
</code></pre>
<p>
More attributes are available, but they are related to spatialization and are explained in the
<a class="internal" href="./audio-spatialization.php" title="Spatialization tutorial">corresponding tutorial</a>.
</p>
<?php
h2('Common mistakes');
?>
<h3>Destroyed sound buffer</h3>
<p>
The most common mistake is to let a sound buffer go out of scope (and therefore be destroyed) while a sound still uses it.
</p>
<pre><code class="cpp">sf::Sound loadSound(std::string filename)
{
sf::SoundBuffer buffer; // this buffer is local to the function, it will be destroyed...
buffer.loadFromFile(filename);
return sf::Sound(buffer);
} // ... here
sf::Sound sound = loadSound("s.wav");
sound.play(); // ERROR: the sound's buffer no longer exists, the behavior is undefined
开发者ID:bsaleil,项目名称:SFML-Website,代码行数:31,代码来源:audio-sounds.php
示例7: h2
h2("LatLngBounds class: maximum bounds in GMaps");
$bounds3 = new LatLngBounds(new LatLng(-85.051128779807, -180), new LatLng(85.051128779807, 180));
h3("Constructor (new LatLng(-85.051128779807, -180), new LatLng(85.051128779807, 180))");
p($bounds3->toString());
h3("getCenter()");
p($bounds3->getCenter()->toString());
h3("getSouthWest()");
p($bounds3->getSouthWest()->toString());
h3("getNorthEast()");
p($bounds3->getNorthEast()->toString());
h3('contains(moscow)');
p($bounds3->contains($moscow));
h3('contains(sydney)');
p($bounds3->contains($sydney));
h3('contains(buenosaires)');
p($bounds3->contains($buenosaires));
h2('Spherical geometry static class');
h3('computeArea(london, donostia, newyork)');
p(float_to_string(SphericalGeometry::computeArea(array($london, $donostia, $newyork))));
h3('computeSignedArea(london, donostia, newyork)');
p(float_to_string(SphericalGeometry::computeSignedArea(array($london, $donostia, $newyork))));
h3('computeDistanceBetween(london, newyork)');
p(float_to_string(SphericalGeometry::computeDistanceBetween($london, $newyork)));
h3('computeHeading(london, newyork)');
p(float_to_string(SphericalGeometry::computeHeading($london, $newyork)));
h3('computeLength(london, newyork, moscow, sydney)');
p(float_to_string(SphericalGeometry::computeLength(array($london, $newyork, $moscow, $sydney))));
h3('computeOffset(london, 5576353.232683, -71.669371)');
p(SphericalGeometry::computeOffset($london, 5576353.232683, -71.669371)->toString());
h3('interpolate(newyork, sydney, 0.7)');
p(SphericalGeometry::interpolate($newyork, $sydney, 0.7)->toString());
开发者ID:sutandang,项目名称:spherical-geometry-php,代码行数:31,代码来源:tests.inc.php
示例8: var_dump
var_dump($out_f5);
// int(10)
$out_f5 = f5();
var_dump($out_f5);
// int(11) [**]
/*
* actual_paramter ::= '&' VARIABLE
*
* Note the discrepency between this and the previous test.
* - If a function _returns_ a symbol table entry, the associated assignment
* must also be =& (and not just =; cf. test above)
* - For a function to _accept_ a symbol table entry, there is a choice:
* either you add the & to the formal parameter, or you add the & to the
* actual parameter (both is allowed too).
*/
function h1($in_h1)
{
$in_h1++;
}
$out_h1 = 5;
h1(&$out_h1);
var_dump($out_h1);
// Outputs 6
function h2(&$in_h2)
{
$in_h2++;
}
$out_h2 = 5;
h2(&$out_h2);
var_dump($out_h2);
// Outputs 6
开发者ID:michaelprem,项目名称:phc,代码行数:31,代码来源:refs.php
示例9: transformations
{
// collision!
}
</code></pre>
<p>
La fonction est nommée <code>getGlobalBounds</code> car elle renvoie la boîte englobante de l'entité dans le système de coordonnées global, c'est-à-dire avec toutes
ses transformations (position, rotation, échelle) appliquées.
</p>
<p>
Il existe une autre fonction, qui renvoie la boîte englobante de l'entité dans son système de coordonnées <em>local</em> (sans les transformations) :
<code>getLocalBounds</code>. Cette fonction peut être utilisée pour récupérer la taille initiale de l'entité, par exemple, ou bien pour effectuer des calculs
plus spécifiques.
</p>
<?php
h2('Les hiérarchies d\'objets (scenegraph)');
?>
<p>
Avec les transformations persos vues précédemment, il est maintenant facile d'implémenter une hiérarchie d'objets, où les enfants sont transformés relativement à leur
parent. Tout ce que vous avez à faire est de passer la transformation combinée du parent aux enfants lorsque vous les dessinez, jusqu'à ce que vous atteignez les
entités dessinables finales (sprites, textes, formes, vertex arrays ou bien vos propres 'drawables').
</p>
<pre><code class="cpp">// la classe de base abstraite
class Node
{
public:
// ... fonctions pour transformer le noeud
// ... fonction pour gérer les enfants du noeud
开发者ID:bsaleil,项目名称:SFML-Website,代码行数:30,代码来源:graphics-transform-fr.php
示例10: applications
</p>
<p>
It's up to you to decide which solution is the best for you.
</p>
<p>
Note : none of the SFML modules requires a library which is not already installed by default on Mac OS X,
except the Audio module which requires the OpenAL and libsndfile libraries. So you'll have to provide them
together with your applications (see the extlibs/bin directory of the downloaded disk image). If you use the 64-bit version
of SFML, you don't have to provide the OpenAL framework. Note that you can find the
OpenAL framework in the system's folders, however the version delivered with Mac OS X 10.4 is not working well,
that's why we provide a recompiled version with SFML.
</p>
<?php
h2('Compiling SFML (for advanced users)');
?>
<p>
To compile the SFML frameworks and samples, you first have to download the full SDK
(see the <a class="internal" href="../../download.php" title="Go to the download page">download page</a>).
</p>
<p>
Go to the SFML-x.y/build/xcode directory and open the SFML.xcodeproj project (compatible with Xcode 2.4 and +).
According to what you need, choose the target (Debug or Release), and launch the compile process. It can last
a few minutes, depending on the power of your PC. You will then find the built frameworks in the
SFML-x.y/lib directory (or SFML-x.y/lib64 if you chose to compile SFML for 64-bit processors with the
"SFML with Intel 64-bit.xcodeproj" project).
</p>
<p>
Similarly, if you want to create the raw dynamic libraries, you can use the SFML-bare.xcodeproj project.
The compile process produces dynamic libraries (files with the "dylib" extension) in the same
开发者ID:bsaleil,项目名称:SFML-Website,代码行数:30,代码来源:start-osx.php
示例11: h2
<li><a href="graphics-sprite.php" title="Sprites and textures">Sprites and textures</a></li>
<li><a href="graphics-text.php" title="Text and fonts">Text and fonts</a></li>
<li><a href="graphics-shape.php" title="Shapes">Shapes</a></li>
<li><a href="graphics-vertex-array.php" title="Designing your own entities with vertex arrays">Designing your own entities with vertex arrays</a></li>
<li><a href="graphics-transform.php" title="Position, rotation, scale: transforming entities">Position, rotation, scale: transforming entities</a></li>
<li><a href="graphics-shader.php" title="Adding special effects with shaders">Adding special effects with shaders</a></li>
<li><a href="graphics-view.php" title="Controlling the 2D camera with views">Controlling the 2D camera with views</a></li>
</ul>
<?php
h2('Audio module');
?>
<ul>
<li><a href="audio-sounds.php" title="Playing sounds and music">Playing sounds and music</a></li>
<li><a href="audio-recording.php" title="Recording audio">Recording audio</a></li>
<li><a href="audio-streams.php" title="Custom audio streams">Custom audio streams</a></li>
<li><a href="audio-spatialization.php" title="Spatialization">Spatialization: Sounds in 3D</a></li>
</ul>
<?php
h2('Network module');
?>
<ul>
<li><a href="network-socket.php" title="Communication using sockets">Communication using sockets</a></li>
<li><a href="network-packet.php" title="Using and extending packets">Using and extending packets</a></li>
<li><a href="network-http.php" title="Web requests with HTTP">Web requests with HTTP</a></li>
<li><a href="network-ftp.php" title="File transfers with FTP">File transfers with FTP</a></li>
</ul>
<?php
require "footer.php";
开发者ID:bsaleil,项目名称:SFML-Website,代码行数:31,代码来源:index.php
示例12: h2
$export_print = HtmlInput::print_window();
$export_csv = '<FORM METHOD="get" ACTION="export.php" style="display:inline">';
$export_csv .= HtmlInput::hidden('cat', $_GET['cat']);
$export_csv .= HtmlInput::hidden('act', 'CSV:fiche_balance');
$export_csv .= HtmlInput::hidden('start', $_GET['start']);
$export_csv .= HtmlInput::hidden('end', $_GET['end']);
$export_csv .= HtmlInput::hidden('histo', $_GET['histo']);
$export_csv .= HtmlInput::request_to_hidden(array('allcard'));
$export_csv .= dossier::hidden();
$export_csv .= HtmlInput::submit('CSV', 'Export en CSV');
$export_csv .= '</FORM>';
/*
* Date is important is requested balance
*/
if (isDate($_REQUEST['start']) == null || isDate($_REQUEST['end']) == null) {
echo h2('Date invalide !', 'class="error"');
alert('Date invalide !');
return;
}
/*************************************************************************************************************************
* Balance agée tous
/*************************************************************************************************************************/
if ($_GET['histo'] == 6) {
require_once NOALYSS_INCLUDE . '/class_balance_age.php';
$bal = new Balance_Age($cn);
$export_csv = '<FORM METHOD="get" ACTION="export.php" style="display:inline">';
$export_csv .= HtmlInput::request_to_hidden(array('gDossier', 'ac', 'p_let', 'p_date_start'));
$export_csv .= HtmlInput::hidden('p_date_start', $_GET['start']);
$export_csv .= HtmlInput::hidden('act', 'CSV:balance_age');
$export_csv .= HtmlInput::hidden('p_let', 'let');
$export_csv .= HtmlInput::hidden('p_type', 'X');
开发者ID:Kloadut,项目名称:noalyss_ynh,代码行数:31,代码来源:fiche.inc.php
示例13: head
head('jMList');
topheading('home');
open('div', array('id' => 'body'));
h2('Overview');
$_jMList = txttag('span', array('class' => 'jmlist'), 'jMList');
$_XML = acronym('XML', 'eXtensible Markup Language');
$_HTML = acronym('HTML', 'HyperText Markup Language');
$_XSL = acronym('XSL', 'eXtensible Stylesheet Language');
$_RDF = acronym('RDF', 'Resource Description Framework');
$_RSS = acronym('RSS', 'RDF Site Summary');
tag('p', array(), "{$_jMList} is a small utility that scans one or more given " . "directories for media files (currently only audio files) and " . "generates a {$_XML} listing of the whole directory tree with " . "information about each media file such as filesize, song length, " . "title, author, album, etc. A {$_XSL} stylesheet can be applied to " . "the output to transform into a different output, like tabular or " . "tree listings in plain text, {$_XML}, {$_HTML}, {$_RDF}, {$_RSS} or any " . "other {$_XML} format.");
$_MP3 = acronym('MP3', 'MPEG Layer-3');
$_FLAC = acronym('FLAC', 'Free Lossless Audio Codec');
tag('p', array(), "{$_jMList} is still in its earlier stages of developement, but it " . "already supports identification of {$_MP3} and OGG files and is capable " . "of extracting meta-information from ID3, ID3v2 and Vorbis tags.");
tag('p', array(), "{$_jMList} is released under the " . a('GNU', 'http://www.gnu.org/') . " " . a('General Public License', 'http://www.gnu.org/licenses/gpl.html') . ".");
h2('Features');
tag('p', array(), "The following features are currently supported by {$_jMList}:");
open('ol', array());
tag('li', array(), "Internally transform output through {$_XSL}.");
tag('li', array(), "Parsing information from MPEG Layer 1, 2 and 3 ({$_MP3}) files, both ID3 v1 and v2 tags.");
tag('li', array(), "Parsing information from Ogg Vorbis (OGG) files.");
tag('li', array(), "Full Unicode support.");
tag('li', array(), "Parsing data in UTF-8 and ISO8859-1 encondings from ID3 tags.");
close();
tag('p', array(), "The following features are planned to be supported:");
$_NLS = acronym('NLS', 'National Language Support');
$_i18n = acronym('i18n', 'internationalization');
open('ol');
tag('li', array(), "Detect and parse data from tags based on an user-provided list of possible character encodings.");
tag('li', array(), "Properly support files > 2GiB.");
tag('li', array(), "National Language ({$_NLS}, {$_i18n}) support");
开发者ID:BackupTheBerlios,项目名称:jmlist-svn,代码行数:31,代码来源:index.php
示例14: size
It is this simple "L" prefix in front of the string that makes it work by telling the compiler to produce a wide string. Wide strings are a strange beast
in C++: the standard doesn't say anything about their size (16-bit? 32-bit?), nor about the encoding that they use (UTF-16? UTF-32?). However
we know that on most platforms, if not all, they'll produce Unicode strings, and SFML knows how to handle them correctly.
</p>
<p>
Note that the C++11 standard supports new character types and prefixes to build UTF-8, UTF-16 and UTF-32 string literals, but SFML doesn't support
them yet.
</p>
<p>
It may seem obvious, but you also have to make sure that the font that you use contains the characters that you want to draw. Indeed, fonts
don't contain glyphs for all possible characters (there are more than 100000 in the Unicode standard!), and an arabic font won't be able to display japanese
text, for example.
</p>
<?php
h2('Making your own text class');
?>
<p>
If <?php
class_link('Text');
?>
is too limited, or if you want to do something else with pre-rendered glyphs, <?php
class_link('Font');
?>
provides
everything that you need.
</p>
<p>
You can retrieve the texture which contains all the pre-rendered glyphs of a certain size:
</p>
<pre><code class="cpp">const sf::Texture& texture = font.getTexture(characterSize);
开发者ID:bsaleil,项目名称:SFML-Website,代码行数:31,代码来源:graphics-text.php
示例15: h1
echo "Done\n";
//*/
///*
echo "----- test using literals, constants, and arbitrary-complex expressions ----\n";
//$a =& 12; // literals are disallowed
//$a =& CON; // constants are disallowed
$b = 10;
$a =& $b;
echo "After '=&', \$a is {$a}, \$b is {$b}\n";
//$a =& 5 + $b; // arbitrary-complex expressions are disallowed
echo "After '=&', \$a is {$a}, \$b is {$b}\n";
function h1()
{
$b = 10;
return $b + 5;
// return 12;
// return CON;
}
echo "h1() is " . h1() . "\n";
//*/
///*
function &h2()
{
$b = 10;
// return $b + 5; // Only variable references should be returned by reference
// return 12;
// return CON;
}
h2();
echo "Done\n";
//*/
开发者ID:jeremyadoux,项目名称:hhvm,代码行数:31,代码来源:memory_model_and_value_types.php
示例16: die
* along with NOALYSS; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright Author Dany De Bontridder [email protected]
/**\file
* \brief display a form to change the name of a predefined operation
*/
if (!defined('ALLOWED')) {
die('Appel direct ne sont pas permis');
}
ob_start();
require_once NOALYSS_INCLUDE . '/class_pre_operation.php';
$op = new Pre_Operation($cn, $_GET['id']);
$array = $op->load();
echo HtmlInput::anchor_close('mod_predf_op');
echo h2(_('Modification du nom'), ' class="title"');
echo '
<form method="POST" onsubmit="save_predf_op(this);return false;">';
$name = new IText('opd_name');
$name->value = $op->od_name;
$name->size = 60;
echo "Nom =" . $name->input();
$opd_description = new ITextarea('od_description');
$opd_description->style = ' class="itextarea" style="width:30em;height:4em;vertical-align:top"';
$opd_description->value = $op->od_description;
echo '<p>';
echo _("Description (max 50 car.)");
echo $opd_description->input();
echo '</p>';
echo dossier::hidden() . HtmlInput::hidden('od_id', $_GET['id']);
echo "<hr>";
开发者ID:Kloadut,项目名称:noalyss_ynh,代码行数:31,代码来源:ajax_mod_predf_op.php
示例17: h2
<tt>/Library/Developer/Xcode/Templates</tt> (si besoin, créez d'abord l'arborescence de répertoires).
</li>
</ul>
<p>
SFML est fournie avec un script <tt>install.sh</tt> qui peut installer tous les composants pour vous.
Il va faire attention à conserver les éventuelles anciennes version de SFML sur votre système, tout spécialement les frameworks,
de sorte que vos applications puissent toujours s'exécuter sans modification.
Vous avez seulement à ouvrir un terminal dans le répertoire du SDK téléchargé et lancer <code>./install.sh</code>.
Le script va alors vous demander votre mot de passe et tout installer à la bonne place.
</p>
<p>
À noter que <tt>/Library</tt> peut être nommé <tt>/Bibliothèque</tt> si votre système est en français.
</p>
<?php
h2('Créer un premier programme SFML');
?>
<p>
Nous fournissons deux templates pour Xcode. <tt>SFML CLT</tt> génère un projet pour une application terminal classique alors que <tt>SFML App</tt> crée un projet pour
un bundle d'application. Nous allons utiliser ce dernier ici mais ils fonctionnent relativement similairement.
</p>
<p>
Tout d'abord, choisissez <tt>File > New Project...</tt> puis sélectionnez <tt>SFML</tt> dans la colonne de gauche et double cliquez sur <tt>SFML App</tt>.
</p>
<img class="screenshot" src="images/start-osx-new-project.png" alt="Sélection du template Xcode" title="Sélection du template Xcode" />
<p>
Maintenant vous pouvez remplire les champs requis comme dans cette capture d'écran ; puis pressez <tt>next</tt>.
</p>
<img class="screenshot" src="images/start-osx-new-project-settings.png" alt="Formulaire du template Xcode" title="Formulaire du template Xcode" />
<p>
Votre nouveau projet est maintenant configuré pour créer un
开发者ID:bsaleil,项目名称:SFML-Website,代码行数:31,代码来源:start-osx-fr.php
示例18: h2
</p>
<pre><code class="cpp">sound.setVolume(50);
</code></pre>
</p>
La propriété <em>loop</em> détermine si le son ou la musique boucle automatiquement ou non. S'il boucle, il recommencera à zéro dès qu'il se finira,
encore et encore jusqu'à ce que vous appeliez explicitement <code>stop</code>. Sinon, il s'arrêtera automatiquement lorsqu'il est fini.
</p>
<pre><code class="cpp">sound.setLoop(true);
</code></pre>
<p>
D'autres propriétés sont disponible, mais elles sont liées à la spacialisation et sont expliquées dans le
<a class="internal" href="./audio-spatialization-fr.php" title="Tutoriel sur la spacialisation">tutoriel correspondant</a>.
</p>
<?php
h2('Erreur courantes');
?>
<h3>Buffer audio détruit</h3>
<p>
L'erreur la plus courante est de déclarer un buffer dans une portée réduite (telle qu'une fonction) et le laisser mourir à la fin alors qu'un son
l'utilise toujours.
</p>
<pre><code class="cpp">sf::Sound loadSound(std::string filename)
{
sf::SoundBuffer buffer; // ce buffer est local à la fonction, il sera détruit...
buffer.loadFromFile(filename);
return sf::Sound(buffer);
} // ... ici
sf::Sound sound = loadSound("s.wav");
开发者ID:bsaleil,项目名称:SFML-Website,代码行数:31,代码来源:audio-sounds-fr.php
示例19: h2
}
</code></pre>
<p>
Ces opérateurs renvoient une référence sur le paquet : cela permet de chaîner les appels.
</p>
<p>
Maintenant que ces opérateurs sont définis, vous pouvez insérer/extraire un <code>Character</code> dans/depuis un paquet comme n'importe quel autre type primitif :
</p>
<pre><code class="cpp">Character bob;
packet << bob;
packet >> bob;
</code></pre>
<?php
h2('Les paquets personnalisés');
?>
<p>
Les paquets offrent des fonctionnalités sympas par dessus vos données brutes, mais peut-on aller plus loin et ajouter vos propres fonctionnalités, comme par exemple
compresser ou chiffrer automatiquement les données lors de l'envoi ? Cela peut être fait très facilement, en créant une classe dérivée de <?php
class_link('Packet');
?>
et en redéfinissant les fonctions suivantes :
</p>
<ul>
<li><code>onSend</code>: appelée juste avant que la socket envoie les données</li>
<li><code>onReceive</code>: appelée juste après que la socket a reçu les données</li>
</ul>
<p>
Ces fonctions fournissent un accès direct aux données, de manière à ce que vous puissiez les transformer selon vos besoin.
</p>
开发者ID:bsaleil,项目名称:SFML-Website,代码行数:31,代码来源:network-packet-fr.php
示例20: while
while (window.pollEvent(event))
{
...
// catch the resize events
if (event.type == sf::Event::Resized)
{
// update the view to the new size of the window
sf::FloatRect visibleArea(0, 0, event.size.width, event.size.height);
window.setView(sf::View(visibleArea));
}
}
</code></pre>
<?php
h2('Coordinates conversions');
?>
<p>
When you use a custom view, or when you resize the window without using the code above, pixels displayed on the target no longer match units in the 2D world. For example,
clicking on pixel (10, 50) may hit the point (26.5, -84) of your world. You end up having to use a conversion function to map your pixel coordinates to world coordinates:
<code>mapPixelToCoords</code>.
</p>
<pre><code class="cpp">// get the current mouse position in the window
sf::Vector2i pixelPos = sf::Mouse::getPosition(window);
// convert it to world coordinates
sf::Vector2f worldPos = window.mapPixelToCoords(pixelPos);
</code></pre>
<p>
By default, <code>mapPixelToCoords</code> uses the current view. If you want to convert the coordinates using view which is not the active one, you can pass it as an
additional argument to the function.
开发者ID:bsaleil,项目名称:SFML-Website,代码行数:31,代码来源:graphics-view.php
注:本文中的h2函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论