# fluid_core API Notes
This file provides a quick API map for crates.io users.
## Core Types
- `FluidEngine`: engine lifecycle and rendering
- `FluidConfig`: all runtime parameters (physics + post-processing)
- `InputManager`: pointer and programmatic splat input
- `RenderContext`: immutable GPU context snapshot for UI upload steps
## Engine Lifecycle
```rust
pub async fn new<W>(
window: W,
width: u32,
height: u32,
config: &FluidConfig,
) -> FluidEngine<'_>
where
W: raw_window_handle::HasWindowHandle
+ raw_window_handle::HasDisplayHandle
+ Send
+ Sync
```
Typical frame loop:
1. Feed input into `engine.input.*`
2. Call `engine.update(dt)`
3. Call `engine.render()` or `engine.render_with_ui_split(...)`
## Input API
- `pointer_down(id, x, y, color)`
- `pointer_move(id, x, y)`
- `pointer_up(id)`
- `inject(x, y, dx, dy, color)`
- `burst(count)`
Coordinates use normalized range `[0, 1]`.
## Config API
- `config() -> &FluidConfig`
- `config_mut() -> &mut FluidConfig`
- `set_config(config)`
Important: if resolution-related fields are changed, use `set_config(...)` so GPU textures are rebuilt.
## Rendering API
- `render() -> Result<(), wgpu::SurfaceError>`
- `render_with_ui(...)`
- `render_with_ui_split(...)`
- `resize(width, height)`
## Helper Query API
- `size()`
- `device()`
- `queue()`
- `surface_format()`
- `render_context()`
## Default Reset
`reset_to_js_defaults()` restores parameter values aligned with the original WebGL defaults.
## Full Documentation
For the complete API guide used in this repository, see the top-level `api.md` in the source repository.