libtcod
Loading...
Searching...
No Matches
TCOD_MouseTransform Struct Reference

Info needed to convert between mouse pixel and tile coordinates. More...

#include <mouse_types.h>

Public Attributes

double offset_x
double offset_y
double scale_x
double scale_y

Detailed Description

Info needed to convert between mouse pixel and tile coordinates.

Internal use only.

double pixel_x, pixel_y, tile_x, tile_y;
// 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;
Info needed to convert between mouse pixel and tile coordinates.
Definition mouse_types.h:117
embed:rst:leading-asterisk
 .. versionadded:: 1.24

The documentation for this struct was generated from the following file: