Table of Contents

 
CellPosXY
 

Purpose

Calculates the coordinates of a certain cell in a given template of cells

 

Protoype

CVector CImageMngr::CellPosXY (int i_row, int i_col, string str_img_id, int i_cell_id)
 

Parameters

row the number of rows in the template
col the number of columns in the template
img_id the ID of the image to extract the location from
cell_id the ID of the cell to get the location of
 

Description

This function is used to find the actuall coordinate location of a cell in a template, information which is needed in order to blit a specific template cell onto a surface. You must pass in the number of rows and columns as well as the ID of the image template object. The ID is needed to find the image height and width to calculate the cell location, which is passed in for i_cell_id.

NOTE: All cells begin with 0!

 

Use

CImageMngr image;
// get the location of the 4th cell in a 4x4 template
CVector x_y = image.CellPosXY(4, 4, "my_image", 3);
// extract the individual x and y locations
int x = x_y.vx;
int y = x_y.vy;
 

Prev: CellPosRC