本文整理汇总了C++中PObject::isDestroyed方法的典型用法代码示例。如果您正苦于以下问题:C++ PObject::isDestroyed方法的具体用法?C++ PObject::isDestroyed怎么用?C++ PObject::isDestroyed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PObject
的用法示例。
在下文中一共展示了PObject::isDestroyed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleEvent
void Engine::handleEvent(sf::Event& event)
{
// Window closed: exit
if ((event.type == sf::Event::Closed))
running = false;
if (event.type == sf::Event::GainedFocus)
windowManager->windowHasFocus = true;
if (event.type == sf::Event::LostFocus)
windowManager->windowHasFocus = false;
#ifdef DEBUG
if ((event.type == sf::Event::KeyPressed) && (event.key.code == sf::Keyboard::L))
{
int n = 0;
printf("---------------------\n");
for(PObject* obj = DEBUG_PobjListStart; obj; obj = obj->DEBUG_PobjListNext)
printf("%c%4d: %4d: %s\n", obj->isDestroyed() ? '>' : ' ', n++, obj->getRefCount(), typeid(*obj).name());
printf("---------------------\n");
}
#endif
if (event.type == sf::Event::KeyPressed)
{
if (event.key.code != sf::Keyboard::Unknown)
InputHandler::keyboard_button_down[event.key.code] = true;
#ifdef DEBUG
else printf("Unknown key code pressed");
#endif
last_key_press = event.key.code;
}
if (event.type == sf::Event::KeyReleased) {
if (event.key.code != sf::Keyboard::Unknown)
InputHandler::keyboard_button_down[event.key.code] = false;
#ifdef DEBUG
else printf("Unknown key code released");
#endif
}
if (event.type == sf::Event::TextEntered && event.text.unicode > 31 && event.text.unicode < 128)
{
if (last_key_press != sf::Keyboard::Unknown)
{
InputHandler::fireKeyEvent(last_key_press, event.text.unicode);
last_key_press = sf::Keyboard::Unknown;
}
}
if (event.type == sf::Event::MouseWheelMoved)
InputHandler::mouse_wheel_delta += event.mouseWheel.delta;
if (event.type == sf::Event::MouseButtonPressed)
InputHandler::mouse_button_down[event.mouseButton.button] = true;
if (event.type == sf::Event::MouseButtonReleased)
InputHandler::mouse_button_down[event.mouseButton.button] = false;
if (event.type == sf::Event::Resized)
windowManager->setupView();
#ifdef __ANDROID__
//Focus lost and focus gained events are used when the application window is created and destroyed.
if (event.type == sf::Event::LostFocus)
running = false;
//The MouseEntered and MouseLeft events are received when the activity needs to pause or resume.
if (event.type == sf::Event::MouseLeft)
{
//Pause is when a small popup is on top of the window. So keep running.
while(windowManager->window.isOpen() && windowManager->window.waitEvent(event))
{
if (event.type != sf::Event::MouseLeft)
handleEvent(event);
if (event.type == sf::Event::MouseEntered)
break;
}
}
#endif//__ANDROID__
}