-
Notifications
You must be signed in to change notification settings - Fork 2
raylib.GetWorldToScreen2D
JoeStrout edited this page Apr 29, 2026
·
2 revisions
Get the screen space position for a 2d camera world space position
| Parameter | Default Value | Note |
|---|---|---|
| position | ||
| camera |
| Condition | Return Value |
|---|---|
| (always) | map |
raylib.InitWindow 800, 600, "World To Screen 2D Demo"
cam = {offset:[0,0], target:[0,0], rotation:0, zoom:1}
while not raylib.WindowShouldClose
raylib.BeginDrawing
raylib.ClearBackground color.white
raylib.BeginMode2D cam
raylib.DrawCircle 100, 100, 20, color.blue
raylib.EndMode2D
screenPos = raylib.GetWorldToScreen2D([100,100], cam)
raylib.DrawText "Screen: " + screenPos[0] + "," + screenPos[1], 10, 10, 20, color.black
raylib.EndDrawing
end while
raylib.CloseWindow