# A raylib-style game loop in TypeScript

Call drawing functions directly between beginDrawing and endDrawing. Bloom exposes colors, shapes and input as TypeScript functions and values.

main.ts

```
import { initWindow, windowShouldClose, beginDrawing, endDrawing,
  clearBackground, closeWindow, Colors } from "@bloomengine/engine";
import { drawRect } from "@bloomengine/engine/shapes";

initWindow(640, 360, "Bloom");
while (!windowShouldClose()) {
  beginDrawing();
  clearBackground(Colors.SNOW);
  drawRect(48, 48, 96, 64, Colors.GREEN);
  endDrawing();
}
closeWindow();
```

## Where this stands today

Bloom implements its own renderer and API. Port C calls and data structures individually and check their Bloom signatures.

## Questions and answers

### Can I use a raylib C plug-in directly?

Bloom does not link raylib. Code that needs raylib’s native handles requires a separate integration.

[Move a raylib game to TypeScript](https://bloomengine.dev/alternatives/raylib-typescript)

## Sources

*   [Bloom API](https://github.com/Bloom-Engine/engine#how-bloom-relates-to-raylib)
*   [raylib](https://www.raylib.com/cheatsheet/cheatsheet.html)
