import { _ as _export_sfc, c as createElementBlock, o as openBlock, a8 as createStaticVNode } from "./chunks/framework.DyMmIvSC.js"; const __pageData = JSON.parse('{"title":"Digitizer","description":"","frontmatter":{},"headers":[],"relativePath":"features/digitizer.md","filePath":"features/digitizer.md"}'); const _sfc_main = { name: "features/digitizer.md" }; const _hoisted_1 = /* @__PURE__ */ createStaticVNode('

Digitizer

Digitizers allow the mouse cursor to be placed at absolute coordinates, unlike the Pointing Device feature which applies relative displacements.

This feature implements a stylus device with a tip switch and barrel switch (generally equivalent to the primary and secondary mouse buttons respectively). Tip pressure is not currently implemented.

Usage

Add the following to your rules.mk:

make
DIGITIZER_ENABLE = yes

Positioning

The X and Y coordinates are normalized, meaning their value must be set between 0 and 1. For the X component, the value 0 is the leftmost position, whereas the value 1 is the rightmost position. Similarly for the Y component, 0 is at the top and 1 at the bottom.

TIP

Since there is no display attached, the OS will likely map these coordinates to the virtual desktop. This may be important to know if you have multiple monitors.

Examples

This example simply places the cursor in the middle of the screen:

c
digitizer_in_range_on();\ndigitizer_set_position(0.5, 0.5);

The "in range" indicator is required to be on for the change in coordinates to be taken. It can then be turned off again to signal the end of the digitizer interaction, but it is not strictly required.

You can also modify the digitizer state directly, if you need to change multiple fields in a single report:

c
digitizer_state.in_range = true;\ndigitizer_state.dirty = true;\ndigitizer_flush();

digitizer_state is a struct of type digitizer_t.

API

struct digitizer_t

Contains the state of the digitizer.

Members


void digitizer_flush(void)

Send the digitizer report to the host if it is marked as dirty.


void digitizer_in_range_on(void)

Assert the "in range" indicator, and flush the report.


void digitizer_in_range_off(void)

Deassert the "in range" indicator, and flush the report.


void digitizer_tip_switch_on(void)

Assert the tip switch, and flush the report.


void digitizer_tip_switch_off(void)

Deassert the tip switch, and flush the report.


void digitizer_barrel_switch_on(void)

Assert the barrel switch, and flush the report.


void digitizer_barrel_switch_off(void)

Deassert the barrel switch, and flush the report.


void digitizer_set_position(float x, float y)

Set the absolute X and Y position of the digitizer contact, and flush the report.

Arguments

', 47); const _hoisted_48 = [ _hoisted_1 ]; function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("div", null, _hoisted_48); } const digitizer = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]); export { __pageData, digitizer as default };