libtcod
Loading...
Searching...
No Matches
mouse_types.h File Reference

Mouse state provided by the libtcod event system. More...

#include "portability.h"

Go to the source code of this file.

Classes

struct  TCOD_mouse_t
 Mouse state provided by the libtcod event system. More...
struct  TCOD_MouseTransform
 Info needed to convert between mouse pixel and tile coordinates. More...

Typedefs

typedef struct TCOD_mouse_t TCOD_mouse_t
 Mouse state provided by the libtcod event system.
typedef struct TCOD_MouseTransform TCOD_MouseTransform
 Info needed to convert between mouse pixel and tile coordinates.

Detailed Description

Mouse state provided by the libtcod event system.

Typedef Documentation

◆ TCOD_mouse_t

typedef struct TCOD_mouse_t TCOD_mouse_t

Mouse state provided by the libtcod event system.

This may be a moved, pressed, or released event.

Deprecated
The libtcod mouse state has several known issues such as missing or broken functionality. In its current state it exists only for backwards compatibility. These issues should be resolved by using SDL directly for mouse and keyboard events.

◆ TCOD_MouseTransform

typedef struct TCOD_MouseTransform TCOD_MouseTransform

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