Control Freak

m

Preset

(sample)

type

TouchController

GeneralSettings

Layout

???

Draw debug region

Individual debug rendering switch.

Sticks

(Dynamic)

Dynamic Mode

When in dynamic mode, stick is excluded from layout.

In Editor, while not playing, all dynamic sticks are positioned at the center of their Dynamic Stick Screen Region.

Dynamic Clamp

This will keep out stick fully inside our work area (and offset by margin specified below). situation like that - user touches just at the left edge of the area (which is also an edge of the screen). With clamping disabled, dynamic stick will be centered at the touch position and the player will lose ability to move the stick to the left, because moving the finger any further left and off the screen will terminate the touch. clamping enabled, stick's center will be placed in a safe distance from the edge (see Dynamic Margin).

Dynamic Stick Screen Region

Define dynamic stick's work-area - normalized screen region where stick can be placed.

pos

x

y

rectRegion = % of screen

Width

Height

Always Reset

Always reset dynamic stick's origin to touched position, even when pressed on still visible stick.

Fade-out duration

Dynamic stick's fade-out animation duration in seconds.

Stick Pos Mode

(analog)

FULL_ANALOG

ANALOG_8WAY

ANALOG_4WAY

(digital)

DIGITAL_8WAY

DIGITAL_4WAY

Hat Move Scale

Control how the hat center will follow controlling finger.

TouchZones

(Debug)

HELP

Stick

>>Button

(config)

bool

(code)

(query)

(state)

Pressed ()

JustPressed ()

JustReleased ()

(digital)

TouchStick.GetPrevDigitalDir(bool eightWayMode = true)

// Get previous frame's digital direction.

TouchStick.GetDigitalDir(bool eightWayMode)

// Get current digital direction.

TouchStick.DigitalJustChanged(bool eightWayMode)

// Return true if digital direction just changed.

Get Position at Runtime

touchzone

this.touchCtrl.GetZone(ZONE_EXIT).SetRect(new Rect(5, 5 + 32 + 10, 32,32));

touchstick

hat

stick_attackStick.GetHatDisplayRect(true)

true == scale bool

base

stick_attackStick.GetBaseDisplayRect(true)

Get direction if set to 4/8 way digital or analog

GetVecEx()

Vector2 TouchStick.GetVecEx(StickPosMode vis)

Get stick's current vector in specified mode.

HIde and Show TouchZone

r

// -------------void ShowZone(string name, bool show) { if (CFInput.ctrl == null) return; TouchZone zone = CFInput.ctrl.GetZone(name); if (show) zone.Show(); else zone.Hide(); }// -----------void Update() { if (CFInput.GetButtonDown("Start")) // "Start" is the GetButton() name assigned to the 'Start' zone { OnGameStart(); } // (...) }// ---------------void OnGameStart() { ShowZone("Start", false); // (...) }// ---------------void OnGameOver() { ShowZone("Start", true); // (...) }

TouchZone zone = CFInput.ctrl.GetZone(name);

zone.Show();

zone.Hide();

UFE

a

CFInput

static

public

TouchController

ctrl

// can be used to turn off touch

AnimTimer

Scripts

TouchableControl

MonoBehaviour

TouchController

enum

TouchCoordSys

SCREEN_PX

///< pixels, relative to screen's top-left corner

SCREEN_NORMALIZED

///< normalized screen coordinates - (0,0) in the top-left, (1,1) in the bottom-right corn

SCREEN_CM

///< centimeters, relative to screen's top-left corner

SCREEN_INCH

///< inches, relative to screen's top-left corner

LOCAL_PX

///< pixels, relative to control rectangle's top-left corner

LOCAL_NORMALIZED

///< control's normalized coords, relative to control rectangle's top-left corner

LOCAL_CM

///< centimeters, relative to control rectangle's top-left corner

LOCAL_INCH

///< inches, relative to control rectangle's top-left corner

ImagesGUI

Sample

Buttons

Debug

Sticks

Input Wrapper

CFInput

static

public