Regenerate docs and stubs after API freeze pass

Picks up the five 1.0 freeze commits (groups A-D + Grid follow-up):
  * mcrfpy.Animation removed from module exports
  * parent= kwarg on Frame/Caption/Sprite/Line/Circle/Arc/Grid
  * grid= kwarg on ColorLayer/TileLayer
  * Constructor positional reorders (Circle, Caption, Layers)
  * __getitem__/__setitem__ on ColorLayer/TileLayer/Grid

PyMethodDef/PyGetSetDef compliance baseline (per tools/audit_pymethoddef.py):
  PyGetSetDef: 190/410 MACRO (46.3%)
  PyMethodDef: 150/345 MACRO (43.5%)
413 raw-string docstring entries remain to migrate to MCRF_METHOD/
MCRF_PROPERTY in a separate sweep.
This commit is contained in:
John McCardle 2026-04-18 13:35:26 -04:00
commit 98d2b36739
4 changed files with 366 additions and 408 deletions

View file

@ -1,6 +1,6 @@
# McRogueFace API Reference
*Generated on 2026-04-18 07:28:57*
*Generated on 2026-04-18 13:35:02*
*This documentation was dynamically generated from the compiled module.*
@ -10,7 +10,6 @@
- [Classes](#classes)
- [AStarPath](#astarpath)
- [Alignment](#alignment)
- [Animation](#animation)
- [Arc](#arc)
- [AutoRuleSet](#autoruleset)
- [BSP](#bsp)
@ -35,6 +34,7 @@
- [Grid](#grid)
- [GridView](#gridview)
- [HeightMap](#heightmap)
- [Heuristic](#heuristic)
- [InputState](#inputstate)
- [Key](#key)
- [Keyboard](#keyboard)
@ -356,122 +356,6 @@ Return an array of bytes representing an integer.
If signed is False and a negative integer is given, an OverflowError
is raised.
### Animation
Animation(property: str, target: Any, duration: float, easing: str = 'linear', delta: bool = False, loop: bool = False, callback: Callable = None)
Create an animation that interpolates a property value over time.
Args:
property: Property name to animate. Valid properties depend on target type:
- Position/Size: 'x', 'y', 'w', 'h', 'pos', 'size'
- Appearance: 'fill_color', 'outline_color', 'outline', 'opacity'
- Sprite: 'sprite_index', 'scale'
- Grid: 'center', 'zoom'
- Caption: 'text'
- Sub-properties: 'fill_color.r', 'fill_color.g', 'fill_color.b', 'fill_color.a'
target: Target value for the animation. Type depends on property:
- float: For numeric properties (x, y, w, h, scale, opacity, zoom)
- int: For integer properties (sprite_index)
- tuple (r, g, b[, a]): For color properties
- tuple (x, y): For vector properties (pos, size, center)
- list[int]: For sprite animation sequences
- str: For text animation
duration: Animation duration in seconds.
easing: Easing function name. Options:
- 'linear' (default)
- 'easeIn', 'easeOut', 'easeInOut'
- 'easeInQuad', 'easeOutQuad', 'easeInOutQuad'
- 'easeInCubic', 'easeOutCubic', 'easeInOutCubic'
- 'easeInQuart', 'easeOutQuart', 'easeInOutQuart'
- 'easeInSine', 'easeOutSine', 'easeInOutSine'
- 'easeInExpo', 'easeOutExpo', 'easeInOutExpo'
- 'easeInCirc', 'easeOutCirc', 'easeInOutCirc'
- 'easeInElastic', 'easeOutElastic', 'easeInOutElastic'
- 'easeInBack', 'easeOutBack', 'easeInOutBack'
- 'easeInBounce', 'easeOutBounce', 'easeInOutBounce'
delta: If True, target is relative to start value (additive). Default False.
loop: If True, animation repeats from start when it reaches the end. Default False.
callback: Function(target, property, value) called when animation completes.
Not called for looping animations (since they never complete).
Example:
# Move a frame from current position to x=500 over 2 seconds
anim = mcrfpy.Animation('x', 500.0, 2.0, 'easeInOut')
anim.start(my_frame)
# Looping sprite animation
walk = mcrfpy.Animation('sprite_index', [0,1,2,3,2,1], 0.6, loop=True)
walk.start(my_sprite)
**Properties:**
- `duration` *(read-only)*: Animation duration in seconds (float, read-only). Total time for the animation to complete.
- `elapsed` *(read-only)*: Elapsed time in seconds (float, read-only). Time since the animation started.
- `is_complete` *(read-only)*: Whether animation is complete (bool, read-only). True when elapsed >= duration or complete() was called.
- `is_delta` *(read-only)*: Whether animation uses delta mode (bool, read-only). In delta mode, the target value is added to the starting value.
- `is_looping` *(read-only)*: Whether animation loops (bool, read-only). Looping animations repeat from the start when they reach the end.
- `property` *(read-only)*: Target property name (str, read-only). The property being animated (e.g., 'pos', 'opacity', 'sprite_index').
**Methods:**
#### `complete() -> None`
Complete the animation immediately by jumping to the final value.
Note:
**Returns:** None Sets elapsed = duration and applies target value immediately. Completion callback will be called if set.
#### `get_current_value() -> Any`
Get the current interpolated value of the animation.
Note:
**Returns:** Any: Current value (type depends on property: float, int, Color tuple, Vector tuple, or str) Return type matches the target property type. For sprite_index returns int, for pos returns (x, y), for fill_color returns (r, g, b, a).
#### `hasValidTarget() -> bool`
Check if the animation still has a valid target.
Note:
**Returns:** bool: True if the target still exists, False if it was destroyed Animations automatically clean up when targets are destroyed. Use this to check if manual cleanup is needed.
#### `start(target: UIDrawable, conflict_mode: str = 'replace') -> None`
Start the animation on a target UI element.
Note:
**Arguments:**
- `target`: The UI element to animate (Frame, Caption, Sprite, Grid, or Entity)
- `conflict_mode`: How to handle conflicts if property is already animating: 'replace' (default) - complete existing animation and start new one; 'queue' - wait for existing animation to complete; 'error' - raise RuntimeError if property is busy
**Returns:** None
**Raises:** RuntimeError: When conflict_mode='error' and property is already animating The animation will automatically stop if the target is destroyed.
#### `stop() -> None`
Stop the animation without completing it.
Note:
**Returns:** None Unlike complete(), this does NOT apply the final value and does NOT trigger the callback. The animation is simply cancelled and will be removed from the AnimationManager.
#### `update(delta_time: float) -> bool`
Update the animation by the given time delta.
Note:
**Arguments:**
- `delta_time`: Time elapsed since last update in seconds
**Returns:** bool: True if animation is still running, False if complete Typically called by AnimationManager automatically. Manual calls only needed for custom animation control.
### Arc
*Inherits from: Drawable*
@ -1418,6 +1302,18 @@ Example:
**Methods:**
#### `descent_step(pos) -> Vector | None`
Get the adjacent cell with the lowest distance (steepest descent).
Unlike step_from (which follows the path set by path_from), descent_step
always returns the best neighbor in a single hop. Useful for AI that
reacts to the current distance field rather than following a fixed path.
**Arguments:**
- `pos`: Current position as Vector, Entity, or (x, y) tuple.
**Returns:** Next position as Vector, or None if pos is a local minimum or off-grid.
#### `distance(pos) -> float | None`
Get distance from position to root.
@ -1427,6 +1323,16 @@ Get distance from position to root.
**Returns:** Float distance, or None if position is unreachable.
#### `invert() -> DijkstraMap`
Return a NEW DijkstraMap whose distance field is the safety field.
Cells near a root become high values and cells far from any root become
low values. Combined with step_from or descent_step, this gives flee
behavior: descend the inverted map to move away from the original roots.
The original DijkstraMap is unchanged.
**Returns:** New DijkstraMap with inverted distances.
#### `path_from(pos) -> AStarPath`
Get full path from position to root.
@ -3052,6 +2958,99 @@ Return NEW HeightMap with uniform value where in range, 0.0 elsewhere.
**Raises:** ValueError: min > max
### Heuristic
*Inherits from: IntEnum*
Built-in A* heuristic function selector.
Values:
EUCLIDEAN: sqrt((dx)^2 + (dy)^2). Admissible, default.
MANHATTAN: |dx| + |dy|. Admissible on 4-connected grids.
CHEBYSHEV: max(|dx|, |dy|). Admissible on 8-connected (diag=1).
DIAGONAL: Octile distance. Admissible on 8-connected (diag=sqrt(2)).
ZERO: Always returns 0. A* degenerates to Dijkstra.
**Properties:**
- `denominator`: the denominator of a rational number in lowest terms
- `imag`: the imaginary part of a complex number
- `numerator`: the numerator of a rational number in lowest terms
- `real`: the real part of a complex number
**Methods:**
#### `as_integer_ratio(...)`
Return a pair of integers, whose ratio is equal to the original int.
The ratio is in lowest terms and has a positive denominator.
>>> (10).as_integer_ratio()
(10, 1)
>>> (-10).as_integer_ratio()
(-10, 1)
>>> (0).as_integer_ratio()
(0, 1)
#### `bit_count(...)`
Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13)
'0b1101'
>>> (13).bit_count()
3
#### `bit_length(...)`
Number of bits necessary to represent self in binary.
>>> bin(37)
'0b100101'
>>> (37).bit_length()
6
#### `conjugate(...)`
Returns self, the complex conjugate of any int.
#### `from_bytes(...)`
Return the integer represented by the given array of bytes.
bytes
Holds the array of bytes to convert. The argument must either
support the buffer protocol or be an iterable object producing bytes.
Bytes and bytearray are examples of built-in objects that support the
buffer protocol.
byteorder
The byte order used to represent the integer. If byteorder is 'big',
the most significant byte is at the beginning of the byte array. If
byteorder is 'little', the most significant byte is at the end of the
byte array. To request the native byte order of the host system, use
sys.byteorder as the byte order value. Default is to use 'big'.
signed
Indicates whether two's complement is used to represent the integer.
#### `is_integer(...)`
Returns True. Exists for duck type compatibility with float.is_integer.
#### `to_bytes(...)`
Return an array of bytes representing an integer.
length
Length of bytes object to use. An OverflowError is raised if the
integer is not representable with the given number of bytes. Default
is length 1.
byteorder
The byte order used to represent the integer. If byteorder is 'big',
the most significant byte is at the beginning of the byte array. If
byteorder is 'little', the most significant byte is at the end of the
byte array. To request the native byte order of the host system, use
sys.byteorder as the byte order value. Default is to use 'big'.
signed
Determines whether two's complement is used to represent the integer.
If signed is False and a negative integer is given, an OverflowError
is raised.
### InputState
*Inherits from: IntEnum*

View file

@ -108,7 +108,7 @@
<body>
<div class="container">
<h1>McRogueFace API Reference</h1>
<p><em>Generated on 2026-04-18 07:28:57</em></p>
<p><em>Generated on 2026-04-18 13:35:02</em></p>
<p><em>This documentation was dynamically generated from the compiled module.</em></p>
<div class="toc">
@ -119,7 +119,6 @@
<ul>
<li><a href="#AStarPath">AStarPath</a></li>
<li><a href="#Alignment">Alignment</a></li>
<li><a href="#Animation">Animation</a></li>
<li><a href="#Arc">Arc</a></li>
<li><a href="#AutoRuleSet">AutoRuleSet</a></li>
<li><a href="#BSP">BSP</a></li>
@ -144,6 +143,7 @@
<li><a href="#Grid">Grid</a></li>
<li><a href="#GridView">GridView</a></li>
<li><a href="#HeightMap">HeightMap</a></li>
<li><a href="#Heuristic">Heuristic</a></li>
<li><a href="#InputState">InputState</a></li>
<li><a href="#Key">Key</a></li>
<li><a href="#Keyboard">Keyboard</a></li>
@ -479,122 +479,6 @@ Also known as the population count.
</div>
</div>
<div class="method-section">
<h3 id="Animation"><span class="class-name">Animation</span></h3>
<p>Animation(property: str, target: Any, duration: float, easing: str = &#x27;linear&#x27;, delta: bool = False, loop: bool = False, callback: Callable = None)
Create an animation that interpolates a property value over time.
Args:
property: Property name to animate. Valid properties depend on target type:
- Position/Size: &#x27;x&#x27;, &#x27;y&#x27;, &#x27;w&#x27;, &#x27;h&#x27;, &#x27;pos&#x27;, &#x27;size&#x27;
- Appearance: &#x27;fill_color&#x27;, &#x27;outline_color&#x27;, &#x27;outline&#x27;, &#x27;opacity&#x27;
- Sprite: &#x27;sprite_index&#x27;, &#x27;scale&#x27;
- Grid: &#x27;center&#x27;, &#x27;zoom&#x27;
- Caption: &#x27;text&#x27;
- Sub-properties: &#x27;fill_color.r&#x27;, &#x27;fill_color.g&#x27;, &#x27;fill_color.b&#x27;, &#x27;fill_color.a&#x27;
target: Target value for the animation. Type depends on property:
- float: For numeric properties (x, y, w, h, scale, opacity, zoom)
- int: For integer properties (sprite_index)
- tuple (r, g, b[, a]): For color properties
- tuple (x, y): For vector properties (pos, size, center)
- list[int]: For sprite animation sequences
- str: For text animation
duration: Animation duration in seconds.
easing: Easing function name. Options:
- &#x27;linear&#x27; (default)
- &#x27;easeIn&#x27;, &#x27;easeOut&#x27;, &#x27;easeInOut&#x27;
- &#x27;easeInQuad&#x27;, &#x27;easeOutQuad&#x27;, &#x27;easeInOutQuad&#x27;
- &#x27;easeInCubic&#x27;, &#x27;easeOutCubic&#x27;, &#x27;easeInOutCubic&#x27;
- &#x27;easeInQuart&#x27;, &#x27;easeOutQuart&#x27;, &#x27;easeInOutQuart&#x27;
- &#x27;easeInSine&#x27;, &#x27;easeOutSine&#x27;, &#x27;easeInOutSine&#x27;
- &#x27;easeInExpo&#x27;, &#x27;easeOutExpo&#x27;, &#x27;easeInOutExpo&#x27;
- &#x27;easeInCirc&#x27;, &#x27;easeOutCirc&#x27;, &#x27;easeInOutCirc&#x27;
- &#x27;easeInElastic&#x27;, &#x27;easeOutElastic&#x27;, &#x27;easeInOutElastic&#x27;
- &#x27;easeInBack&#x27;, &#x27;easeOutBack&#x27;, &#x27;easeInOutBack&#x27;
- &#x27;easeInBounce&#x27;, &#x27;easeOutBounce&#x27;, &#x27;easeInOutBounce&#x27;
delta: If True, target is relative to start value (additive). Default False.
loop: If True, animation repeats from start when it reaches the end. Default False.
callback: Function(target, property, value) called when animation completes.
Not called for looping animations (since they never complete).
Example:
# Move a frame from current position to x=500 over 2 seconds
anim = mcrfpy.Animation(&#x27;x&#x27;, 500.0, 2.0, &#x27;easeInOut&#x27;)
anim.start(my_frame)
# Looping sprite animation
walk = mcrfpy.Animation(&#x27;sprite_index&#x27;, [0,1,2,3,2,1], 0.6, loop=True)
walk.start(my_sprite)
</p>
<h4>Properties:</h4>
<ul>
<li><span class='property-name'>duration</span> (read-only): Animation duration in seconds (float, read-only). Total time for the animation to complete.</li>
<li><span class='property-name'>elapsed</span> (read-only): Elapsed time in seconds (float, read-only). Time since the animation started.</li>
<li><span class='property-name'>is_complete</span> (read-only): Whether animation is complete (bool, read-only). True when elapsed &gt;= duration or complete() was called.</li>
<li><span class='property-name'>is_delta</span> (read-only): Whether animation uses delta mode (bool, read-only). In delta mode, the target value is added to the starting value.</li>
<li><span class='property-name'>is_looping</span> (read-only): Whether animation loops (bool, read-only). Looping animations repeat from the start when they reach the end.</li>
<li><span class='property-name'>property</span> (read-only): Target property name (str, read-only). The property being animated (e.g., &#x27;pos&#x27;, &#x27;opacity&#x27;, &#x27;sprite_index&#x27;).</li>
</ul>
<h4>Methods:</h4>
<div style="margin-left: 20px; margin-bottom: 15px;">
<h5><code class="method-name">complete() -> None</code></h5>
<p>Complete the animation immediately by jumping to the final value.
Note:</p>
<p style='margin-left: 20px;'><span class='returns'>Returns:</span> None Sets elapsed = duration and applies target value immediately. Completion callback will be called if set.</p>
</div>
<div style="margin-left: 20px; margin-bottom: 15px;">
<h5><code class="method-name">get_current_value() -> Any</code></h5>
<p>Get the current interpolated value of the animation.
Note:</p>
<p style='margin-left: 20px;'><span class='returns'>Returns:</span> Any: Current value (type depends on property: float, int, Color tuple, Vector tuple, or str) Return type matches the target property type. For sprite_index returns int, for pos returns (x, y), for fill_color returns (r, g, b, a).</p>
</div>
<div style="margin-left: 20px; margin-bottom: 15px;">
<h5><code class="method-name">hasValidTarget() -> bool</code></h5>
<p>Check if the animation still has a valid target.
Note:</p>
<p style='margin-left: 20px;'><span class='returns'>Returns:</span> bool: True if the target still exists, False if it was destroyed Animations automatically clean up when targets are destroyed. Use this to check if manual cleanup is needed.</p>
</div>
<div style="margin-left: 20px; margin-bottom: 15px;">
<h5><code class="method-name">start(target: UIDrawable, conflict_mode: str = 'replace') -> None</code></h5>
<p>Start the animation on a target UI element.
Note:</p>
<div style='margin-left: 20px;'>
<div><span class='arg-name'>target</span>: The UI element to animate (Frame, Caption, Sprite, Grid, or Entity)</div>
<div><span class='arg-name'>conflict_mode</span>: How to handle conflicts if property is already animating: &#x27;replace&#x27; (default) - complete existing animation and start new one; &#x27;queue&#x27; - wait for existing animation to complete; &#x27;error&#x27; - raise RuntimeError if property is busy</div>
</div>
<p style='margin-left: 20px;'><span class='returns'>Returns:</span> None</p>
<p style='margin-left: 20px;'><span class='raises'>Raises:</span> RuntimeError: When conflict_mode=&#x27;error&#x27; and property is already animating The animation will automatically stop if the target is destroyed.</p>
</div>
<div style="margin-left: 20px; margin-bottom: 15px;">
<h5><code class="method-name">stop() -> None</code></h5>
<p>Stop the animation without completing it.
Note:</p>
<p style='margin-left: 20px;'><span class='returns'>Returns:</span> None Unlike complete(), this does NOT apply the final value and does NOT trigger the callback. The animation is simply cancelled and will be removed from the AnimationManager.</p>
</div>
<div style="margin-left: 20px; margin-bottom: 15px;">
<h5><code class="method-name">update(delta_time: float) -> bool</code></h5>
<p>Update the animation by the given time delta.
Note:</p>
<div style='margin-left: 20px;'>
<div><span class='arg-name'>delta_time</span>: Time elapsed since last update in seconds</div>
</div>
<p style='margin-left: 20px;'><span class='returns'>Returns:</span> bool: True if animation is still running, False if complete Typically called by AnimationManager automatically. Manual calls only needed for custom animation control.</p>
</div>
</div>
<div class="method-section">
<h3 id="Arc"><span class="class-name">Arc</span></h3>
<p><em>Inherits from: Drawable</em></p>
@ -1567,6 +1451,18 @@ Example:
</ul>
<h4>Methods:</h4>
<div style="margin-left: 20px; margin-bottom: 15px;">
<h5><code class="method-name">descent_step(pos) -> Vector | None</code></h5>
<p>Get the adjacent cell with the lowest distance (steepest descent).
Unlike step_from (which follows the path set by path_from), descent_step
always returns the best neighbor in a single hop. Useful for AI that
reacts to the current distance field rather than following a fixed path.</p>
<div style='margin-left: 20px;'>
<div><span class='arg-name'>pos</span>: Current position as Vector, Entity, or (x, y) tuple.</div>
</div>
<p style='margin-left: 20px;'><span class='returns'>Returns:</span> Next position as Vector, or None if pos is a local minimum or off-grid.</p>
</div>
<div style="margin-left: 20px; margin-bottom: 15px;">
<h5><code class="method-name">distance(pos) -> float | None</code></h5>
<p>Get distance from position to root.</p>
@ -1576,6 +1472,16 @@ Example:
<p style='margin-left: 20px;'><span class='returns'>Returns:</span> Float distance, or None if position is unreachable.</p>
</div>
<div style="margin-left: 20px; margin-bottom: 15px;">
<h5><code class="method-name">invert() -> DijkstraMap</code></h5>
<p>Return a NEW DijkstraMap whose distance field is the safety field.
Cells near a root become high values and cells far from any root become
low values. Combined with step_from or descent_step, this gives flee
behavior: descend the inverted map to move away from the original roots.
The original DijkstraMap is unchanged.</p>
<p style='margin-left: 20px;'><span class='returns'>Returns:</span> New DijkstraMap with inverted distances.</p>
</div>
<div style="margin-left: 20px; margin-bottom: 15px;">
<h5><code class="method-name">path_from(pos) -> AStarPath</code></h5>
<p>Get full path from position to root.</p>
@ -3247,6 +3153,106 @@ Note:</p>
</div>
</div>
<div class="method-section">
<h3 id="Heuristic"><span class="class-name">Heuristic</span></h3>
<p><em>Inherits from: IntEnum</em></p>
<p>Built-in A* heuristic function selector.
Values:
EUCLIDEAN: sqrt((dx)^2 + (dy)^2). Admissible, default.
MANHATTAN: |dx| + |dy|. Admissible on 4-connected grids.
CHEBYSHEV: max(|dx|, |dy|). Admissible on 8-connected (diag=1).
DIAGONAL: Octile distance. Admissible on 8-connected (diag=sqrt(2)).
ZERO: Always returns 0. A* degenerates to Dijkstra.
</p>
<h4>Properties:</h4>
<ul>
<li><span class='property-name'>denominator</span>: the denominator of a rational number in lowest terms</li>
<li><span class='property-name'>imag</span>: the imaginary part of a complex number</li>
<li><span class='property-name'>numerator</span>: the numerator of a rational number in lowest terms</li>
<li><span class='property-name'>real</span>: the real part of a complex number</li>
</ul>
<h4>Methods:</h4>
<div style="margin-left: 20px; margin-bottom: 15px;">
<h5><code class="method-name">as_integer_ratio(...)</code></h5>
<p>Return a pair of integers, whose ratio is equal to the original int.
The ratio is in lowest terms and has a positive denominator.
&gt;&gt;&gt; (10).as_integer_ratio()
(10, 1)
&gt;&gt;&gt; (-10).as_integer_ratio()
(-10, 1)
&gt;&gt;&gt; (0).as_integer_ratio()
(0, 1)</p>
</div>
<div style="margin-left: 20px; margin-bottom: 15px;">
<h5><code class="method-name">bit_count(...)</code></h5>
<p>Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
&gt;&gt;&gt; bin(13)
&#x27;0b1101&#x27;
&gt;&gt;&gt; (13).bit_count()
3</p>
</div>
<div style="margin-left: 20px; margin-bottom: 15px;">
<h5><code class="method-name">bit_length(...)</code></h5>
<p>Number of bits necessary to represent self in binary.
&gt;&gt;&gt; bin(37)
&#x27;0b100101&#x27;
&gt;&gt;&gt; (37).bit_length()
6</p>
</div>
<div style="margin-left: 20px; margin-bottom: 15px;">
<h5><code class="method-name">conjugate(...)</code></h5>
<p>Returns self, the complex conjugate of any int.</p>
</div>
<div style="margin-left: 20px; margin-bottom: 15px;">
<h5><code class="method-name">from_bytes(...)</code></h5>
<p>Return the integer represented by the given array of bytes.
bytes
Holds the array of bytes to convert. The argument must either
support the buffer protocol or be an iterable object producing bytes.
Bytes and bytearray are examples of built-in objects that support the
buffer protocol.
byteorder
The byte order used to represent the integer. If byteorder is &#x27;big&#x27;,
the most significant byte is at the beginning of the byte array. If
byteorder is &#x27;little&#x27;, the most significant byte is at the end of the
byte array. To request the native byte order of the host system, use
sys.byteorder as the byte order value. Default is to use &#x27;big&#x27;.
signed
Indicates whether two&#x27;s complement is used to represent the integer.</p>
</div>
<div style="margin-left: 20px; margin-bottom: 15px;">
<h5><code class="method-name">is_integer(...)</code></h5>
<p>Returns True. Exists for duck type compatibility with float.is_integer.</p>
</div>
<div style="margin-left: 20px; margin-bottom: 15px;">
<h5><code class="method-name">to_bytes(...)</code></h5>
<p>Return an array of bytes representing an integer.
length
Length of bytes object to use. An OverflowError is raised if the
integer is not representable with the given number of bytes. Default
is length 1.
byteorder
The byte order used to represent the integer. If byteorder is &#x27;big&#x27;,
the most significant byte is at the beginning of the byte array. If
byteorder is &#x27;little&#x27;, the most significant byte is at the end of the
byte array. To request the native byte order of the host system, use
sys.byteorder as the byte order value. Default is to use &#x27;big&#x27;.
signed
Determines whether two&#x27;s complement is used to represent the integer.
If signed is False and a negative integer is given, an OverflowError
is raised.</p>
</div>
</div>
<div class="method-section">
<h3 id="InputState"><span class="class-name">InputState</span></h3>
<p><em>Inherits from: IntEnum</em></p>

View file

@ -14,11 +14,11 @@
. ftr VB CB
. ftr VBI CBI
.\}
.TH "MCRFPY" "3" "2026-04-18" "McRogueFace 0.2.7-prerelease-7drl2026-79-g59e7221" ""
.TH "MCRFPY" "3" "2026-04-18" "McRogueFace 0.2.7-prerelease-7drl2026-93-g0f7254e" ""
.hy
.SH McRogueFace API Reference
.PP
\f[I]Generated on 2026-04-18 07:28:57\f[R]
\f[I]Generated on 2026-04-18 13:35:02\f[R]
.PP
\f[I]This documentation was dynamically generated from the compiled
module.\f[R]
@ -33,8 +33,6 @@ AStarPath
.IP \[bu] 2
Alignment
.IP \[bu] 2
Animation
.IP \[bu] 2
Arc
.IP \[bu] 2
AutoRuleSet
@ -83,6 +81,8 @@ GridView
.IP \[bu] 2
HeightMap
.IP \[bu] 2
Heuristic
.IP \[bu] 2
InputState
.IP \[bu] 2
Key
@ -436,146 +436,6 @@ signed Determines whether two\[cq]s complement is used to represent the
integer.
If signed is False and a negative integer is given, an OverflowError is
raised.
.SS Animation
.PP
Animation(property: str, target: Any, duration: float, easing: str =
`linear', delta: bool = False, loop: bool = False, callback: Callable =
None)
.PP
Create an animation that interpolates a property value over time.
.PP
Args: property: Property name to animate.
Valid properties depend on target type: - Position/Size: `x', `y', `w',
`h', `pos', `size' - Appearance: `fill_color', `outline_color',
`outline', `opacity' - Sprite: `sprite_index', `scale' - Grid: `center',
`zoom' - Caption: `text' - Sub-properties: `fill_color.r',
`fill_color.g', `fill_color.b', `fill_color.a' target: Target value for
the animation.
Type depends on property: - float: For numeric properties (x, y, w, h,
scale, opacity, zoom) - int: For integer properties (sprite_index) -
tuple (r, g, b[, a]): For color properties - tuple (x, y): For vector
properties (pos, size, center) - list[int]: For sprite animation
sequences - str: For text animation duration: Animation duration in
seconds.
easing: Easing function name.
Options: - `linear' (default) - `easeIn', `easeOut', `easeInOut' -
`easeInQuad', `easeOutQuad', `easeInOutQuad' - `easeInCubic',
`easeOutCubic', `easeInOutCubic' - `easeInQuart', `easeOutQuart',
`easeInOutQuart' - `easeInSine', `easeOutSine', `easeInOutSine' -
`easeInExpo', `easeOutExpo', `easeInOutExpo' - `easeInCirc',
`easeOutCirc', `easeInOutCirc' - `easeInElastic', `easeOutElastic',
`easeInOutElastic' - `easeInBack', `easeOutBack', `easeInOutBack' -
`easeInBounce', `easeOutBounce', `easeInOutBounce' delta: If True,
target is relative to start value (additive).
Default False.
loop: If True, animation repeats from start when it reaches the end.
Default False.
callback: Function(target, property, value) called when animation
completes.
Not called for looping animations (since they never complete).
.PP
Example: # Move a frame from current position to x=500 over 2 seconds
anim = mcrfpy.Animation(`x', 500.0, 2.0, `easeInOut')
anim.start(my_frame)
.IP
.nf
\f[C]
# Looping sprite animation
walk = mcrfpy.Animation(\[aq]sprite_index\[aq], [0,1,2,3,2,1], 0.6, loop=True)
walk.start(my_sprite)
\f[R]
.fi
.PP
\f[B]Properties:\f[R] - \f[V]duration\f[R] \f[I](read-only)\f[R]:
Animation duration in seconds (float, read-only).
Total time for the animation to complete.
- \f[V]elapsed\f[R] \f[I](read-only)\f[R]: Elapsed time in seconds
(float, read-only).
Time since the animation started.
- \f[V]is_complete\f[R] \f[I](read-only)\f[R]: Whether animation is
complete (bool, read-only).
True when elapsed >= duration or complete() was called.
- \f[V]is_delta\f[R] \f[I](read-only)\f[R]: Whether animation uses delta
mode (bool, read-only).
In delta mode, the target value is added to the starting value.
- \f[V]is_looping\f[R] \f[I](read-only)\f[R]: Whether animation loops
(bool, read-only).
Looping animations repeat from the start when they reach the end.
- \f[V]property\f[R] \f[I](read-only)\f[R]: Target property name (str,
read-only).
The property being animated (e.g., `pos', `opacity', `sprite_index').
.PP
\f[B]Methods:\f[R]
.SS \f[V]complete() -> None\f[R]
.PP
Complete the animation immediately by jumping to the final value.
.PP
Note:
.PP
\f[B]Returns:\f[R] None Sets elapsed = duration and applies target value
immediately.
Completion callback will be called if set.
.SS \f[V]get_current_value() -> Any\f[R]
.PP
Get the current interpolated value of the animation.
.PP
Note:
.PP
\f[B]Returns:\f[R] Any: Current value (type depends on property: float,
int, Color tuple, Vector tuple, or str) Return type matches the target
property type.
For sprite_index returns int, for pos returns (x, y), for fill_color
returns (r, g, b, a).
.SS \f[V]hasValidTarget() -> bool\f[R]
.PP
Check if the animation still has a valid target.
.PP
Note:
.PP
\f[B]Returns:\f[R] bool: True if the target still exists, False if it
was destroyed Animations automatically clean up when targets are
destroyed.
Use this to check if manual cleanup is needed.
.SS \f[V]start(target: UIDrawable, conflict_mode: str = \[aq]replace\[aq]) -> None\f[R]
.PP
Start the animation on a target UI element.
.PP
Note:
.PP
\f[B]Arguments:\f[R] - \f[V]target\f[R]: The UI element to animate
(Frame, Caption, Sprite, Grid, or Entity) - \f[V]conflict_mode\f[R]: How
to handle conflicts if property is already animating: `replace'
(default) - complete existing animation and start new one; `queue' -
wait for existing animation to complete; `error' - raise RuntimeError if
property is busy
.PP
\f[B]Returns:\f[R] None
.PP
\f[B]Raises:\f[R] RuntimeError: When conflict_mode=`error' and property
is already animating The animation will automatically stop if the target
is destroyed.
.SS \f[V]stop() -> None\f[R]
.PP
Stop the animation without completing it.
.PP
Note:
.PP
\f[B]Returns:\f[R] None Unlike complete(), this does NOT apply the final
value and does NOT trigger the callback.
The animation is simply cancelled and will be removed from the
AnimationManager.
.SS \f[V]update(delta_time: float) -> bool\f[R]
.PP
Update the animation by the given time delta.
.PP
Note:
.PP
\f[B]Arguments:\f[R] - \f[V]delta_time\f[R]: Time elapsed since last
update in seconds
.PP
\f[B]Returns:\f[R] bool: True if animation is still running, False if
complete Typically called by AnimationManager automatically.
Manual calls only needed for custom animation control.
.SS Arc
.PP
\f[I]Inherits from: Drawable\f[R]
@ -1602,6 +1462,19 @@ enemies: dist = dijkstra.distance(enemy.pos) if dist and dist < 10: step
position that distances are measured from (Vector, read-only).
.PP
\f[B]Methods:\f[R]
.SS \f[V]descent_step(pos) -> Vector | None\f[R]
.PP
Get the adjacent cell with the lowest distance (steepest descent).
Unlike step_from (which follows the path set by path_from), descent_step
always returns the best neighbor in a single hop.
Useful for AI that reacts to the current distance field rather than
following a fixed path.
.PP
\f[B]Arguments:\f[R] - \f[V]pos\f[R]: Current position as Vector,
Entity, or (x, y) tuple.
.PP
\f[B]Returns:\f[R] Next position as Vector, or None if pos is a local
minimum or off-grid.
.SS \f[V]distance(pos) -> float | None\f[R]
.PP
Get distance from position to root.
@ -1610,6 +1483,16 @@ Get distance from position to root.
y) tuple.
.PP
\f[B]Returns:\f[R] Float distance, or None if position is unreachable.
.SS \f[V]invert() -> DijkstraMap\f[R]
.PP
Return a NEW DijkstraMap whose distance field is the safety field.
Cells near a root become high values and cells far from any root become
low values.
Combined with step_from or descent_step, this gives flee behavior:
descend the inverted map to move away from the original roots.
The original DijkstraMap is unchanged.
.PP
\f[B]Returns:\f[R] New DijkstraMap with inverted distances.
.SS \f[V]path_from(pos) -> AStarPath\f[R]
.PP
Get full path from position to root.
@ -3307,6 +3190,90 @@ or list, inclusive - \f[V]value\f[R]: Value to set for cells in range
\f[B]Returns:\f[R] HeightMap: New HeightMap (original is unchanged)
.PP
\f[B]Raises:\f[R] ValueError: min > max
.SS Heuristic
.PP
\f[I]Inherits from: IntEnum\f[R]
.PP
Built-in A* heuristic function selector.
.PP
Values: EUCLIDEAN: sqrt((dx)\[ha]2 + (dy)\[ha]2).
Admissible, default.
MANHATTAN: |dx| + |dy|.
Admissible on 4-connected grids.
CHEBYSHEV: max(|dx|, |dy|).
Admissible on 8-connected (diag=1).
DIAGONAL: Octile distance.
Admissible on 8-connected (diag=sqrt(2)).
ZERO: Always returns 0.
A* degenerates to Dijkstra.
.PP
\f[B]Properties:\f[R] - \f[V]denominator\f[R]: the denominator of a
rational number in lowest terms - \f[V]imag\f[R]: the imaginary part of
a complex number - \f[V]numerator\f[R]: the numerator of a rational
number in lowest terms - \f[V]real\f[R]: the real part of a complex
number
.PP
\f[B]Methods:\f[R]
.SS \f[V]as_integer_ratio(...)\f[R]
.PP
Return a pair of integers, whose ratio is equal to the original int.
The ratio is in lowest terms and has a positive denominator.
>>> (10).as_integer_ratio() (10, 1) >>> (-10).as_integer_ratio() (-10,
1) >>> (0).as_integer_ratio() (0, 1)
.SS \f[V]bit_count(...)\f[R]
.PP
Number of ones in the binary representation of the absolute value of
self.
Also known as the population count.
>>> bin(13) `0b1101' >>> (13).bit_count() 3
.SS \f[V]bit_length(...)\f[R]
.PP
Number of bits necessary to represent self in binary.
>>> bin(37) `0b100101' >>> (37).bit_length() 6
.SS \f[V]conjugate(...)\f[R]
.PP
Returns self, the complex conjugate of any int.
.SS \f[V]from_bytes(...)\f[R]
.PP
Return the integer represented by the given array of bytes.
bytes Holds the array of bytes to convert.
The argument must either support the buffer protocol or be an iterable
object producing bytes.
Bytes and bytearray are examples of built-in objects that support the
buffer protocol.
byteorder The byte order used to represent the integer.
If byteorder is `big', the most significant byte is at the beginning of
the byte array.
If byteorder is `little', the most significant byte is at the end of the
byte array.
To request the native byte order of the host system, use sys.byteorder
as the byte order value.
Default is to use `big'.
signed Indicates whether two\[cq]s complement is used to represent the
integer.
.SS \f[V]is_integer(...)\f[R]
.PP
Returns True.
Exists for duck type compatibility with float.is_integer.
.SS \f[V]to_bytes(...)\f[R]
.PP
Return an array of bytes representing an integer.
length Length of bytes object to use.
An OverflowError is raised if the integer is not representable with the
given number of bytes.
Default is length 1.
byteorder The byte order used to represent the integer.
If byteorder is `big', the most significant byte is at the beginning of
the byte array.
If byteorder is `little', the most significant byte is at the end of the
byte array.
To request the native byte order of the host system, use sys.byteorder
as the byte order value.
Default is to use `big'.
signed Determines whether two\[cq]s complement is used to represent the
integer.
If signed is False and a negative integer is given, an OverflowError is
raised.
.SS InputState
.PP
\f[I]Inherits from: IntEnum\f[R]

View file

@ -92,6 +92,14 @@ class FOV(IntEnum):
SHADOW: int
SYMMETRIC_SHADOWCAST: int
class Heuristic(IntEnum):
"""Built-in A* heuristic function selector."""
CHEBYSHEV: int
DIAGONAL: int
EUCLIDEAN: int
MANHATTAN: int
ZERO: int
class InputState(IntEnum):
"""Enum representing input event states (pressed/released)."""
PRESSED: int
@ -255,34 +263,6 @@ class AStarPath:
"""Get and consume next step in the path."""
...
class Animation:
"""Create an animation that interpolates a property value over time."""
def __init__(self, property: str, target: Any, duration: float, easing: str = 'linear', delta: bool = False, loop: bool = False, callback: Callable = None) -> None: ...
duration: float # Animation duration in seconds (float, read-only). Total time for the animation to complete.
elapsed: float # Elapsed time in seconds (float, read-only). Time since the animation started.
is_complete: bool # Whether animation is complete (bool, read-only). True when elapsed >= duration or complete() was called.
is_delta: bool # Whether animation uses delta mode (bool, read-only). In delta mode, the target value is added to the starting value.
is_looping: bool # Whether animation loops (bool, read-only). Looping animations repeat from the start when they reach the end.
property: str # Target property name (str, read-only). The property being animated (e.g., 'pos', 'opacity', 'sprite_index').
def complete(self) -> None:
"""Complete the animation immediately by jumping to the final value."""
...
def get_current_value(self) -> Any:
"""Get the current interpolated value of the animation."""
...
def hasValidTarget(self) -> bool:
"""Check if the animation still has a valid target."""
...
def start(self, target: UIDrawable, conflict_mode: str = 'replace') -> None:
"""Start the animation on a target UI element."""
...
def stop(self) -> None:
"""Stop the animation without completing it."""
...
def update(self, delta_time: float) -> bool:
"""Update the animation by the given time delta."""
...
class Arc:
"""An arc UI element for drawing curved line segments."""
def __init__(self, center=None, radius=0, start_angle=0, end_angle=90, color=None, thickness=1, **kwargs) -> None: ...
@ -558,9 +538,15 @@ class DijkstraMap:
"""A Dijkstra distance map from a fixed root position."""
def __init__(self, *args, **kwargs) -> None: ...
root: Vector # Root position that distances are measured from (Vector, read-only).
def descent_step(self, pos) -> Vector | None:
"""Get the adjacent cell with the lowest distance (steepest descent)."""
...
def distance(self, pos) -> float | None:
"""Get distance from position to root."""
...
def invert(self) -> DijkstraMap:
"""Return a NEW DijkstraMap whose distance field is the safety field."""
...
def path_from(self, pos) -> AStarPath:
"""Get full path from position to root."""
...