Skip to main content

Clock

Clock

This is a clock tool which allows users to create an input which can change constanly bewteen 1 and 0 within a required frequency.


Constructor

public Clock

new Clock()

Constructs a clock object intialed with 1000ms frequency, input of 1 and 2D display of size 60*42. Clock objects will start with 1 and change input to 0 or 1 every 1000ms. Moreover, the constructor will call reset() function once.


Properties

No publicly accessible properties on Clock


Methods

protected onTick

onTick() => void

This fucntion will set isOn to its opposite value, true to false or false to true, and create inputs changing to 1 or 0 constanly.

public reset

reset() => void

This function will be called after constructing a clock object, which intially set the clock off and call for onTick() function to turn on the clock.

public getOffset

getOffset() => Vector

Get size of offset needed.

Returns

  •   Vector – An empty vector.

public getDisplayName

getDisplayName() => string

Gets the display name of clock input.

Returns

  •   string – The display name of "Clock".

public getImageName

getImageName() => string

Gets the name of the clock image file.

Returns

  •   string – The name of the clock image file.

Static Methods

No static methods for Clock