inkcpp
|
A handle for an ink runner. More...
#include <inkcpp.h>
Public Types | |
typedef InkValue(* | InkExternalFunction) (int argc, const InkValue argv[]) |
Callback for a Ink external function which returns void. | |
typedef void(* | InkExternalFunctionVoid) (int argc, const InkValue argv[]) |
Callback for a Ink external function wihich returns a value. | |
Public Member Functions | |
void | ink_runner_delete (HInkRunner *self) |
Deconstructs the Runner and all frees assoziated resources. | |
HInkSnapshot * | ink_runner_create_snapshot (const HInkRunner *self) |
Creates a snapshot, for later reloading. | |
int | ink_runner_can_continue (const HInkRunner *self) |
Can the runner continue? | |
const char * | ink_runner_get_line (HInkRunner *self) |
Continue execution until the next newline, then allocate a c-style string with the output. | |
int | ink_runner_num_tags (const HInkRunner *self) |
return the number of current. | |
const char * | ink_runner_tag (const HInkRunner *self, int index) |
access tag. | |
int | ink_runner_num_choices (const HInkRunner *self) |
Returns the number of choices currently available. | |
const HInkChoice * | ink_runner_get_choice (const HInkRunner *self, int index) |
Gets a choice. | |
void | ink_runner_choose (HInkRunner *self, int index) |
Make a choice. | |
void | ink_runner_bind_void (HInkRunner *self, const char *function_name, InkExternalFunctionVoid callback, int lookaheadSafe) |
Binds a external function which is called form the runtime, with no return value. | |
void | ink_runner_bind (HInkRunner *self, const char *function_name, InkExternalFunction callback, int lookaheadSafe) |
Binds a external function which is called from the runtime, with a return vallue. | |
A handle for an ink runner.
An independant runner which can execute ink script from a story independant of other runners. Think of the ink story object like an executable file and the runners as 'threads' (not to be confused with ink threads, which are a language feature). Runners track their own instruction pointer, choice list, temporary variables, callstack, etc. They can either be started with their own globals store, or can share one with other runner instances.
Callback for a Ink external function which returns void.
argc | number of arguments |
argv | array containing the arguments |
typedef void(* InkExternalFunctionVoid) (int argc, const InkValue argv[]) |
Callback for a Ink external function wihich returns a value.
argc | number of arguments |
argv | array contaning the arguments |
void ink_runner_bind | ( | HInkRunner * | self, |
const char * | function_name, | ||
InkExternalFunction | callback, | ||
int | lookaheadSafe ) |
Binds a external function which is called from the runtime, with a return vallue.
self | |
function_name | name of external function declared inside ink script |
callback | |
lookaheadSafe | if false stop glue lookahead if encounter this function this prevents double execution of external functions but can lead to missing glues |
void ink_runner_bind_void | ( | HInkRunner * | self, |
const char * | function_name, | ||
InkExternalFunctionVoid | callback, | ||
int | lookaheadSafe ) |
Binds a external function which is called form the runtime, with no return value.
self | |
function_name | declared in ink script |
callback | |
lookaheadSafe | if false stop glue lookahead if encounter this function this prevents double execution of external functions but can lead to missing glues |
int ink_runner_can_continue | ( | const HInkRunner * | self | ) |
Can the runner continue?
Checks if the runner can continue execution. If it can't, we are either at a choice or are out of content.
void ink_runner_choose | ( | HInkRunner * | self, |
int | index ) |
Make a choice.
Takes the choice at the given index and moves the instruction pointer to that branch.
index | index of the choice to make |
self |
HInkSnapshot * ink_runner_create_snapshot | ( | const HInkRunner * | self | ) |
Creates a snapshot, for later reloading.
const HInkChoice * ink_runner_get_choice | ( | const HInkRunner * | self, |
int | index ) |
Gets a choice.
Returns the choice object at a given index
index | index of the choice to access |
self |
const char * ink_runner_get_line | ( | HInkRunner * | self | ) |
int ink_runner_num_choices | ( | const HInkRunner * | self | ) |
Returns the number of choices currently available.
self |
int ink_runner_num_tags | ( | const HInkRunner * | self | ) |
return the number of current.
The tags will be accumulated since last choice order of tags wont change, and new are added at the end
const char * ink_runner_tag | ( | const HInkRunner * | self, |
int | index ) |
access tag.
index | tag id to fetch [0;num_tags()) |
self |