I need to come up with a formula to convert variable zoomed-in game space co-ords to UI co-ords. The engine I'm using is not traditional so there's no inbuilt function (convertToUISpace etc).
Now I have a feeling this is extremely easy, but I cannot get my brain to work the math...
It's a top down 2D game with 2 layers, game and UI. The screen is 640x360 res, but there is a zoom overlay on the game layer that can take it anywhere up to 400x225. The HUD layer remains the 640x360 res throughout though.
So I need to translate x,y positions on the game layer (at whatever zoom) to correctly position on the HUD. At the moment if I use exact co-ords they don't quite match up, unless the object is exactly in the screen centre.
Could anyone assist or clue me down the right path? I'm guessing I have to work out from the screen centre using the zoom ratio.