|
| 1 | +import {NativeAdapter} from "./lib/adapter/native.adapter.class"; |
| 2 | +import {OpenCVAdapter} from "./lib/adapter/opencv.adapter.class"; |
| 3 | +import {Config} from "./lib/config.class"; |
| 4 | +import {Keyboard} from "./lib/keyboard.class"; |
| 5 | +import {Mouse} from "./lib/mouse.class"; |
| 6 | +import {Movement} from "./lib/movement.class"; |
| 7 | +import {NativeProviderEnum} from "./lib/provider/native/native.provider.enum"; |
| 8 | +import {RobotJsNativeProvider} from "./lib/provider/native/robot-js.provider.class"; |
| 9 | +import {OpenCVProviderEnum} from "./lib/provider/opencv/opencv.provider.enum"; |
| 10 | +import {OpenCV4NodeJSVisionProvider} from "./lib/provider/opencv/opencv4nodejs.provider.class"; |
| 11 | +import {Screen} from "./lib/screen.class"; |
| 12 | +import {Bresenham} from "./lib/util/bresenham.class"; |
| 13 | +import {LineHelper} from "./lib/util/linehelper.class"; |
| 14 | + |
| 15 | +export {Config} from "./lib/config.class"; |
| 16 | +export {Image} from "./lib/image.class"; |
| 17 | +export {Location} from "./lib/location.class"; |
| 18 | +export {LocationParameters} from "./lib/locationparameters.class"; |
| 19 | +export {Movement} from "./lib/movement.class"; |
| 20 | +export {MovementType} from "./lib/movementtype.class"; |
| 21 | +export {Point} from "./lib/point.class"; |
| 22 | +export {Region} from "./lib/region.class"; |
| 23 | + |
| 24 | +export class Nut { |
| 25 | + public readonly screen: Screen; |
| 26 | + public readonly keyboard: Keyboard; |
| 27 | + public readonly mouse: Mouse; |
| 28 | + public readonly movement: Movement; |
| 29 | + private readonly screenActions: OpenCVAdapter; |
| 30 | + private readonly nativeActions: NativeAdapter; |
| 31 | + |
| 32 | + constructor(public config: Config) { |
| 33 | + switch (config.openCVProvider) { |
| 34 | + case OpenCVProviderEnum.OPENCV4NODEJS: |
| 35 | + default: |
| 36 | + this.screenActions = new OpenCVAdapter(new OpenCV4NodeJSVisionProvider()); |
| 37 | + break; |
| 38 | + } |
| 39 | + switch (config.nativeProvider) { |
| 40 | + case NativeProviderEnum.ROBOT_JS: |
| 41 | + default: |
| 42 | + this.nativeActions = new NativeAdapter(new RobotJsNativeProvider()); |
| 43 | + break; |
| 44 | + } |
| 45 | + this.screen = new Screen(this.config, this.screenActions, this.nativeActions); |
| 46 | + this.keyboard = new Keyboard(); |
| 47 | + this.mouse = new Mouse(this.config, this.nativeActions); |
| 48 | + this.movement = new Movement(this.nativeActions, new LineHelper(new Bresenham())); |
| 49 | + } |
| 50 | +} |
0 commit comments