mirror of
https://github.com/SFML/SFML.git
synced 2024-11-28 14:21:04 +08:00
Limit the scope of event object
This commit is contained in:
parent
745bcb82ef
commit
dbac180db5
3
.github/ISSUE_TEMPLATE.md
vendored
3
.github/ISSUE_TEMPLATE.md
vendored
@ -32,8 +32,7 @@ int main()
|
|||||||
|
|
||||||
while (window.isOpen())
|
while (window.isOpen())
|
||||||
{
|
{
|
||||||
sf::Event event;
|
for (sf::Event event; window.pollEvent(event);)
|
||||||
while (window.pollEvent(event))
|
|
||||||
{
|
{
|
||||||
if (event.type == sf::Event::Closed)
|
if (event.type == sf::Event::Closed)
|
||||||
window.close();
|
window.close();
|
||||||
|
3
.github/PULL_REQUEST_TEMPLATE.md
vendored
3
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -37,8 +37,7 @@ int main()
|
|||||||
|
|
||||||
while (window.isOpen())
|
while (window.isOpen())
|
||||||
{
|
{
|
||||||
sf::Event event;
|
for (sf::Event event; window.pollEvent(event);)
|
||||||
while (window.pollEvent(event))
|
|
||||||
{
|
{
|
||||||
if (event.type == sf::Event::Closed)
|
if (event.type == sf::Event::Closed)
|
||||||
window.close();
|
window.close();
|
||||||
|
@ -44,8 +44,7 @@
|
|||||||
/// while (window.isOpen())
|
/// while (window.isOpen())
|
||||||
/// {
|
/// {
|
||||||
/// // Process events
|
/// // Process events
|
||||||
/// sf::Event event;
|
/// for (sf::Event event; window.pollEvent(event);)
|
||||||
/// while (window.pollEvent(event))
|
|
||||||
/// {
|
/// {
|
||||||
/// // Close window: exit
|
/// // Close window: exit
|
||||||
/// if (event.type == sf::Event::Closed)
|
/// if (event.type == sf::Event::Closed)
|
||||||
|
@ -109,9 +109,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
while (window.isOpen())
|
while (window.isOpen())
|
||||||
{
|
{
|
||||||
sf::Event event;
|
for (sf::Event event; active ? window.pollEvent(event) : window.waitEvent(event);)
|
||||||
|
|
||||||
while (active ? window.pollEvent(event) : window.waitEvent(event))
|
|
||||||
{
|
{
|
||||||
switch (event.type)
|
switch (event.type)
|
||||||
{
|
{
|
||||||
|
@ -183,8 +183,7 @@ int main()
|
|||||||
while (window.isOpen())
|
while (window.isOpen())
|
||||||
{
|
{
|
||||||
// Handle events
|
// Handle events
|
||||||
sf::Event event;
|
for (sf::Event event; window.pollEvent(event);)
|
||||||
while (window.pollEvent(event))
|
|
||||||
{
|
{
|
||||||
// Window closed or escape key pressed: exit
|
// Window closed or escape key pressed: exit
|
||||||
if ((event.type == sf::Event::Closed) ||
|
if ((event.type == sf::Event::Closed) ||
|
||||||
|
@ -165,8 +165,7 @@ int main()
|
|||||||
while (window.isOpen())
|
while (window.isOpen())
|
||||||
{
|
{
|
||||||
// Handle events
|
// Handle events
|
||||||
sf::Event event;
|
for (sf::Event event; window.pollEvent(event);)
|
||||||
while (window.pollEvent(event))
|
|
||||||
{
|
{
|
||||||
// Window closed or escape key pressed: exit
|
// Window closed or escape key pressed: exit
|
||||||
if ((event.type == sf::Event::Closed) ||
|
if ((event.type == sf::Event::Closed) ||
|
||||||
|
@ -197,8 +197,7 @@ int main()
|
|||||||
while (window.isOpen())
|
while (window.isOpen())
|
||||||
{
|
{
|
||||||
// Process events
|
// Process events
|
||||||
sf::Event event;
|
for (sf::Event event; window.pollEvent(event);)
|
||||||
while (window.pollEvent(event))
|
|
||||||
{
|
{
|
||||||
// Close window: exit
|
// Close window: exit
|
||||||
if (event.type == sf::Event::Closed)
|
if (event.type == sf::Event::Closed)
|
||||||
|
@ -406,8 +406,7 @@ int main()
|
|||||||
while (window.isOpen())
|
while (window.isOpen())
|
||||||
{
|
{
|
||||||
// Process events
|
// Process events
|
||||||
sf::Event event;
|
for (sf::Event event; window.pollEvent(event);)
|
||||||
while (window.pollEvent(event))
|
|
||||||
{
|
{
|
||||||
// Close window: exit
|
// Close window: exit
|
||||||
if (event.type == sf::Event::Closed)
|
if (event.type == sf::Event::Closed)
|
||||||
|
@ -111,8 +111,7 @@ int main()
|
|||||||
while (window.isOpen())
|
while (window.isOpen())
|
||||||
{
|
{
|
||||||
// Handle events
|
// Handle events
|
||||||
sf::Event event;
|
for (sf::Event event; window.pollEvent(event);)
|
||||||
while (window.pollEvent(event))
|
|
||||||
{
|
{
|
||||||
// Window closed or escape key pressed: exit
|
// Window closed or escape key pressed: exit
|
||||||
if ((event.type == sf::Event::Closed) ||
|
if ((event.type == sf::Event::Closed) ||
|
||||||
|
@ -2463,8 +2463,7 @@ public:
|
|||||||
while (window.isOpen())
|
while (window.isOpen())
|
||||||
{
|
{
|
||||||
// Process events
|
// Process events
|
||||||
sf::Event event;
|
for (sf::Event event; window.pollEvent(event);)
|
||||||
while (window.pollEvent(event))
|
|
||||||
{
|
{
|
||||||
// Close window: exit
|
// Close window: exit
|
||||||
if (event.type == sf::Event::Closed)
|
if (event.type == sf::Event::Closed)
|
||||||
|
@ -136,8 +136,7 @@ int main()
|
|||||||
while (window.isOpen())
|
while (window.isOpen())
|
||||||
{
|
{
|
||||||
// Process events
|
// Process events
|
||||||
sf::Event event;
|
for (sf::Event event; window.pollEvent(event);)
|
||||||
while (window.pollEvent(event))
|
|
||||||
{
|
{
|
||||||
// Close window: exit
|
// Close window: exit
|
||||||
if (event.type == sf::Event::Closed)
|
if (event.type == sf::Event::Closed)
|
||||||
|
@ -203,8 +203,7 @@ private:
|
|||||||
/// while (window.isOpen())
|
/// while (window.isOpen())
|
||||||
/// {
|
/// {
|
||||||
/// // Event processing
|
/// // Event processing
|
||||||
/// sf::Event event;
|
/// for (sf::Event event; window.pollEvent(event);)
|
||||||
/// while (window.pollEvent(event))
|
|
||||||
/// {
|
/// {
|
||||||
/// // Request for closing the window
|
/// // Request for closing the window
|
||||||
/// if (event.type == sf::Event::Closed)
|
/// if (event.type == sf::Event::Closed)
|
||||||
|
@ -97,8 +97,7 @@ public:
|
|||||||
/// sf::String string = sf::Clipboard::getString();
|
/// sf::String string = sf::Clipboard::getString();
|
||||||
///
|
///
|
||||||
/// // or use it in the event loop
|
/// // or use it in the event loop
|
||||||
/// sf::Event event;
|
/// for (sf::Event event; window.pollEvent(event);)
|
||||||
/// while(window.pollEvent(event))
|
|
||||||
/// {
|
/// {
|
||||||
/// if(event.type == sf::Event::Closed)
|
/// if(event.type == sf::Event::Closed)
|
||||||
/// window.close();
|
/// window.close();
|
||||||
|
@ -246,8 +246,7 @@ public:
|
|||||||
///
|
///
|
||||||
/// Usage example:
|
/// Usage example:
|
||||||
/// \code
|
/// \code
|
||||||
/// sf::Event event;
|
/// for (sf::Event event; window.pollEvent(event);)
|
||||||
/// while (window.pollEvent(event))
|
|
||||||
/// {
|
/// {
|
||||||
/// // Request for closing the window
|
/// // Request for closing the window
|
||||||
/// if (event.type == sf::Event::Closed)
|
/// if (event.type == sf::Event::Closed)
|
||||||
|
@ -336,8 +336,7 @@ private:
|
|||||||
/// while (window.isOpen())
|
/// while (window.isOpen())
|
||||||
/// {
|
/// {
|
||||||
/// // Event processing
|
/// // Event processing
|
||||||
/// sf::Event event;
|
/// for (sf::Event event; window.pollEvent(event);)
|
||||||
/// while (window.pollEvent(event))
|
|
||||||
/// {
|
/// {
|
||||||
/// // Request for closing the window
|
/// // Request for closing the window
|
||||||
/// if (event.type == sf::Event::Closed)
|
/// if (event.type == sf::Event::Closed)
|
||||||
|
@ -165,8 +165,7 @@ public:
|
|||||||
/// thus you should always call this function in a loop
|
/// thus you should always call this function in a loop
|
||||||
/// to make sure that you process every pending event.
|
/// to make sure that you process every pending event.
|
||||||
/// \code
|
/// \code
|
||||||
/// sf::Event event;
|
/// for (sf::Event event; window.pollEvent(event);)
|
||||||
/// while (window.pollEvent(event))
|
|
||||||
/// {
|
/// {
|
||||||
/// // process event...
|
/// // process event...
|
||||||
/// }
|
/// }
|
||||||
@ -514,8 +513,7 @@ private:
|
|||||||
/// while (window.isOpen())
|
/// while (window.isOpen())
|
||||||
/// {
|
/// {
|
||||||
/// // Event processing
|
/// // Event processing
|
||||||
/// sf::Event event;
|
/// for (sf::Event event; window.pollEvent(event);)
|
||||||
/// while (window.pollEvent(event))
|
|
||||||
/// {
|
/// {
|
||||||
/// // Request for closing the window
|
/// // Request for closing the window
|
||||||
/// if (event.type == sf::Event::Closed)
|
/// if (event.type == sf::Event::Closed)
|
||||||
|
@ -60,8 +60,7 @@ int main(int, char const**)
|
|||||||
while (window.isOpen())
|
while (window.isOpen())
|
||||||
{
|
{
|
||||||
// Process events
|
// Process events
|
||||||
sf::Event event;
|
for (sf::Event event; window.pollEvent(event);)
|
||||||
while (window.pollEvent(event))
|
|
||||||
{
|
{
|
||||||
// Close window: exit
|
// Close window: exit
|
||||||
if (event.type == sf::Event::Closed) {
|
if (event.type == sf::Event::Closed) {
|
||||||
|
@ -58,8 +58,7 @@ int main(int argc, char const** argv)
|
|||||||
while (window.isOpen())
|
while (window.isOpen())
|
||||||
{
|
{
|
||||||
// Process events
|
// Process events
|
||||||
sf::Event event;
|
for (sf::Event event; window.pollEvent(event);)
|
||||||
while (window.pollEvent(event))
|
|
||||||
{
|
{
|
||||||
// Close window: exit
|
// Close window: exit
|
||||||
if (event.type == sf::Event::Closed) {
|
if (event.type == sf::Event::Closed) {
|
||||||
|
Loading…
Reference in New Issue
Block a user