(5.5.0) scribble_cache_group_flush - JujuAdams/ScribbleOldDocs GitHub Wiki

scribble_cache_group_flush(cacheGroup)

Returns: N/A (0)

Argument Name Purpose
0 cacheGroup Cache group to flush

Scribble uses cache groups to help manage memory. Scribble text that has been added to a cache group will be automatically destroyed if one of two things happens:

  1. scribble_cache_group_flush() has been called targetting the text's cache group
  2. The text has not been drawn for a period of time (SCRIBBLE_CACHE_TIMEOUT milliseconds)

By default, all Scribble data is put into the same cache group, defined by the macro SCRIBBLE_DEFAULT_CACHE_GROUP. Using scribble_draw_set_cache_group, you can specify a different cache group to manage memory more easily (e.g. one cache group for dialogue, another for an inventory screen).

Setting the macro SCRIBBLE_CACHE_TIMEOUT to 0 stops text from being flushed if it hasn't been drawn for a while; instead, you'll need to manually call scribble_cache_group_flush(), targetting the relevant cache group.

If you're manually creating text elements by calling scribble_draw() directly, you can choose to opt out of using any cache. By setting the cacheGroup argument to undefined, Scribble will skip adding the data to the cache. However, this means that the data you create will not be automatically destroyed. To free memory you will have to call scribble_cache_group_flush() manually, using the Scribble text element as the argument.