Skip to content

Commit 886d5b3

Browse files
committed
[docs] Various docs fixes
1 parent 10a943f commit 886d5b3

File tree

10 files changed

+120
-121
lines changed

10 files changed

+120
-121
lines changed

runtime/src/ceramic/Lazy.hx

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,50 +2,45 @@ package ceramic;
22

33
/**
44
* Interface for implementing lazy initialization of properties in Ceramic classes.
5-
*
5+
*
66
* When a class implements the Lazy interface, properties marked with `@lazy` metadata
77
* will be initialized only when first accessed, not when the object is created.
88
* This can improve performance by deferring expensive computations or object allocations
99
* until they are actually needed.
10-
*
10+
*
1111
* The lazy initialization is implemented through compile-time code generation using
1212
* the LazyMacro build macro, which transforms lazy properties into getter methods
1313
* with initialization logic.
14-
*
14+
*
1515
* Example usage:
1616
* ```haxe
1717
* class MyClass implements Lazy {
18-
*
18+
*
1919
* // This heavy texture atlas will only be loaded when first accessed
2020
* @lazy public var atlas:TextureAtlas = TextureAtlas.fromTexture(heavyTexture);
21-
*
21+
*
2222
* // Expensive computation deferred until needed
2323
* @lazy public var complexData:Array<Float> = computeExpensiveData();
24-
*
25-
* // Can also use lazy initialization with function syntax
26-
* @lazy function expensiveObject():ExpensiveObject {
27-
* trace("Creating expensive object...");
28-
* return new ExpensiveObject();
29-
* }
3024
* }
31-
*
25+
*
3226
* // Usage:
3327
* var obj = new MyClass(); // No lazy properties initialized yet
3428
* var atlas = obj.atlas; // Now the atlas is loaded
3529
* var data = obj.complexData; // Now the data is computed
3630
* ```
37-
*
31+
*
3832
* Benefits:
3933
* - Faster object creation when not all properties are immediately needed
4034
* - Reduced memory usage when some properties may never be accessed
41-
* - Automatic thread-safe initialization (single initialization guaranteed)
35+
* - Automatic initialization (single initialization guaranteed)
4236
* - Clean syntax without manual lazy initialization boilerplate
43-
*
37+
*
4438
* Limitations:
4539
* - Only works with instance properties, not static properties
4640
* - The initialization expression is evaluated in the context of first access
4741
* - Cannot be used with properties that have custom getters/setters
48-
*
42+
* - Not thread safe: should be used on objects that are tied to a single thread
43+
*
4944
* @see ceramic.macros.LazyMacro The macro that implements lazy initialization
5045
*/
5146
#if (!macro && !completion && !display)

runtime/src/ceramic/Visual.hx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,6 +1221,7 @@ class Visual extends #if ceramic_visual_base VisualBase #else Entity #end #if pl
12211221
}
12221222
return clipDirty;
12231223
}
1224+
12241225
/**
12251226
* If set, the visual will be rendered into this target RenderTexture instance
12261227
* instead of being drawn onto screen directly.
@@ -1234,6 +1235,9 @@ class Visual extends #if ceramic_visual_base VisualBase #else Entity #end #if pl
12341235
return renderTarget;
12351236
}
12361237

1238+
/**
1239+
* The blending to use for this visual.
1240+
*/
12371241
public var blending(default,set):Blending = Blending.AUTO;
12381242
function set_blending(blending:Blending):Blending {
12391243
return this.blending = blending;

runtime/src/ceramic/scriptable/ScriptableAlphaColor.hx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,31 @@ package ceramic.scriptable;
33

44
/**
55
* Scriptable wrapper for AlphaColor to expose RGBA color functionality to scripts.
6-
*
6+
*
77
* This class serves as a placeholder that gets mapped to the actual AlphaColor
88
* implementation when used in scripts. It represents RGBA colors stored as a
99
* single integer value, where the alpha channel is combined with RGB values.
10-
*
10+
*
1111
* In scripts, this type is exposed as `AlphaColor` (without the Scriptable prefix)
1212
* and provides the same functionality as ceramic.AlphaColor, including:
1313
* - Creating colors from RGB values and alpha
1414
* - Extracting RGB and alpha components
1515
* - Color manipulation and conversion
16-
*
16+
*
1717
* ## Usage in Scripts
18-
*
19-
* ```hscript
18+
*
19+
* ```haxe
2020
* // Create an opaque red color
2121
* var red = AlphaColor.fromColor(Color.RED);
22-
*
22+
*
2323
* // Create a semi-transparent blue
2424
* var transBlue = AlphaColor.fromColorAndAlpha(Color.BLUE, 0.5);
25-
*
25+
*
2626
* // Extract components
2727
* var rgb = transBlue.color; // Get RGB as Color
2828
* var alpha = transBlue.alpha; // Get alpha value
2929
* ```
30-
*
30+
*
3131
* @see ceramic.AlphaColor The actual implementation
3232
* @see ceramic.scriptable.ScriptableColor For RGB colors without alpha
3333
*/

runtime/src/ceramic/scriptable/ScriptableBlending.hx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,50 +2,50 @@ package ceramic.scriptable;
22

33
/**
44
* Scriptable wrapper for Blending enum to expose blending modes to scripts.
5-
*
5+
*
66
* This class provides constants representing different pixel blending modes
77
* that can be used when rendering visuals. In scripts, this type is exposed
88
* as `Blending` (without the Scriptable prefix).
9-
*
9+
*
1010
* Blending modes control how pixels from a source (the visual being drawn)
1111
* are combined with pixels from the destination (what's already on screen).
12-
*
12+
*
1313
* ## Usage in Scripts
14-
*
15-
* ```hscript
14+
*
15+
* ```haxe
1616
* // Set a visual to use additive blending
1717
* myVisual.blending = Blending.ADD;
18-
*
18+
*
1919
* // Reset to default blending
2020
* myVisual.blending = Blending.AUTO;
2121
* ```
22-
*
22+
*
2323
* ## Available Modes
24-
*
24+
*
2525
* - **AUTO**: Default blending, automatically chosen by Ceramic
2626
* - **PREMULTIPLIED_ALPHA**: Standard premultiplied alpha blending
2727
* - **ADD**: Additive blending (brightens the destination)
2828
* - **ALPHA**: Traditional alpha blending (rarely needed)
2929
* - **SET**: Replace destination pixels without blending
3030
* - **RENDER_TO_TEXTURE**: Special mode for render textures
31-
*
31+
*
3232
* @see ceramic.Blending The actual implementation
3333
* @see ceramic.Visual For setting blending on visuals
3434
*/
3535
class ScriptableBlending {
36-
36+
3737
/**
3838
* Automatic/default blending in ceramic. Internally, this translates to premultiplied alpha blending as textures
3939
* are already transformed for this blending at asset copy phase, except in some situations (render to texture) where
4040
* ceramic may use some more specific blendings as needed.
4141
*/
4242
public static var AUTO:Int = 0;
43-
43+
4444
/**
4545
* Explicit premultiplied alpha blending
4646
*/
4747
public static var PREMULTIPLIED_ALPHA:Int = 1;
48-
48+
4949
/**
5050
* Additive blending
5151
*/
@@ -60,7 +60,7 @@ class ScriptableBlending {
6060
* Blending used by ceramic when rendering to texture.
6161
*/
6262
public static var RENDER_TO_TEXTURE:Int = 5;
63-
63+
6464
/**
6565
* Traditional alpha blending. This should only be used on very specific cases. Used instead of `NORMAL` blending
6666
* when the visual is drawing a RenderTexture.

runtime/src/ceramic/scriptable/ScriptableColor.hx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,54 +2,54 @@ package ceramic.scriptable;
22

33
/**
44
* Scriptable wrapper for Color to expose RGB color functionality to scripts.
5-
*
5+
*
66
* This class provides comprehensive color manipulation features for scripts.
77
* In scripts, this type is exposed as `Color` (without the Scriptable prefix)
88
* and provides the same functionality as ceramic.Color.
9-
*
9+
*
1010
* Colors are represented as integers in RGB format (0xRRGGBB). You can use
1111
* hex values directly or create colors using various color space methods.
12-
*
12+
*
1313
* ## Usage in Scripts
14-
*
15-
* ```hscript
14+
*
15+
* ```haxe
1616
* // Use predefined colors
1717
* var red = Color.RED;
1818
* var blue = Color.BLUE;
19-
*
19+
*
2020
* // Create from hex value
2121
* var purple = 0x9400D3;
22-
*
22+
*
2323
* // Create from RGB values
2424
* var orange = Color.fromRGB(255, 165, 0);
25-
*
25+
*
2626
* // Create from HSB (hue, saturation, brightness)
2727
* var cyan = Color.fromHSB(180, 1.0, 1.0);
28-
*
28+
*
2929
* // Interpolate between colors
3030
* var blend = Color.interpolate(red, blue, 0.5);
31-
*
31+
*
3232
* // Modify colors
3333
* var darkRed = Color.getDarkened(red, 0.3);
3434
* var lightBlue = Color.getLightened(blue, 0.3);
3535
* ```
36-
*
36+
*
3737
* ## Color Spaces
38-
*
38+
*
3939
* - **RGB**: Red, Green, Blue (0-255 per channel)
4040
* - **HSB/HSV**: Hue (0-360°), Saturation (0-1), Brightness/Value (0-1)
4141
* - **HSL**: Hue (0-360°), Saturation (0-1), Lightness (0-1)
4242
* - **CMYK**: Cyan, Magenta, Yellow, Key/Black (0-1 per channel)
4343
* - **HSLuv**: Perceptually uniform color space (if enabled)
44-
*
44+
*
4545
* Note that colors are stored internally as RGB, so repeated conversions
4646
* between color spaces may result in precision loss.
47-
*
47+
*
4848
* @see ceramic.Color The actual implementation
4949
* @see ceramic.scriptable.ScriptableAlphaColor For colors with alpha channel
5050
*/
5151
class ScriptableColor {
52-
52+
5353
public static final NONE:Color = -1;
5454

5555
public static final WHITE:Color = 0xFFFFFF;

runtime/src/ceramic/scriptable/ScriptableFlags.hx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,56 +2,56 @@ package ceramic.scriptable;
22

33
/**
44
* Scriptable wrapper for Flags to expose bit flag operations to scripts.
5-
*
5+
*
66
* This class provides utility methods for working with bit flags, which are
77
* commonly used to store multiple boolean values in a single integer.
88
* In scripts, this type is exposed as `Flags` (without the Scriptable prefix).
9-
*
9+
*
1010
* Bit flags allow efficient storage of up to 32 boolean values in a single
1111
* integer, where each bit position represents a different flag.
12-
*
12+
*
1313
* ## Usage in Scripts
14-
*
15-
* ```hscript
14+
*
15+
* ```haxe
1616
* // Define flag positions as constants
1717
* var FLAG_ACTIVE = 0; // Bit 0
1818
* var FLAG_VISIBLE = 1; // Bit 1
1919
* var FLAG_ENABLED = 2; // Bit 2
20-
*
20+
*
2121
* // Start with no flags set
2222
* var flags = 0;
23-
*
23+
*
2424
* // Set the ACTIVE flag to true
2525
* flags = Flags.setBoolAndGetFlags(flags, FLAG_ACTIVE, true);
26-
*
26+
*
2727
* // Set multiple flags
2828
* flags = Flags.setBoolAndGetFlags(flags, FLAG_VISIBLE, true);
2929
* flags = Flags.setBoolAndGetFlags(flags, FLAG_ENABLED, false);
30-
*
30+
*
3131
* // Check if a flag is set
3232
* if (Flags.getBool(flags, FLAG_ACTIVE)) {
3333
* trace("Object is active");
3434
* }
35-
*
35+
*
3636
* // Toggle a flag
3737
* var isVisible = Flags.getBool(flags, FLAG_VISIBLE);
3838
* flags = Flags.setBoolAndGetFlags(flags, FLAG_VISIBLE, !isVisible);
3939
* ```
40-
*
40+
*
4141
* ## Bit Positions
42-
*
42+
*
4343
* - Bit 0: Rightmost bit, value 1
4444
* - Bit 1: Second bit, value 2
4545
* - Bit 2: Third bit, value 4
4646
* - And so on up to bit 31
47-
*
47+
*
4848
* @see ceramic.Flags The actual implementation
4949
*/
5050
class ScriptableFlags {
5151

5252
/**
5353
* Check if a specific bit flag is set.
54-
*
54+
*
5555
* @param flags The integer containing the bit flags
5656
* @param bit The bit position to check (0-31)
5757
* @return True if the bit is set (1), false if not set (0)
@@ -65,10 +65,10 @@ class ScriptableFlags {
6565

6666
/**
6767
* Set or clear a specific bit flag and return the updated flags value.
68-
*
68+
*
6969
* This method does not modify the input flags parameter, but returns
7070
* a new integer with the specified bit updated.
71-
*
71+
*
7272
* @param flags The integer containing the bit flags
7373
* @param bit The bit position to modify (0-31)
7474
* @param bool True to set the bit (1), false to clear it (0)

0 commit comments

Comments
 (0)