rayjs/examples/js_example.js

21 lines
534 B
JavaScript
Raw Normal View History

2023-05-14 20:19:47 +00:00
import { Timers } from "./examples/common/timers.js"
const timers = new Timers()
2023-05-15 15:44:28 +00:00
console.log(clamp(-1.5,0,5))
console.log(vector2Distance(new Vector2(0,0), new Vector2(1,0)))
2023-05-14 20:19:47 +00:00
initWindow(640, 480, "Javascript Tests")
const pos = new Vector2(getScreenWidth()/2,getScreenHeight()/2)
const radius = 100
timers.setTimeout(() => pos.x += 200, 2000)
while(!windowShouldClose()){
timers.update(getFrameTime())
beginDrawing()
clearBackground(RAYWHITE)
drawCircle(pos.x,pos.y, radius, LIME)
endDrawing()
}
closeWindow()