Struct TCOD_MouseTransform

Struct Documentation

struct TCOD_MouseTransform

Info needed to convert between mouse pixel and tile coordinates.

Internal use only.

double pixel_x, pixel_y, tile_x, tile_y;
TCOD_MouseTransform transform;
// Convert pixel coordinates to tile coordinates.
tile_x = (pixel_x - transform.offset_x) * transform.scale_x;
tile_y = (pixel_y - transform.offset_y) * transform.scale_y;
// Convert tile coordinates to pixel coordinates.
pixel_x = tile_x / transform.scale_x + transform.offset_x;
pixel_y = tile_y / transform.scale_y + transform.offset_y;

New in version 1.24.

Public Members

double offset_x
double offset_y
double scale_x
double scale_y