import { BabyShape, BabyGraph } from './babything'; import { BabyGUI } from './babyGUI'; import { BabyCamera } from './babything'; import { BabyEngine } from '../middle/babyengine'; /** @ignore */ export declare type Observer = (msg?: object) => void; /** Creates an array of n elements, 0,1,2... */ export declare let range: (start: number, stop?: number, step?: number) => any[]; /** generates iterable stream of numbers, use this to replace for(let i=0; i< n; i++) */ export declare function numbers(first: number, max?: number, step?: number): Generator; /** For many games, `Baby()` is the only class you need to import. * * ```ts * import { Baby } from 'Baby' * app = new Baby() // create an instance of Baby

* ``` * @remarks * * * Then create the objects and events you need with methods like: * * ```ts * floor = app.floor(20,20) // lay down a floor * cube = app.shape('cube').color('red') // add a red cube * * // hook the keyboard, and move the cube on each keypress * app.keydown((data)=>{ cube.move('right',1) }) * ``` * *

That's a pretty simple game, but it runs just fine. We * explain it in the 'Getting Started' tutorial. */ export declare class Baby { /** @ignore */ runUnittests: boolean; /** @ignore */ onSignal: Function; /** @ignore */ babyEngine: BabyEngine; /** @ignore */ observers: { [type: string]: Observer[]; }; /** @ignore */ uuidValue: number; /** Origin is an invisible non-colliding shape at the origin (0,0,0). * @remarks * It is so frequently necessary to find the origin point (the center of * the floor where new shapes are instantiated) that we * added an invisible cube there for you. You could have done it yourself * with the following line of code. * ```ts * const origin = this.shape('cube').opacity(0, 0) // make invisible in zero time * ``` */ origin: BabyShape; /** Start here. `Baby()` is the only class you need to import. * * ```ts * import { Baby } from 'wherever' * app = new Baby() // create an instance of the Baby engine. * ``` * * The optional parameter sends code to the game. It's only intended for writing tutorials. */ constructor(src?: string); numberAt(text: string, x: number, y: number, color: string): Promise; graphTest(): Promise; version(): string; /** @ignore */ signal(msg: string, value?: number): void; /** freezes the scene while keeping the engine running; expecially useful with the inspector. * @remarks * ``` * Add a button to freeze your sceen: * let frozen = false * app.GUI('button') * .position('BottomLeft') * .text('Freeze') * .onClick(() => { * app.freeze(!frozen) * frozen = !frozen; * }) * ``` */ freeze(onOff?: boolean): Baby; /** trap keydown, look at the data object for ctrl-, alt-, etc */ keydown(keyFunction: Function): Baby; /** trap keypress, look at the data object for ctrl-, alt-, etc */ keypress(keyFunction: Function): Baby; /** trap keyup, look at the data object for ctrl-, alt-, etc */ keyup(keyFunction: Function): Baby; multiPlayer(): Baby; /** Create an 'Shape', which is a single graphic element. `Baby.Shape('Cube') is the same as calling `Baby.Cube()`, * but not all shapes have direct calls and you can add new shapes. * The standard shapes are cube, sphere, cylinder, cone, torus, capsule, point, and floor. */ shape(model: string): BabyShape; /** Create a Cube (which you can resize into a cuboid) */ cube(): BabyShape; /** Create a Sphere (which you can resize into an spheroid */ sphere(): BabyShape; /** Create a Cylinder */ cylinder(): BabyShape; /** Create a Cone (strictly speaking, an cone is a cylinder) */ cone(): BabyShape; /** Create a Capsule */ capsule(): BabyShape; /** Create a Torus */ torus(): BabyShape; /** Create a Point (think of a sphere that is too small to see) */ point(): BabyShape; /** Create a terminal plane modelled on the classic VT52 terminal. * Underneath, it's really a cube, with a pair of prints functions. * * We DETACH the camera controls from the canvas when you create a VT52 * because that's almost always right. If you want to use the controls * then simply turn them back on AFTER you create the VT52 instance * eg: app.activeCameraControls(true) */ VT52(): BabyShape; /** Create a 2D Graph plane. Underneath, it's really a cube of size x * y). * To create the grid, use `let g = app.Graph(20,16).drawGrid() * * We DETACH the camera controls from the canvas * because that's almost always right. If you want to use the controls * then simply turn them back on AFTER you create the Graph instance * eg: app.activeCameraControls(true) */ Graph(x: number, y: number): BabyGraph; importShape(directory: string, filename: string): BabyShape; /** Add a floor object with a default grid. Use .collide('solid') if you want to bounce off it. */ floor(xSize: number, ySize: number, major?: number): BabyShape; /** A 'camera' defines the player, a multi-player game may have multiple cameras. * This is the default 3D camera, look at `OrthoCamera` for 2D */ camera(): BabyCamera; /** Turn on the BabylonJS Inspector. Only for player0. * only valid parameter at this point is 'record', which captures the first 7 seconds of your game in video */ inspector(stringParm?: string): Baby; /** random integer between min (includes) and max (excludes). so randomIntBetween(2,5) might return 2,3, or 4, but not 5. */ randomIntBetween(min: number, max: number): number; /** Create a 'Button'. */ GUI(model: 'button'): BabyGUI; /** dispose of the scene, releasing all meshes, animations, etc */ dispose(): void; /** attach or detach the current camera controls from the canvas */ activeCameraControls(on: boolean): void; }