Rex's plugins for Construct2
  • Home
  • Map
  • Tutorial/Templates
  • News
  • About

rex_undoredo

Plugin, ACE table, Discussion thread
Dependence: None

Introduction
A data structure to support undo&redo steps/states.

Usage
There are steps (sample capx) or states (sample capx) modes for undo&redo action. It could be set by "Mode" in properties table.
And there are two ways to push data -
  • simple mode : push data directly,
  • dictionary mode : push a dictionary structure.

Simple mode
Push
Call "Action:Push" to push a steps or states into this object. The maximum count of steps/states is set at "Max count" in properties table, 0 is infinite.
In steps mode, it saves the
information of commands for for undo and redo.
In states mode, it saves the execution results.
Undo
Call "Condition:Can undo" to check whether it could undo now, if it could, call "Expression:Undo" to get undo data.
Redo
Call "Condition:Can redo" to check whether it could redo now, if it could, call "Expression:Redo" to get redo data.
Clean
Call "Action:Clean" could clean all saved data of steps/states.

Current step index and step count
Current step index could be got by "Expression:CurIndex". Total step count could be got by "Expression:StepsCnt". 

Dictionary mode
Push
Call "Action:
Set data" to set date with a key into a
dictionary structure. Then call "Action:Push" to push this dictionary into this object.
Undo
Call "
Condition:Can undo" to check whether it could undo now, if it could, call "Action:Undo" to pop data
dictionary , get data by "Expression:CurStep" with a key parameter.
Redo
Call "Condition:Can redo" to check whether it could redo now, if it could, call "
Action:Undo" to
pop data dictionary , get data by "Expression:CurStep" with a key parameter.

Save step/state as command queue
Sample capx
Each step or state could be saved as a command queue, each push command is a function call stored in
rex_fncallpkg plugin. It could save multiple function calls into a string.

Official save&load
Sample capx
Enable save&load with official save&load feature by set "Official save&load" to "Yes".
Set "Official save&load" to "No" will ignore official save&load. It is used for push the saved result of official saving.

Create a free web site with Weebly
  • Home
  • Map
  • Tutorial/Templates
  • News
  • About