I have a bunch of objects with the following properties:
xPos = x coordinate of position in world
yPos = y coordinate of position in world
size = size of object
I have a function that draws these objects onto the screen. The screen has an x offset and y offset so the user can pan and the objects will move on and off screen as needed. This is all working perfectly. Now I would like to add in the ability to zoom in and out but I can't figure out how to apply zoom to the positions.
render(int xOff, int yOff, int zoom){
int x = xPos + xOff;
int y = yPos + yOff;
s->addRenderJob(texID, x, y, size * zoom, size * zoom);
}
Zooming the size of the object is simple but how can I modify the x and y positions by zoom so that the distance between the objects is also multiplied by zoom?