Skip to content

Commit

Permalink
add Testbed.start() shortcut
Browse files Browse the repository at this point in the history
  • Loading branch information
shakiba committed Dec 21, 2023
1 parent 4830ce5 commit dc63010
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/util/Testbed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,26 @@ export type ActiveKeys = { [key in KEY]?: boolean };
type TestbedMountOptions = {};

export abstract class Testbed {
/**
* Mount testbed.
*
* If you need to customize testbed before starting, use `Testbed.mount()` and `Testbed.start()` separately.
*/
static mount(options?: TestbedMountOptions): Testbed {
throw new Error('Not implemented');
}

/**
* Start simulation, and mount testbed if needed.
*
* If you need to customize testbed before starting, use `Testbed.mount().start()` separately.
*/
static start(world: World): Testbed {
const testbed = Testbed.mount();
testbed.start(world);
return testbed;
}

/** World viewbox width. */
width: number = 80;

Expand Down

0 comments on commit dc63010

Please sign in to comment.