rayjs/bindings/src/index.ts

23 lines
947 B
TypeScript
Raw Normal View History

2023-05-06 21:43:40 +00:00
import { readFileSync, writeFileSync } from "fs";
import { Bindings, RayLibApi } from "./interfaces";
import { ApiDescription } from "./api";
2023-05-08 14:43:50 +00:00
import { RayLibHeader } from "./raylib-header";
2023-05-06 21:43:40 +00:00
function main(){
const api = <RayLibApi>JSON.parse(readFileSync("thirdparty/raylib/parser/output/raylib_api.json", 'utf8'))
const apiDesc = new ApiDescription(api)
2023-05-08 14:43:50 +00:00
const core_gen = new RayLibHeader("raylib_core", apiDesc)
2023-05-06 21:43:40 +00:00
core_gen.addApiFunctionByName("SetWindowTitle")
core_gen.addApiFunctionByName("SetWindowPosition")
core_gen.addApiFunctionByName("BeginDrawing")
core_gen.addApiFunctionByName("EndDrawing")
2023-05-08 14:43:50 +00:00
core_gen.writeTo("src/bindings/js_raylib_core.h")
2023-05-06 21:43:40 +00:00
2023-05-08 14:43:50 +00:00
const texture_gen = new RayLibHeader("raylib_texture", apiDesc)
2023-05-08 16:05:03 +00:00
texture_gen.addApiStructByName("Image", "UnloadImage", { properties: { width: { get: true } } })
2023-05-08 14:43:50 +00:00
texture_gen.writeTo("src/bindings/js_raylib_texture.h")
2023-05-06 21:43:40 +00:00
}
main()