Tint.zh
Overview
Creator:
Emily
Updated: 31 May 2021
Tags:
2.55,
Library
Downloads: 60
|
Download Script (5.06 KB) |
Information
A handler library, for managing numerous tints, including gradient tint handling.
Description Setup Reviews Comments
Only requires std.zh
3 scripts must be set up:
In a `global script Init`, include a call to `TintZH::tintInit();`
In a `global script onContinue`, include a call to `TintZH::tintOnContinue();`
In your global active script, before Waitdraw(), call `TintZH::runTints()`
To use:
Create a tint palette by calling `TintZH::createTintPalette(r,g,b)`. This returns an index, which is how you will reference the tint from that point on.
To simply toggle these on/off, use `setTint(index, true/false)`. You can check the current state with `tintIsActive(index)`.
`changeBase(int base)` allows you to change between tinted or either monochrome option. (Use the BASE_ constants in the header)
Gradients can be done using `runGradient`, taking either a start RGB and end RGB, or start tint index and end tint index.
DMap tinting: 'tintDMap(int dmap, r, g, b, Base)' to give it a direct tint, or 'tintDMap(int dmap, tintIndex, Base)' to use a tint palette you created with 'createTintPalette()' for the dmap.
Notes:
Tint index 0 is defined as `TINT_GREYSCALE`, with RGB of `0,0,0`. With base BASE_NONE, this is blank, otherwise it will be greyscale.
If you are having issues for any reason, changing the `DEBUG` constant to `true` will cause debug info to be logged.
Further detail is included in the comments prior to each function.
Performance note: When using gradients, updating every frame is recommended for smoothness of gradient, though if you have performance issues with this, you can increase the `GRADIENT_RATE` constant to slow this down.
3 scripts must be set up:
In a `global script Init`, include a call to `TintZH::tintInit();`
In a `global script onContinue`, include a call to `TintZH::tintOnContinue();`
In your global active script, before Waitdraw(), call `TintZH::runTints()`
To use:
Create a tint palette by calling `TintZH::createTintPalette(r,g,b)`. This returns an index, which is how you will reference the tint from that point on.
To simply toggle these on/off, use `setTint(index, true/false)`. You can check the current state with `tintIsActive(index)`.
`changeBase(int base)` allows you to change between tinted or either monochrome option. (Use the BASE_ constants in the header)
Gradients can be done using `runGradient`, taking either a start RGB and end RGB, or start tint index and end tint index.
DMap tinting: 'tintDMap(int dmap, r, g, b, Base)' to give it a direct tint, or 'tintDMap(int dmap, tintIndex, Base)' to use a tint palette you created with 'createTintPalette()' for the dmap.
Notes:
Tint index 0 is defined as `TINT_GREYSCALE`, with RGB of `0,0,0`. With base BASE_NONE, this is blank, otherwise it will be greyscale.
If you are having issues for any reason, changing the `DEBUG` constant to `true` will cause debug info to be logged.
Further detail is included in the comments prior to each function.
Performance note: When using gradients, updating every frame is recommended for smoothness of gradient, though if you have performance issues with this, you can increase the `GRADIENT_RATE` constant to slow this down.


