# ลูปเกมสไตล์ raylib ใน TypeScript

เรียกฟังก์ชันวาดระหว่าง beginDrawing กับ endDrawing โดยใช้สี รูปทรง และอินพุตผ่าน TypeScript

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();
```

## สถานะปัจจุบัน

Bloom มีตัวเรนเดอร์และ API ของตัวเอง เมื่อต้องพอร์ตโครงสร้างหรือฟังก์ชัน C ให้ตรวจสอบชนิดข้อมูลและพารามิเตอร์ของ Bloom ทีละตัว

## คำถามที่พบบ่อย

### ใช้ปลั๊กอิน C ของ raylib ได้โดยตรงไหม

Bloom ไม่ได้ลิงก์ raylib โค้ดที่ใช้แฮนเดิลเนทีฟของ raylib ต้องเชื่อมต่อแยก

[ย้ายเกมที่ใช้ raylib ไปเป็น TypeScript](https://bloomengine.dev/th/alternatives/raylib-typescript)

## แหล่งข้อมูล

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