# Graphical Window Sprites

## version 1 by Erik Temple

**Section 7.1 - Debugging Graphlinks (for use with Graphic Links by Jeff Sheets)**

Debugging graphlinks is an action out of world. Understand "graphlinks" as debugging graphlinks.

Check debugging graphlinks:

say "[line break][bold type]Table of Graphlink Glulx Replacement Commands[roman type] (presented in reverse order)[line break]";

repeat through the Table of Graphlink Glulx Replacement Commands in reverse order:

say "[linkid entry]: ([p-top entry],[p-bottom entry]) - ([p-left entry],[p-right entry]): [replacement entry][line break]".

Showing clicked coordinates is an action out of world. Understand "coordinates" as showing clicked coordinates. Coordinate-trace is a truth state that varies. Coordinate-trace is false.

Check showing clicked coordinates:

If coordinate-trace is false:

now coordinate-trace is true;

otherwise:

now coordinate-trace is false;

say "Coordinate reporting now [if coordinate-trace is true]on[otherwise]off[end if].[line break]".

A clicking graphlink rule (this is the report coordinates rule):

if coordinate-trace is true:

let graph-x be current graphlink x as a fixed point number;

let graph-y be current graphlink y as a fixed point number;

say "Screen coordinates of mouse input: ([current graphlink x],[current graphlink y])[line break]Approximate background grid coordinates: ([(graph-x real minus window x-offset) real divided by the window-scaling factor as an integer],[(graph-y real minus window y-offset) real divided by the window-scaling factor as an integer])[line break]";

follow the default command replacement by graphlinks rule.

The report coordinates rule is listed before the default command replacement by graphlinks rule in the clicking graphlink rules.