VgaGames 3 - Miscellaneous man-pages

[.. upper level ..]


Positioning the window on a larger background-image: Initialization
void VG3_init_windowpos_on_bgimage(struct vg3_windowpos_bgimage *wbpos, int bg_w, int bg_h, int win_w, int win_h, int move_pixel, int border_percent)

wbpos Window-positioning structure
bg_w Width of the background-image in pixels
bg_h Height of the background-image in pixels
win_w Width of window in pixels
win_h Height of window in pixels
move_pixel Number of pixels the window moves on the background-image, when centering the selected object
border_percent Centered rectangle within the window, in which the selected object may move without moving the window, in percent (e.g.: 100 = whole window, 50 = half the width and height of the window)

If the game field, presented by a background-image, is larger than the window, only a section shall be shown, which moves according to the position of the player-object on the background-image. This section is generally the window. With this function the window-positioning structure will be initialized. The border_percent represents a centered section in the window, specified in percent, in which the player-object can move while the window remains not moving on the background-image.