mirror of https://github.com/LIJI32/SameBoy.git
Updated GB_set_vblank_callback (markdown)
parent
b30a6db2de
commit
b8e7f3d9c2
|
@ -1,9 +1,5 @@
|
|||
## Definition
|
||||
|
||||
```c
|
||||
typedef void (*GB_vblank_callback_t)(GB_gameboy_t *gb, GB_vblank_type_t type);
|
||||
```
|
||||
|
||||
```c
|
||||
typedef enum {
|
||||
GB_VBLANK_TYPE_NORMAL_FRAME,
|
||||
|
@ -13,14 +9,27 @@ typedef enum {
|
|||
} GB_vblank_type_t;
|
||||
```
|
||||
|
||||
<tt>void GB_set_vblank_callback([[GB_gameboy_t]] *gb, [[GB_vblank_callback_t]] callback);</tt>
|
||||
```c
|
||||
typedef void (*GB_vblank_callback_t)(GB_gameboy_t *gb, GB_vblank_type_t type);
|
||||
```
|
||||
|
||||
<tt>void GB_set_vblank_callback([[GB_gameboy_t]] *gb, GB_vblank_callback_t callback);</tt>
|
||||
|
||||
In `display.h`
|
||||
|
||||
## Description
|
||||
|
||||
TBD
|
||||
Sets a callback that will be called when the emulator instance finishes rendering a frame into the set [[pixel buffer|GB_set_pixels_output]], usually when the LCD controller enters the VBlank stage. The callback will be called even if [[rendering is disabled|GB_set_rendering_disabled]]. The `type` argument for the callback specifies the kind of VBlank event being reported:
|
||||
|
||||
* `GB_VBLANK_TYPE_NORMAL_FRAME`: A normal frame has finished rendering, the pixel buffer will contain the new frame's data.
|
||||
* `GB_VBLANK_TYPE_LCD_OFF`: The LCD has been off for a period of time long enough that requires presenting it to the user, the pixel buffer will contain a solid color.
|
||||
* `GB_VBLANK_TYPE_ARTIFICIAL`: The LCD is turned on, but the ROM is preventing the PPU (Pixel Processing Unit) from rendering a complete frame. The pixel buffer will contain a partially rendered frame that may be presented to the user.
|
||||
* `GB_VBLANK_TYPE_REPEAT`: The PPU has finished rendering a frame, but the LCD on a real Game Boy hardware would not display it. The pixels buffer will contain the new frame's data, but an accurate frontend should repeat the previous frame instead of displaying it.
|
||||
|
||||
## Thread Safety
|
||||
|
||||
If `callback` is not NULL, `GB_set_vblank_callback` is thread-safe and can be called from any thread and context. Otherwise, it must not be called if the instance is being run in another thread, but may be called from the current one (via a callback).
|
||||
|
||||
## See Also
|
||||
|
||||
* [[GB_set_pixels_output]]
|
||||
|
|
Loading…
Reference in New Issue