mirror of
https://github.com/afska/gba-link-connection.git
synced 2026-04-24 07:27:32 -05:00
Revising sync() documentation, again
This commit is contained in:
parent
afb05da665
commit
f672bd7c3e
|
|
@ -119,7 +119,7 @@ You can also change these compile-time constants:
|
|||
| `isConnected()` | **bool** | Returns `true` if there are at least 2 connected players. |
|
||||
| `playerCount()` | **u8** _(0~4)_ | Returns the number of connected players. |
|
||||
| `currentPlayerId()` | **u8** _(0~3)_ | Returns the current player ID. |
|
||||
| `sync()` | - | Call this method whenever you need to fetch new data. It does not **wait** for new messages; instead, it collects and queues any available messages from the interrupt world for later processing with the `read(...)` method. |
|
||||
| `sync()` | - | Collects available messages from interrupts for later processing with `read(...)`. Call this method whenever you need to fetch new data. |
|
||||
| `waitFor(playerId)` | **bool** | Waits for data from player #`playerId`. Returns `true` on success, or `false` on disconnection. |
|
||||
| `waitFor(playerId, cancel)` | **bool** | Like `waitFor(playerId)` but accepts a `cancel()` function. The library will continuously invoke it, and abort the wait if it returns `true`. |
|
||||
| `canRead(playerId)` | **bool** | Returns `true` if there are pending messages from player #`playerId`. Keep in mind that if this returns `false`, it will keep doing so until you _fetch new data_ with `sync()`. |
|
||||
|
|
|
|||
|
|
@ -166,10 +166,8 @@ class LinkCable {
|
|||
[[nodiscard]] u8 currentPlayerId() { return state.currentPlayerId; }
|
||||
|
||||
/**
|
||||
* @brief Call this method whenever you need to fetch new data. It does not
|
||||
* **wait** for new messages; instead, it collects and queues any available
|
||||
* messages from the interrupt world for later processing with the `read(...)`
|
||||
* method.
|
||||
* @brief Collects available messages from interrupts for later processing
|
||||
* with `read(...)`. Call this method whenever you need to fetch new data.
|
||||
*/
|
||||
void sync() {
|
||||
if (!isEnabled)
|
||||
|
|
|
|||
|
|
@ -210,11 +210,10 @@ class LinkUniversal {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Call this method whenever you need to fetch new data, but at least
|
||||
* once per frame, as it also maintains the connection state. It does not
|
||||
* **wait** for new messages; instead, it collects and queues any available
|
||||
* messages from the interrupt world for later processing with the `read(...)`
|
||||
* method.
|
||||
* @brief Collects available messages from interrupts for later processing
|
||||
* with `read(...)`. Call this method whenever you need to fetch new data, and
|
||||
* at least once per frame, as it also manages connection state, auto-pairing,
|
||||
* and protocol switching.
|
||||
*/
|
||||
void sync() {
|
||||
if (!isEnabled)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user