1043 lines
30 KiB
HTML
1043 lines
30 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>McRogueFace API Reference</title>
|
|
<style>
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
|
line-height: 1.6;
|
|
color: #333;
|
|
max-width: 1200px;
|
|
margin: 0 auto;
|
|
padding: 20px;
|
|
background: #f8f9fa;
|
|
}
|
|
|
|
.container {
|
|
background: white;
|
|
padding: 30px;
|
|
border-radius: 8px;
|
|
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
}
|
|
|
|
h1 {
|
|
color: #2c3e50;
|
|
border-bottom: 3px solid #3498db;
|
|
padding-bottom: 15px;
|
|
margin-bottom: 30px;
|
|
}
|
|
|
|
h2 {
|
|
color: #34495e;
|
|
border-bottom: 2px solid #ecf0f1;
|
|
padding-bottom: 10px;
|
|
margin-top: 40px;
|
|
}
|
|
|
|
h3 {
|
|
color: #2c3e50;
|
|
margin-top: 30px;
|
|
}
|
|
|
|
h4 {
|
|
color: #34495e;
|
|
margin-top: 20px;
|
|
font-size: 1.1em;
|
|
}
|
|
|
|
h5 {
|
|
color: #555;
|
|
margin-top: 15px;
|
|
font-size: 1em;
|
|
}
|
|
|
|
code {
|
|
background: #f4f4f4;
|
|
padding: 2px 6px;
|
|
border-radius: 3px;
|
|
font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, monospace;
|
|
font-size: 0.9em;
|
|
}
|
|
|
|
pre {
|
|
background: #f8f8f8;
|
|
border: 1px solid #e1e4e8;
|
|
border-radius: 6px;
|
|
padding: 16px;
|
|
overflow-x: auto;
|
|
margin: 15px 0;
|
|
}
|
|
|
|
pre code {
|
|
background: none;
|
|
padding: 0;
|
|
font-size: 0.875em;
|
|
line-height: 1.45;
|
|
}
|
|
|
|
.class-name {
|
|
color: #8e44ad;
|
|
font-weight: bold;
|
|
}
|
|
|
|
.property {
|
|
color: #27ae60;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.method {
|
|
color: #2980b9;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.inheritance {
|
|
color: #7f8c8d;
|
|
font-size: 0.9em;
|
|
margin-top: -10px;
|
|
}
|
|
|
|
.toc {
|
|
background: #f8f9fa;
|
|
border: 1px solid #e1e4e8;
|
|
border-radius: 6px;
|
|
padding: 20px;
|
|
margin: 20px 0;
|
|
}
|
|
|
|
.toc h2 {
|
|
margin-top: 0;
|
|
border: none;
|
|
padding: 0;
|
|
}
|
|
|
|
.toc ul {
|
|
list-style: none;
|
|
padding-left: 0;
|
|
}
|
|
|
|
.toc li {
|
|
margin: 8px 0;
|
|
}
|
|
|
|
.toc a {
|
|
color: #3498db;
|
|
text-decoration: none;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.toc a:hover {
|
|
text-decoration: underline;
|
|
}
|
|
|
|
.class-section, .function-section {
|
|
margin: 30px 0;
|
|
padding: 20px;
|
|
background: #fafbfc;
|
|
border-radius: 6px;
|
|
border: 1px solid #e1e4e8;
|
|
}
|
|
|
|
.description {
|
|
margin: 15px 0;
|
|
color: #4a5568;
|
|
}
|
|
|
|
.arguments, .properties, .methods {
|
|
margin: 20px 0;
|
|
}
|
|
|
|
dl {
|
|
margin: 10px 0;
|
|
}
|
|
|
|
dt {
|
|
font-weight: 600;
|
|
margin-top: 10px;
|
|
color: #2c3e50;
|
|
}
|
|
|
|
dd {
|
|
margin-left: 20px;
|
|
margin-bottom: 10px;
|
|
color: #555;
|
|
}
|
|
|
|
.example {
|
|
margin: 20px 0;
|
|
padding: 15px;
|
|
background: #f0f7ff;
|
|
border-left: 4px solid #3498db;
|
|
border-radius: 4px;
|
|
}
|
|
|
|
.example h4 {
|
|
margin-top: 0;
|
|
color: #2980b9;
|
|
}
|
|
|
|
hr {
|
|
border: none;
|
|
border-top: 1px solid #e1e4e8;
|
|
margin: 30px 0;
|
|
}
|
|
|
|
.timestamp {
|
|
color: #7f8c8d;
|
|
font-style: italic;
|
|
font-size: 0.9em;
|
|
}
|
|
|
|
.overview {
|
|
background: #e8f4fd;
|
|
border-left: 4px solid #3498db;
|
|
padding: 20px;
|
|
margin: 20px 0;
|
|
border-radius: 4px;
|
|
}
|
|
|
|
.overview pre {
|
|
background: white;
|
|
border: 1px solid #d6e9f5;
|
|
}
|
|
|
|
strong {
|
|
color: #2c3e50;
|
|
}
|
|
|
|
em {
|
|
color: #555;
|
|
}
|
|
|
|
.automation-section {
|
|
background: #f0f9ff;
|
|
border: 1px solid #b8daff;
|
|
border-radius: 6px;
|
|
padding: 20px;
|
|
margin-top: 30px;
|
|
}
|
|
|
|
.automation-section h2 {
|
|
color: #004085;
|
|
border-bottom: 2px solid #b8daff;
|
|
}
|
|
|
|
.function-signature {
|
|
font-family: "SF Mono", Monaco, monospace;
|
|
font-size: 1.1em;
|
|
color: #d73a49;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
|
|
<h1>McRogueFace API Reference</h1>
|
|
<p class="timestamp">Generated on 2025-07-08 11:13:24</p>
|
|
<div class="overview">
|
|
<h2>Overview</h2>
|
|
<p>McRogueFace Python API</p>
|
|
<p>Core game engine interface for creating roguelike games with Python.</p>
|
|
<p>This module provides:</p>
|
|
<p>- Scene management (createScene, setScene, currentScene)</p>
|
|
<p>- UI components (Frame, Caption, Sprite, Grid)</p>
|
|
<p>- Entity system for game objects</p>
|
|
<p>- Audio playback (sound effects and music)</p>
|
|
<p>- Timer system for scheduled events</p>
|
|
<p>- Input handling</p>
|
|
<p>- Performance metrics</p>
|
|
<h4>Example:</h4>
|
|
<pre><code class="language-python">
|
|
import mcrfpy
|
|
# Create a new scene
|
|
mcrfpy.createScene('game')
|
|
mcrfpy.setScene('game')
|
|
# Add UI elements
|
|
frame = mcrfpy.Frame(10, 10, 200, 100)
|
|
caption = mcrfpy.Caption('Hello World', 50, 50)
|
|
mcrfpy.sceneUI().extend([frame, caption])
|
|
</code></pre>
|
|
</div>
|
|
<div class="toc">
|
|
<h2>Table of Contents</h2>
|
|
<ul>
|
|
<li><a href="#classes">Classes</a>
|
|
<ul>
|
|
<li><a href="#ui-components">UI Components</a></li>
|
|
<li><a href="#collections">Collections</a></li>
|
|
<li><a href="#system-types">System Types</a></li>
|
|
<li><a href="#other-classes">Other Classes</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#functions">Functions</a>
|
|
<ul>
|
|
<li><a href="#scene-management">Scene Management</a></li>
|
|
<li><a href="#audio">Audio</a></li>
|
|
<li><a href="#ui-utilities">UI Utilities</a></li>
|
|
<li><a href="#system">System</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#automation">Automation Module</a></li>
|
|
</ul>
|
|
</div>
|
|
<h2 id="classes">Classes</h2>
|
|
<h3 id="ui-components">UI Components</h3>
|
|
<div class="class-section" id="class-Frame">
|
|
<h3>class <span class="class-name">Frame</span></h3>
|
|
<p class="inheritance"><em>Inherits from: Drawable</em></p>
|
|
<div class="description">
|
|
<p>A rectangular frame UI element that can contain other drawable elements.<br>
|
|
<br>
|
|
Args:<br>
|
|
x (float): X position in pixels. Default: 0<br>
|
|
y (float): Y position in pixels. Default: 0<br>
|
|
w (float): Width in pixels. Default: 0<br>
|
|
h (float): Height in pixels. Default: 0<br>
|
|
fill_color (Color): Background fill color. Default: (0, 0, 0, 128)<br>
|
|
outline_color (Color): Border outline color. Default: (255, 255, 255, 255)<br>
|
|
outline (float): Border outline thickness. Default: 0<br>
|
|
click (callable): Click event handler. Default: None<br>
|
|
children (list): Initial list of child drawable elements. Default: None<br>
|
|
<br>
|
|
Attributes:<br>
|
|
x, y (float): Position in pixels<br>
|
|
w, h (float): Size in pixels<br>
|
|
fill_color, outline_color (Color): Visual appearance<br>
|
|
outline (float): Border thickness<br>
|
|
click (callable): Click event handler<br>
|
|
children (list): Collection of child drawable elements<br>
|
|
visible (bool): Visibility state<br>
|
|
z_index (int): Rendering order<br>
|
|
clip_children (bool): Whether to clip children to frame bounds<br></p>
|
|
</div>
|
|
<div class="methods">
|
|
<h4>Methods:</h4>
|
|
<div class="method">
|
|
<h5><code class="method">get_bounds(...)</code></h5>
|
|
<p>Get bounding box as (x, y, width, height)</p>
|
|
</div>
|
|
<div class="method">
|
|
<h5><code class="method">move(...)</code></h5>
|
|
<p>Move by relative offset (dx, dy)</p>
|
|
</div>
|
|
<div class="method">
|
|
<h5><code class="method">resize(...)</code></h5>
|
|
<p>Resize to new dimensions (width, height)</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<hr>
|
|
<div class="class-section" id="class-Caption">
|
|
<h3>class <span class="class-name">Caption</span></h3>
|
|
<p class="inheritance"><em>Inherits from: Drawable</em></p>
|
|
<div class="description">
|
|
<p>A text display UI element with customizable font and styling.<br>
|
|
<br>
|
|
Args:<br>
|
|
text (str): The text content to display. Default: ''<br>
|
|
x (float): X position in pixels. Default: 0<br>
|
|
y (float): Y position in pixels. Default: 0<br>
|
|
font (Font): Font object for text rendering. Default: engine default font<br>
|
|
fill_color (Color): Text fill color. Default: (255, 255, 255, 255)<br>
|
|
outline_color (Color): Text outline color. Default: (0, 0, 0, 255)<br>
|
|
outline (float): Text outline thickness. Default: 0<br>
|
|
click (callable): Click event handler. Default: None<br>
|
|
<br>
|
|
Attributes:<br>
|
|
text (str): The displayed text content<br>
|
|
x, y (float): Position in pixels<br>
|
|
font (Font): Font used for rendering<br>
|
|
fill_color, outline_color (Color): Text appearance<br>
|
|
outline (float): Outline thickness<br>
|
|
click (callable): Click event handler<br>
|
|
visible (bool): Visibility state<br>
|
|
z_index (int): Rendering order<br>
|
|
w, h (float): Read-only computed size based on text and font<br></p>
|
|
</div>
|
|
<div class="methods">
|
|
<h4>Methods:</h4>
|
|
<div class="method">
|
|
<h5><code class="method">get_bounds(...)</code></h5>
|
|
<p>Get bounding box as (x, y, width, height)</p>
|
|
</div>
|
|
<div class="method">
|
|
<h5><code class="method">move(...)</code></h5>
|
|
<p>Move by relative offset (dx, dy)</p>
|
|
</div>
|
|
<div class="method">
|
|
<h5><code class="method">resize(...)</code></h5>
|
|
<p>Resize to new dimensions (width, height)</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<hr>
|
|
<div class="class-section" id="class-Sprite">
|
|
<h3>class <span class="class-name">Sprite</span></h3>
|
|
<p class="inheritance"><em>Inherits from: Drawable</em></p>
|
|
<div class="description">
|
|
<p>A sprite UI element that displays a texture or portion of a texture atlas.<br>
|
|
<br>
|
|
Args:<br>
|
|
x (float): X position in pixels. Default: 0<br>
|
|
y (float): Y position in pixels. Default: 0<br>
|
|
texture (Texture): Texture object to display. Default: None<br>
|
|
sprite_index (int): Index into texture atlas (if applicable). Default: 0<br>
|
|
scale (float): Sprite scaling factor. Default: 1.0<br>
|
|
click (callable): Click event handler. Default: None<br>
|
|
<br>
|
|
Attributes:<br>
|
|
x, y (float): Position in pixels<br>
|
|
texture (Texture): The texture being displayed<br>
|
|
sprite_index (int): Current sprite index in texture atlas<br>
|
|
scale (float): Scale multiplier<br>
|
|
click (callable): Click event handler<br>
|
|
visible (bool): Visibility state<br>
|
|
z_index (int): Rendering order<br>
|
|
w, h (float): Read-only computed size based on texture and scale<br></p>
|
|
</div>
|
|
<div class="methods">
|
|
<h4>Methods:</h4>
|
|
<div class="method">
|
|
<h5><code class="method">get_bounds(...)</code></h5>
|
|
<p>Get bounding box as (x, y, width, height)</p>
|
|
</div>
|
|
<div class="method">
|
|
<h5><code class="method">move(...)</code></h5>
|
|
<p>Move by relative offset (dx, dy)</p>
|
|
</div>
|
|
<div class="method">
|
|
<h5><code class="method">resize(...)</code></h5>
|
|
<p>Resize to new dimensions (width, height)</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<hr>
|
|
<div class="class-section" id="class-Grid">
|
|
<h3>class <span class="class-name">Grid</span></h3>
|
|
<p class="inheritance"><em>Inherits from: Drawable</em></p>
|
|
<div class="description">
|
|
<p>A grid-based tilemap UI element for rendering tile-based levels and game worlds.<br>
|
|
<br>
|
|
Args:<br>
|
|
x (float): X position in pixels. Default: 0<br>
|
|
y (float): Y position in pixels. Default: 0<br>
|
|
grid_size (tuple): Grid dimensions as (width, height) in tiles. Default: (20, 20)<br>
|
|
texture (Texture): Texture atlas containing tile sprites. Default: None<br>
|
|
tile_width (int): Width of each tile in pixels. Default: 16<br>
|
|
tile_height (int): Height of each tile in pixels. Default: 16<br>
|
|
scale (float): Grid scaling factor. Default: 1.0<br>
|
|
click (callable): Click event handler. Default: None<br>
|
|
<br>
|
|
Attributes:<br>
|
|
x, y (float): Position in pixels<br>
|
|
grid_size (tuple): Grid dimensions (width, height) in tiles<br>
|
|
tile_width, tile_height (int): Tile dimensions in pixels<br>
|
|
texture (Texture): Tile texture atlas<br>
|
|
scale (float): Scale multiplier<br>
|
|
points (list): 2D array of GridPoint objects for tile data<br>
|
|
entities (list): Collection of Entity objects in the grid<br>
|
|
background_color (Color): Grid background color<br>
|
|
click (callable): Click event handler<br>
|
|
visible (bool): Visibility state<br>
|
|
z_index (int): Rendering order<br></p>
|
|
</div>
|
|
<div class="methods">
|
|
<h4>Methods:</h4>
|
|
<div class="method">
|
|
<h5><code class="method">at(x, y)</code></h5>
|
|
<p>Get the GridPoint at the specified coordinates.</p>
|
|
<p><strong>Arguments:</strong></p>
|
|
<ul>
|
|
<li><code>x</code> (int)</li>
|
|
<li><code>y</code> (int)</li>
|
|
</ul>
|
|
<p><strong>Returns:</strong> GridPoint: The tile at (x, y), or None if out of bounds</p>
|
|
</div>
|
|
<div class="method">
|
|
<h5><code class="method">get_bounds(...)</code></h5>
|
|
<p>Get bounding box as (x, y, width, height)</p>
|
|
</div>
|
|
<div class="method">
|
|
<h5><code class="method">move(...)</code></h5>
|
|
<p>Move by relative offset (dx, dy)</p>
|
|
</div>
|
|
<div class="method">
|
|
<h5><code class="method">resize(...)</code></h5>
|
|
<p>Resize to new dimensions (width, height)</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<hr>
|
|
<div class="class-section" id="class-Entity">
|
|
<h3>class <span class="class-name">Entity</span></h3>
|
|
<div class="constructor">
|
|
<pre><code class="language-python">
|
|
Entity(x=0, y=0, sprite_id=0)
|
|
</code></pre>
|
|
</div>
|
|
<div class="description">
|
|
<p>Game entity that can be placed in a Grid.<br></p>
|
|
</div>
|
|
<div class="arguments">
|
|
<h4>Arguments:</h4>
|
|
<dl>
|
|
<dt><code>x</code> (<em>int</em>)</dt>
|
|
<dd>Grid x coordinate. Default: 0</dd>
|
|
<dt><code>y</code> (<em>int</em>)</dt>
|
|
<dd>Grid y coordinate. Default: 0</dd>
|
|
<dt><code>sprite_id</code> (<em>int</em>)</dt>
|
|
<dd>Sprite index for rendering. Default: 0</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="methods">
|
|
<h4>Methods:</h4>
|
|
<div class="method">
|
|
<h5><code class="method">at(x, y)</code></h5>
|
|
<p>Check if entity is at given grid coordinates.</p>
|
|
<p><strong>Arguments:</strong></p>
|
|
<ul>
|
|
<li><code>x</code> (int)</li>
|
|
<li><code>y</code> (int)</li>
|
|
</ul>
|
|
<p><strong>Returns:</strong> bool: True if entity is at (x, y)</p>
|
|
</div>
|
|
<div class="method">
|
|
<h5><code class="method">die()</code></h5>
|
|
<p>Remove this entity from its parent grid.</p>
|
|
<p><strong>Note:</strong> The entity object remains valid but is no longer rendered.</p>
|
|
</div>
|
|
<div class="method">
|
|
<h5><code class="method">get_bounds(...)</code></h5>
|
|
<p>Get bounding box as (x, y, width, height)</p>
|
|
</div>
|
|
<div class="method">
|
|
<h5><code class="method">index(...)</code></h5>
|
|
<p>Return the index of this entity in its grid's entity collection</p>
|
|
</div>
|
|
<div class="method">
|
|
<h5><code class="method">move(...)</code></h5>
|
|
<p>Move by relative offset (dx, dy)</p>
|
|
</div>
|
|
<div class="method">
|
|
<h5><code class="method">resize(...)</code></h5>
|
|
<p>Resize to new dimensions (width, height)</p>
|
|
</div>
|
|
</div>
|
|
<div class="example">
|
|
<h4>Example:</h4>
|
|
<pre><code class="language-python">
|
|
entity = mcrfpy.Entity(5, 10, 42)
|
|
entity.move(1, 0) # Move right one tile
|
|
</code></pre>
|
|
</div>
|
|
</div>
|
|
<hr>
|
|
<h3 id="collections">Collections</h3>
|
|
<div class="class-section" id="class-EntityCollection">
|
|
<h3>class <span class="class-name">EntityCollection</span></h3>
|
|
<div class="description">
|
|
<p>Container for Entity objects in a Grid. Supports iteration and indexing.<br></p>
|
|
</div>
|
|
<div class="methods">
|
|
<h4>Methods:</h4>
|
|
<div class="method">
|
|
<h5><code class="method">append(...)</code></h5>
|
|
</div>
|
|
<div class="method">
|
|
<h5><code class="method">remove(...)</code></h5>
|
|
</div>
|
|
<div class="method">
|
|
<h5><code class="method">extend(...)</code></h5>
|
|
</div>
|
|
<div class="method">
|
|
<h5><code class="method">count(...)</code></h5>
|
|
</div>
|
|
<div class="method">
|
|
<h5><code class="method">index(...)</code></h5>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<hr>
|
|
<div class="class-section" id="class-UICollection">
|
|
<h3>class <span class="class-name">UICollection</span></h3>
|
|
<div class="description">
|
|
<p>Container for UI drawable elements. Supports iteration and indexing.<br></p>
|
|
</div>
|
|
<div class="methods">
|
|
<h4>Methods:</h4>
|
|
<div class="method">
|
|
<h5><code class="method">append(...)</code></h5>
|
|
</div>
|
|
<div class="method">
|
|
<h5><code class="method">remove(...)</code></h5>
|
|
</div>
|
|
<div class="method">
|
|
<h5><code class="method">extend(...)</code></h5>
|
|
</div>
|
|
<div class="method">
|
|
<h5><code class="method">count(...)</code></h5>
|
|
</div>
|
|
<div class="method">
|
|
<h5><code class="method">index(...)</code></h5>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<hr>
|
|
<div class="class-section" id="class-UICollectionIter">
|
|
<h3>class <span class="class-name">UICollectionIter</span></h3>
|
|
<div class="description">
|
|
<p>Iterator for UICollection. Automatically created when iterating over a UICollection.<br></p>
|
|
</div>
|
|
</div>
|
|
<hr>
|
|
<div class="class-section" id="class-UIEntityCollectionIter">
|
|
<h3>class <span class="class-name">UIEntityCollectionIter</span></h3>
|
|
<div class="description">
|
|
<p>Iterator for EntityCollection. Automatically created when iterating over an EntityCollection.<br></p>
|
|
</div>
|
|
</div>
|
|
<hr>
|
|
<h3 id="system-types">System Types</h3>
|
|
<div class="class-section" id="class-Color">
|
|
<h3>class <span class="class-name">Color</span></h3>
|
|
<div class="constructor">
|
|
<pre><code class="language-python">
|
|
Color(r=255, g=255, b=255, a=255)
|
|
</code></pre>
|
|
</div>
|
|
<div class="description">
|
|
<p>RGBA color representation.<br></p>
|
|
</div>
|
|
<div class="arguments">
|
|
<h4>Arguments:</h4>
|
|
<dl>
|
|
<dt><code>r</code> (<em>int</em>)</dt>
|
|
<dd>Red component (0-255). Default: 255</dd>
|
|
<dt><code>g</code> (<em>int</em>)</dt>
|
|
<dd>Green component (0-255). Default: 255</dd>
|
|
<dt><code>b</code> (<em>int</em>)</dt>
|
|
<dd>Blue component (0-255). Default: 255</dd>
|
|
<dt><code>a</code> (<em>int</em>)</dt>
|
|
<dd>Alpha component (0-255). Default: 255</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="methods">
|
|
<h4>Methods:</h4>
|
|
<div class="method">
|
|
<h5><code class="method">from_hex(...)</code></h5>
|
|
<p>Create Color from hex string (e.g., '#FF0000' or 'FF0000')</p>
|
|
</div>
|
|
<div class="method">
|
|
<h5><code class="method">lerp(...)</code></h5>
|
|
<p>Linearly interpolate between this color and another</p>
|
|
</div>
|
|
<div class="method">
|
|
<h5><code class="method">to_hex(...)</code></h5>
|
|
<p>Convert Color to hex string</p>
|
|
</div>
|
|
</div>
|
|
<div class="example">
|
|
<h4>Example:</h4>
|
|
<pre><code class="language-python">
|
|
red = mcrfpy.Color(255, 0, 0)
|
|
</code></pre>
|
|
</div>
|
|
</div>
|
|
<hr>
|
|
<div class="class-section" id="class-Vector">
|
|
<h3>class <span class="class-name">Vector</span></h3>
|
|
<div class="constructor">
|
|
<pre><code class="language-python">
|
|
Vector(x=0.0, y=0.0)
|
|
</code></pre>
|
|
</div>
|
|
<div class="description">
|
|
<p>2D vector for positions and directions.<br></p>
|
|
</div>
|
|
<div class="arguments">
|
|
<h4>Arguments:</h4>
|
|
<dl>
|
|
<dt><code>x</code> (<em>float</em>)</dt>
|
|
<dd>X component. Default: 0.0</dd>
|
|
<dt><code>y</code> (<em>float</em>)</dt>
|
|
<dd>Y component. Default: 0.0</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="methods">
|
|
<h4>Methods:</h4>
|
|
<div class="method">
|
|
<h5><code class="method">angle(...)</code></h5>
|
|
<p>Return the angle in radians from the positive X axis</p>
|
|
</div>
|
|
<div class="method">
|
|
<h5><code class="method">copy(...)</code></h5>
|
|
<p>Return a copy of this vector</p>
|
|
</div>
|
|
<div class="method">
|
|
<h5><code class="method">distance_to(...)</code></h5>
|
|
<p>Return the distance to another vector</p>
|
|
</div>
|
|
<div class="method">
|
|
<h5><code class="method">dot(...)</code></h5>
|
|
<p>Return the dot product with another vector</p>
|
|
</div>
|
|
<div class="method">
|
|
<h5><code class="method">magnitude(...)</code></h5>
|
|
<p>Return the length of the vector</p>
|
|
</div>
|
|
<div class="method">
|
|
<h5><code class="method">magnitude_squared(...)</code></h5>
|
|
<p>Return the squared length of the vector</p>
|
|
</div>
|
|
<div class="method">
|
|
<h5><code class="method">normalize(...)</code></h5>
|
|
<p>Return a unit vector in the same direction</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<hr>
|
|
<div class="class-section" id="class-Texture">
|
|
<h3>class <span class="class-name">Texture</span></h3>
|
|
<div class="constructor">
|
|
<pre><code class="language-python">
|
|
Texture(filename)
|
|
</code></pre>
|
|
</div>
|
|
<div class="description">
|
|
<p>Load a texture from file.<br></p>
|
|
</div>
|
|
<div class="arguments">
|
|
<h4>Arguments:</h4>
|
|
<dl>
|
|
<dt><code>filename</code> (<em>str</em>)</dt>
|
|
<dd>Path to image file (PNG/JPG/BMP)</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
<hr>
|
|
<div class="class-section" id="class-Font">
|
|
<h3>class <span class="class-name">Font</span></h3>
|
|
<div class="constructor">
|
|
<pre><code class="language-python">
|
|
Font(filename)
|
|
</code></pre>
|
|
</div>
|
|
<div class="description">
|
|
<p>Load a font from file.<br></p>
|
|
</div>
|
|
<div class="arguments">
|
|
<h4>Arguments:</h4>
|
|
<dl>
|
|
<dt><code>filename</code> (<em>str</em>)</dt>
|
|
<dd>Path to font file (TTF/OTF)</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
<hr>
|
|
<h3 id="other-classes">Other Classes</h3>
|
|
<div class="class-section" id="class-Animation">
|
|
<h3>class <span class="class-name">Animation</span></h3>
|
|
<div class="constructor">
|
|
<pre><code class="language-python">
|
|
Animation(property_name, start_value, end_value, duration, transition="linear", loop=False)
|
|
</code></pre>
|
|
</div>
|
|
<div class="description">
|
|
<p>Animate UI element properties over time.<br></p>
|
|
</div>
|
|
<div class="arguments">
|
|
<h4>Arguments:</h4>
|
|
<dl>
|
|
<dt><code>property_name</code> (<em>str</em>)</dt>
|
|
<dd>Property to animate (e.g., "x", "y", "scale")</dd>
|
|
<dt><code>start_value</code> (<em>float</em>)</dt>
|
|
<dd>Starting value</dd>
|
|
<dt><code>end_value</code> (<em>float</em>)</dt>
|
|
<dd>Ending value</dd>
|
|
<dt><code>duration</code> (<em>float</em>)</dt>
|
|
<dd>Duration in seconds</dd>
|
|
<dt><code>transition</code> (<em>str</em>)</dt>
|
|
<dd>Easing function. Default: "linear"</dd>
|
|
<dt><code>loop</code> (<em>bool</em>)</dt>
|
|
<dd>Whether to loop. Default: False</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="properties">
|
|
<h4>Attributes:</h4>
|
|
<dl>
|
|
<dt><code class="property">current_value</code></dt>
|
|
<dd>Property of Animation</dd>
|
|
<dt><code class="property">elapsed_time</code></dt>
|
|
<dd>Property of Animation</dd>
|
|
<dt><code class="property">is_running</code></dt>
|
|
<dd>Property of Animation</dd>
|
|
<dt><code class="property">is_finished</code></dt>
|
|
<dd>Property of Animation</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="methods">
|
|
<h4>Methods:</h4>
|
|
<div class="method">
|
|
<h5><code class="method">get_current_value()</code></h5>
|
|
<p>Get the current interpolated value.</p>
|
|
<p><strong>Returns:</strong> float: Current animation value</p>
|
|
</div>
|
|
<div class="method">
|
|
<h5><code class="method">start(target)</code></h5>
|
|
<p>Start the animation on a target UI element.</p>
|
|
<p><strong>Arguments:</strong></p>
|
|
<ul>
|
|
<li><code>target</code> (UIDrawable): The element to animate</li>
|
|
</ul>
|
|
</div>
|
|
<div class="method">
|
|
<h5><code class="method">update(...)</code></h5>
|
|
<p>Update the animation by deltaTime (returns True if still running)</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<hr>
|
|
<div class="class-section" id="class-Drawable">
|
|
<h3>class <span class="class-name">Drawable</span></h3>
|
|
<div class="description">
|
|
<p>Base class for all drawable UI elements<br></p>
|
|
</div>
|
|
<div class="methods">
|
|
<h4>Methods:</h4>
|
|
<div class="method">
|
|
<h5><code class="method">get_bounds(...)</code></h5>
|
|
<p>Get bounding box as (x, y, width, height)</p>
|
|
</div>
|
|
<div class="method">
|
|
<h5><code class="method">move(...)</code></h5>
|
|
<p>Move by relative offset (dx, dy)</p>
|
|
</div>
|
|
<div class="method">
|
|
<h5><code class="method">resize(...)</code></h5>
|
|
<p>Resize to new dimensions (width, height)</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<hr>
|
|
<div class="class-section" id="class-GridPoint">
|
|
<h3>class <span class="class-name">GridPoint</span></h3>
|
|
<div class="description">
|
|
<p>Represents a single tile in a Grid.<br></p>
|
|
</div>
|
|
<div class="properties">
|
|
<h4>Attributes:</h4>
|
|
<dl>
|
|
<dt><code class="property">x</code></dt>
|
|
<dd>Property of GridPoint</dd>
|
|
<dt><code class="property">y</code></dt>
|
|
<dd>Property of GridPoint</dd>
|
|
<dt><code class="property">texture_index</code></dt>
|
|
<dd>Property of GridPoint</dd>
|
|
<dt><code class="property">solid</code></dt>
|
|
<dd>Property of GridPoint</dd>
|
|
<dt><code class="property">transparent</code></dt>
|
|
<dd>Property of GridPoint</dd>
|
|
<dt><code class="property">color</code></dt>
|
|
<dd>Property of GridPoint</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
<hr>
|
|
<div class="class-section" id="class-GridPointState">
|
|
<h3>class <span class="class-name">GridPointState</span></h3>
|
|
<div class="description">
|
|
<p>State information for a GridPoint.<br></p>
|
|
</div>
|
|
<div class="properties">
|
|
<h4>Attributes:</h4>
|
|
<dl>
|
|
<dt><code class="property">visible</code></dt>
|
|
<dd>Property of GridPointState</dd>
|
|
<dt><code class="property">discovered</code></dt>
|
|
<dd>Property of GridPointState</dd>
|
|
<dt><code class="property">custom_flags</code></dt>
|
|
<dd>Property of GridPointState</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
<hr>
|
|
<div class="class-section" id="class-Scene">
|
|
<h3>class <span class="class-name">Scene</span></h3>
|
|
<div class="description">
|
|
<p>Base class for object-oriented scenes<br></p>
|
|
</div>
|
|
<div class="methods">
|
|
<h4>Methods:</h4>
|
|
<div class="method">
|
|
<h5><code class="method">activate(...)</code></h5>
|
|
<p>Make this the active scene</p>
|
|
</div>
|
|
<div class="method">
|
|
<h5><code class="method">get_ui(...)</code></h5>
|
|
<p>Get the UI element collection for this scene</p>
|
|
</div>
|
|
<div class="method">
|
|
<h5><code class="method">register_keyboard(...)</code></h5>
|
|
<p>Register a keyboard handler function (alternative to overriding on_keypress)</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<hr>
|
|
<div class="class-section" id="class-Timer">
|
|
<h3>class <span class="class-name">Timer</span></h3>
|
|
<div class="constructor">
|
|
<pre><code class="language-python">
|
|
Timer(name, callback, interval_ms)
|
|
</code></pre>
|
|
</div>
|
|
<div class="description">
|
|
<p>Create a recurring timer.<br></p>
|
|
</div>
|
|
<div class="arguments">
|
|
<h4>Arguments:</h4>
|
|
<dl>
|
|
<dt><code>name</code> (<em>str</em>)</dt>
|
|
<dd>Unique timer identifier</dd>
|
|
<dt><code>callback</code> (<em>callable</em>)</dt>
|
|
<dd>Function to call</dd>
|
|
<dt><code>interval_ms</code> (<em>int</em>)</dt>
|
|
<dd>Interval in milliseconds</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="methods">
|
|
<h4>Methods:</h4>
|
|
<div class="method">
|
|
<h5><code class="method">cancel(...)</code></h5>
|
|
<p>Cancel the timer and remove it from the system</p>
|
|
</div>
|
|
<div class="method">
|
|
<h5><code class="method">pause(...)</code></h5>
|
|
<p>Pause the timer</p>
|
|
</div>
|
|
<div class="method">
|
|
<h5><code class="method">restart(...)</code></h5>
|
|
<p>Restart the timer from the current time</p>
|
|
</div>
|
|
<div class="method">
|
|
<h5><code class="method">resume(...)</code></h5>
|
|
<p>Resume a paused timer</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<hr>
|
|
<div class="class-section" id="class-Window">
|
|
<h3>class <span class="class-name">Window</span></h3>
|
|
<div class="description">
|
|
<p>Window singleton for accessing and modifying the game window properties<br></p>
|
|
</div>
|
|
<div class="methods">
|
|
<h4>Methods:</h4>
|
|
<div class="method">
|
|
<h5><code class="method">center(...)</code></h5>
|
|
<p>Center the window on the screen</p>
|
|
</div>
|
|
<div class="method">
|
|
<h5><code class="method">get(...)</code></h5>
|
|
<p>Get the Window singleton instance</p>
|
|
</div>
|
|
<div class="method">
|
|
<h5><code class="method">screenshot(...)</code></h5>
|
|
<p>Take a screenshot. Pass filename to save to file, or get raw bytes if no filename.</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<hr>
|
|
<h2 id="functions">Functions</h2>
|
|
<h3 id="scene-management">Scene Management</h3>
|
|
<h3 id="audio">Audio</h3>
|
|
<h3 id="ui-utilities">UI Utilities</h3>
|
|
<h3 id="system">System</h3>
|
|
<div class="automation-section">
|
|
<h2 id="automation">Automation Module</h2>
|
|
<p>The <code>mcrfpy.automation</code> module provides testing and automation capabilities for simulating user input and capturing screenshots.</p>
|
|
<div class="function-section">
|
|
<h4><code class="function-signature">automation.click</code></h4>
|
|
<p>Click at position</p>
|
|
</div>
|
|
<div class="function-section">
|
|
<h4><code class="function-signature">automation.doubleClick</code></h4>
|
|
<p>Double click at position</p>
|
|
</div>
|
|
<div class="function-section">
|
|
<h4><code class="function-signature">automation.dragRel</code></h4>
|
|
<p>Drag mouse relative to current position</p>
|
|
</div>
|
|
<div class="function-section">
|
|
<h4><code class="function-signature">automation.dragTo</code></h4>
|
|
<p>Drag mouse to position</p>
|
|
</div>
|
|
<div class="function-section">
|
|
<h4><code class="function-signature">automation.hotkey</code></h4>
|
|
<p>Press a hotkey combination (e.g., hotkey('ctrl', 'c'))</p>
|
|
</div>
|
|
<div class="function-section">
|
|
<h4><code class="function-signature">automation.keyDown</code></h4>
|
|
<p>Press and hold a key</p>
|
|
</div>
|
|
<div class="function-section">
|
|
<h4><code class="function-signature">automation.keyUp</code></h4>
|
|
<p>Release a key</p>
|
|
</div>
|
|
<div class="function-section">
|
|
<h4><code class="function-signature">automation.middleClick</code></h4>
|
|
<p>Middle click at position</p>
|
|
</div>
|
|
<div class="function-section">
|
|
<h4><code class="function-signature">automation.mouseDown</code></h4>
|
|
<p>Press mouse button</p>
|
|
</div>
|
|
<div class="function-section">
|
|
<h4><code class="function-signature">automation.mouseUp</code></h4>
|
|
<p>Release mouse button</p>
|
|
</div>
|
|
<div class="function-section">
|
|
<h4><code class="function-signature">automation.moveRel</code></h4>
|
|
<p>Move mouse relative to current position</p>
|
|
</div>
|
|
<div class="function-section">
|
|
<h4><code class="function-signature">automation.moveTo</code></h4>
|
|
<p>Move mouse to absolute position</p>
|
|
</div>
|
|
<div class="function-section">
|
|
<h4><code class="function-signature">automation.onScreen</code></h4>
|
|
<p>Check if coordinates are within screen bounds</p>
|
|
</div>
|
|
<div class="function-section">
|
|
<h4><code class="function-signature">automation.position</code></h4>
|
|
<p>Get current mouse position as (x, y) tuple</p>
|
|
</div>
|
|
<div class="function-section">
|
|
<h4><code class="function-signature">automation.rightClick</code></h4>
|
|
<p>Right click at position</p>
|
|
</div>
|
|
<div class="function-section">
|
|
<h4><code class="function-signature">automation.screenshot</code></h4>
|
|
<p>Save a screenshot to the specified file</p>
|
|
</div>
|
|
<div class="function-section">
|
|
<h4><code class="function-signature">automation.scroll</code></h4>
|
|
<p>Scroll wheel at position</p>
|
|
</div>
|
|
<div class="function-section">
|
|
<h4><code class="function-signature">automation.size</code></h4>
|
|
<p>Get screen size as (width, height) tuple</p>
|
|
</div>
|
|
<div class="function-section">
|
|
<h4><code class="function-signature">automation.tripleClick</code></h4>
|
|
<p>Triple click at position</p>
|
|
</div>
|
|
<div class="function-section">
|
|
<h4><code class="function-signature">automation.typewrite</code></h4>
|
|
<p>Type text with optional interval between keystrokes</p>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</body>
|
|
</html> |