All files / ts/controller/input/types inputType.ts

100% Statements 10/10
100% Branches 4/4
100% Functions 3/3
100% Lines 10/10

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 311x             1x           24x 1x   23x       248x 1x   247x       41x 41x    
import { NotInitializedException } from "../../../environment/exceptions.js";
import { IEngineCore } from "../../../engineCore.js";
import { IInputReceiver } from "../inputReceiver.js";
 
export interface IInputType {
    initialize(engineCore: IEngineCore, inputReceiver: IInputReceiver): void
}
export class InputType implements IInputType {
 
    private _engineCore?: IEngineCore;
    private _inputReceiver?: IInputReceiver;
 
    protected get engineCore(): IEngineCore {
        if (!this._engineCore) {
            throw new NotInitializedException("EngineCore");
        }
        return this._engineCore;
    }
 
    protected get inputReceiver(): IInputReceiver {
        if (!this._inputReceiver) {
            throw new NotInitializedException("InputReceiver");
        }
        return this._inputReceiver;
    }
 
    public initialize(engineCore: IEngineCore, inputReceiver: IInputReceiver): void {
        this._inputReceiver = inputReceiver;
        this._engineCore = engineCore;
    }
}