If you're using Raylib instead of Ooga Booga, and want to get the world position from your cursor for example, this may be of use:
Vector2 screen_position_to_world_position(Vector2 screen_position, Camera2D camera) {
Vector2 world_position = (Vector2){
.x = (screen_position.x / camera.zoom) + camera.target.x - (camera.offset.x / camera.zoom),
.y = (screen_position.y / camera.zoom) + camera.target.y - (camera.offset.y / camera.zoom),
};
return world_position;
}
Edit:
As @Alperen Yilmaz pointed out, you could also use the function GetScreenToWorld2D that comes with Raylib.