Skip to content

Commit 5715efd

Browse files
Add more docs
1 parent 8309078 commit 5715efd

File tree

3 files changed

+58
-1
lines changed

3 files changed

+58
-1
lines changed

src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ Edition). The launcher supports Linux and OS X.
2424
- [JNI](./extra/advanced/jni/index.md)
2525
- [NDK Shims](./extra/advanced/ndk_shims/index.md)
2626
- [Modding Api](./extra/advanced/modding-api/index.md)
27+
- [Game Window Api](./extra/advanced/game-window-api/index.md)
2728
- [External Links](./external_links/index.md)
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Game Window API Reference
2+
3+
This API provides access to the primary game window and allows registration of various input and lifecycle callbacks.
4+
5+
---
6+
7+
## Core Window Access
8+
9+
| Symbol | Signature | Description |
10+
|--------|-----------|-------------|
11+
| `game_window_get_primary_window` | `GameWindowHandle*()` | Returns a pointer to the current primary game window |
12+
13+
| `game_window_is_mouse_locked` | `bool(GameWindowHandle* handle)` | Checks if the mouse is currently locked in the window |
14+
15+
| `game_window_get_input_mode` | `int(GameWindowHandle* handle)` | Retrieves the current input mode from the window callbacks |
16+
17+
---
18+
19+
## Input Callback Registration
20+
21+
These functions allow you to register input event handlers for keyboard and mouse interactions.
22+
23+
| Symbol | Signature | Description |
24+
|--------|-----------|-------------|
25+
| `game_window_add_keyboard_callback` | `void(GameWindowHandle* handle, void* user, bool (*callback)(void* user, int keyCode, int action))` | Registers a keyboard input callback |
26+
| `game_window_add_mouse_button_callback` | `void(GameWindowHandle* handle, void* user, bool (*callback)(void* user, double x, double y, int button, int action))` | Registers a mouse button input callback |
27+
| `game_window_add_mouse_position_callback` | `void(GameWindowHandle* handle, void* user, bool (*callback)(void* user, double x, double y, bool relative))` | Registers a mouse movement callback |
28+
| `game_window_add_mouse_scroll_callback` | `void(GameWindowHandle* handle, void* user, bool (*callback)(void* user, double x, double y, double dx, double dy))` | Registers a mouse scroll callback |
29+
30+
---
31+
32+
## Lifecycle & Rendering Callbacks
33+
34+
| Symbol | Signature | Description |
35+
|--------|-----------|-------------|
36+
| `game_window_add_window_creation_callback` | `void(void* user, void (*onCreated)(void* user))` | Registers a callback to be invoked when the window is created |
37+
| `game_window_add_swap_buffers_callback` | `void(void* user, void (*callback)(void* user, EGLDisplay display, EGLSurface surface))` | Registers a callback for when buffers are swapped during rendering |
38+
39+
---
40+
41+
## Library Integration
42+
43+
Use dlopen and dlsym to load the library and access the functions
44+
45+
```cpp
46+
dlopen("libmcpelauncher_gamewindow.so");
47+
```
48+
49+
---
50+
51+
## Data Types
52+
53+
### `GameWindowHandle`
54+
55+
An opaque structure representing the game window.

src/extra/advanced/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
- [Debugging NDK Libraries](./debugging_ndk_libraries/index.md)
44
- [JNI](./jni/index.md)
55
- [NDK Shims](./ndk_shims/index.md)
6-
- [Modding Api](./modding-api/)
6+
- [Modding Api](./modding-api/index.md)
7+
- [Game Window Api](./game-window-api/index.md)

0 commit comments

Comments
 (0)