Skip to content

knob: expose zero_direction and dead_zone_degrees accessors #280

Description

@RobLoach

Problem

nk_console_knob_data (nuklear_console_knob.h:11-12) has two customization fields:

typedef struct nk_console_knob_data {
    nk_console_property_data property; /* Inherited from property */
    enum nk_heading zero_direction;
    float dead_zone_degrees;
} nk_console_knob_data;

They are hardcoded to NK_DOWN / 60.0f at creation and consumed by the render path in nuklear_console_property.h:209,213, but there is no public API to read or change them — grep shows only internal use. This is inconsistent with sibling widgets that expose accessors for their data fields (button: nk_console_button_get/set_symbol, nk_console_button_get/set_image; image: nk_console_image_get/set_color).

Suggested Implementation

Add to nuklear_console_knob.h, following the button/image accessor pattern (NULL-safe, Doxygen-commented):

NK_API enum nk_heading nk_console_knob_get_zero_direction(nk_console* knob);
NK_API void nk_console_knob_set_zero_direction(nk_console* knob, enum nk_heading zero_direction);
NK_API float nk_console_knob_get_dead_zone_degrees(nk_console* knob);
NK_API void nk_console_knob_set_dead_zone_degrees(nk_console* knob, float dead_zone_degrees);

Guard against NULL widget/data and wrong widget type, as the existing accessors do.

QA

Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions