FKCoreXR

class FKCoreXR

Main interface for the Predictive Text SDK package

Summary

Methods
void StartFleksySDK(string licenseKey, string licenseSecret, string layout_def="", string language_path="")
Initialise Predictive Text SDK API.
void setListener(FKCoreListener listener)
Sets the prediction listener
void CurrentWordPrediction(string context, int cursorStart, int cursorEnd)
void NextWordPrediction(string context, int cursorStart, int cursorEnd)
void startSwipe()
void sendSwipeTypePoint(float x, float y)
void stopSwipe()

Methods

StartFleksySDK

public void StartFleksySDK(string licenseKey, string licenseSecret, string layout_def="", string language_path="")

Initialise Predictive Text SDK API.

Parameters
string licenseKey Your license key, obtained from the developer portal
string licenseSecret Your license secret, obtained from the developer portal
string layout_def The keyboard layout in json format
string language_path The language file to be used

The layout definition is a json string containing the position of each key (defined by a label and its accents) in the layout shown to the user. By default, FKCoreXR works with a standard key layout and on a keyboard defined in a 320 x 288 rectangle:

[
  {
    "labels":["q","1"],
    "x":16,
    "y":16,
    "width":36,
    "height":32
  }
  ...
]

To define use the language_path argument you should point to a file that must be in Unity’s folder StreamingAssets/encrypted and that, if passed as a parameter, you must just indicate the encrypted folder and the file name.

For example, you must use encrypted/resourceArchive-en-US.jet as a parameter to use the file StreamingAssets/encrypted/resourceArchive-en-US.jet.

setListener

public void setListener(FKCoreListener listener)

Sets the listener that will receive prediction results

Parameters
FKCoreListener listener The FKCoreListener instance that will receive prediction candidates

NextWordPrediction

public void NextWordPrediction(string context, int cursorStart, int cursorEnd)

Ask for the next word prediction in a context sentence at the specified cursor position

Parameters
string context The text context
int cursorStart The starting position of the cursor selection inside the context
int cursorEnd The ending position of the cursor selection inside the context

CurrentWordPrediction

public void CurrentWordPrediction(string context, int cursorStart, int cursorEnd)

Ask for the current word prediction (completions and auto-corretions) in a context sentence at the specified cursor position

Parameters
string context The text context
int cursorStart The starting position of the cursor selection inside the context
int cursorEnd The ending position of the cursor selection inside the context

startSwipe

public void startSwipe()

Starts a swipe typing gesture

sendSwipeTypePoint

public void sendSwipeTypePoint(float x, float y)

Sends swipe point coordinates. It is important to note that we must pass the coordinates of the point in the coordinate space of the keyboard definition currently loaded by FKCoreXR. Remember that by default, it has a 320 x 288 keyboard loaded.

Parameters
float x The x coordinate of the swipe point
float y The y coordinate of the swipe point

stopSwipe

Stops a swipe typing gesture, starting the swipe decoding process

public void stopSwipe()

If something needs to be added or if you find an error in our documentation, please let us know either on our GitHub or Discord.

Last updated on May 22, 2024