载入中...
搜索中...
未找到
eve::platform_event::sdl::Event类 参考final

Event public API. 更多...

#include <Event.h>

类 eve::platform_event::sdl::Event 继承关系图:
eve::platform_event::PlatformEvent eve::Module

Public 成员函数

 Event ()
 Constructs a Event.
 
virtual ~Event ()
 Releases Event resources.
 
void pump () override
 Pumps the event queue. This function gathers all the pending input information from devices and places it on the event queue. Normally not needed if you poll for events.
 
Message * wait () override
 Waits for the next event (indefinitely). Useful for creating games where the screen and game state only needs updating when the user interacts with the window. @ownership Ownership of the returned Message transfers to the caller. @lifetime Valid until caller deletion; independent of the native event. @thread Platform event thread only. @reentrancy Registered sinks run synchronously during conversion.
 
void clear () override
 Clears the event queue.
 
- Public 成员函数 继承自 eve::platform_event::PlatformEvent
 Module_REG (PlatformEvent)
 
virtual ~PlatformEvent ()
 Platform event.
 
void push (Message *msg)
 Queues a message. Thread-safe: workers may push completions for the main loop to poll.
 
void push (std::unique_ptr< Message > msg)
 Queues an owning message handle; ownership transfers to the queue.
 
void pushData (std::string name, std::string data="")
 Script helper: pushes an event with an optional string payload.
 
Message * poll ()
 Pops the oldest message, or nullptr if the queue is empty. @ownership Ownership transfers to the caller, which must delete the message. @lifetime Valid until caller deletion; independent of subsequent queue mutation. @thread Thread-safe queue operation; observer callbacks run after unlocking. @reentrancy Poll observers may re-enter the queue.
 
std::unique_ptr< Message > pollOwned ()
 Pops the oldest message into an RAII handle, or returns null.
 
std::string pollName ()
 Script helper: pops one message and returns its name, or "" if none.
 
std::string getLastData () const
 First string arg of the message most recently returned by pollName/pollData.
 
std::string pollData ()
 Pops one message and returns its first string arg (or ""). Name is discarded — use pollName when you need the type.
 
void setPollObserver (std::function< void(const Message &)> observer)
 Sets an observer invoked for every message consumed via poll*().
 
const std::function< void(const Message &)> & pollObserver () const
 Current poll observer, or empty if none.
 
eve::Subscription subscribePoll (std::function< void(const Message &)> callback)
 Subscribe to every message consumed by poll/pollOwned.
 
std::uint64_t pollObserverFailureCount () const noexcept
 Number of contained poll-listener exceptions since construction.
 
std::unique_ptr< Message > waitOwned ()
 Blocking wait returning an RAII handle.
 
- Public 成员函数 继承自 eve::Module
virtual ~Module ()
 Module.
 
virtual std::string getName () const =0
 Returns the name.
 

额外继承的成员函数

- Protected 属性 继承自 eve::platform_event::PlatformEvent
std::mutex queueMu_
 
std::queue< std::unique_ptr< Message > > queue
 
std::string lastData_
 
std::function< void(const Message &)> pollObserver_
 Void.
 
eve::Observer< Message > pollObservers_
 
eve::Subscription legacyPollSubscription_
 
std::uint64_t pollObserverFailures_ = 0
 

详细描述

Event public API.

在文件 Event.h 第 15 行定义.

构造及析构函数说明

◆ Event()

eve::platform_event::sdl::Event::Event ( )

Constructs a Event.

在文件 Event.cpp 第 29 行定义.

◆ ~Event()

eve::platform_event::sdl::Event::~Event ( )
virtual

Releases Event resources.

在文件 Event.cpp 第 39 行定义.

成员函数说明

◆ clear()

void eve::platform_event::sdl::Event::clear ( )
overridevirtual

Clears the event queue.

重载 eve::platform_event::PlatformEvent .

在文件 Event.cpp 第 78 行定义.

引用了 eve::platform_event::PlatformEvent::clear().

◆ pump()

void eve::platform_event::sdl::Event::pump ( )
overridevirtual

Pumps the event queue. This function gathers all the pending input information from devices and places it on the event queue. Normally not needed if you poll for events.

实现了 eve::platform_event::PlatformEvent.

在文件 Event.cpp 第 41 行定义.

引用了 EV_PROFILE_MODULE, eve::platform_event::IPlatformEventSink::onPumpFinished() , 以及 eve::platform_event::PlatformEvent::push().

◆ wait()

Message * eve::platform_event::sdl::Event::wait ( )
overridevirtual

Waits for the next event (indefinitely). Useful for creating games where the screen and game state only needs updating when the user interacts with the window. @ownership Ownership of the returned Message transfers to the caller. @lifetime Valid until caller deletion; independent of the native event. @thread Platform event thread only. @reentrancy Registered sinks run synchronously during conversion.

实现了 eve::platform_event::PlatformEvent.

在文件 Event.cpp 第 56 行定义.

引用了 message, eve::platform_event::PlatformEvent::poll() , 以及 queued.


该类的文档由以下文件生成:
  • src/modules/platform_event/sdl/Event.h
  • src/modules/platform_event/sdl/Event.cpp