Skip to content

Commit

Permalink
Renamed RenderDriver to CoreDriver. (#88)
Browse files Browse the repository at this point in the history
Renamed RenderDriver to CoreDriver
  • Loading branch information
frank-weindel authored Nov 30, 2023
2 parents 75d7acf + 0c367b9 commit 7845b78
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 26 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,14 @@ The Main Core Driver renders your application on the web page's main thread.
It can be configured into the Renderer like so:

```ts
import { MainRenderDriver, RendererMain } from '@lightningjs/renderer';
import { MainCoreDriver, RendererMain } from '@lightningjs/renderer';

const renderer = new RendererMain(
{
// App Config
},
'app', // App div ID
new MainRenderDriver(), // Main Render driver
new MainCoreDriver(), // Main Render driver
);

// ...
Expand All @@ -141,7 +141,7 @@ It can be configured into the Renderer like so:

```ts
import {
ThreadXRenderDriver,
ThreadXCoreDriver,
RendererMain,
} from '@lightningjs/renderer';

Expand All @@ -153,7 +153,7 @@ const renderer = new RendererMain(
// App Config
},
'app', // App div ID
new ThreadXRenderDriver({
new ThreadXCoreDriver({
coreWorkerUrl,
});
);
Expand Down
12 changes: 6 additions & 6 deletions examples/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
*/

import {
MainRenderDriver,
MainCoreDriver,
RendererMain,
ThreadXRenderDriver,
type IRenderDriver,
ThreadXCoreDriver,
type ICoreDriver,
type NodeLoadedPayload,
type RendererMainSettings,
} from '@lightningjs/renderer';
Expand Down Expand Up @@ -145,12 +145,12 @@ async function initRenderer(
driverName: string,
customSettings?: Partial<RendererMainSettings>,
) {
let driver: IRenderDriver | null = null;
let driver: ICoreDriver | null = null;

if (driverName === 'main') {
driver = new MainRenderDriver();
driver = new MainCoreDriver();
} else {
driver = new ThreadXRenderDriver({
driver = new ThreadXCoreDriver({
coreWorkerUrl,
});
}
Expand Down
6 changes: 3 additions & 3 deletions exports/main-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
* @module
*/
export * from '../src/main-api/INode.js';
export * from '../src/main-api/IRenderDriver.js';
export * from '../src/main-api/ICoreDriver.js';
export * from '../src/main-api/RendererMain.js';
export * from '../src/render-drivers/main/MainRenderDriver.js';
export * from '../src/render-drivers/threadx/ThreadXRenderDriver.js';
export * from '../src/render-drivers/main/MainCoreDriver.js';
export * from '../src/render-drivers/threadx/ThreadXCoreDriver.js';
export * from '../src/common/IAnimationController.js';
export * from '../src/common/CommonTypes.js';

Expand Down
4 changes: 2 additions & 2 deletions src/main-api/IRenderDriver.ts → src/main-api/ICoreDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ import type { RendererMain, RendererMainSettings } from './RendererMain.js';
* This interface is to be implemented by Core Drivers
*
* @remarks
* Both the {@link MainRenderDriver} and the {@link ThreadXRenderDriver} exist
* Both the {@link MainCoreDriver} and the {@link ThreadXCoreDriver} exist
* that implement this interface to support both the single-threaded and
* multi-threaded Core modes.
*/
export interface IRenderDriver {
export interface ICoreDriver {
init(
rendererMain: RendererMain,
rendererSettings: Required<RendererMainSettings>,
Expand Down
4 changes: 2 additions & 2 deletions src/main-api/INode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,8 @@ export interface INodeEvents {
* For text rendering, see {@link ITextNode}.
*
* Nodes are represented by an interface since they may be implemented in
* different ways depending on the Core Driver. For example, the MainRenderDriver
* implements it with it's `MainOnlyNode` while the ThreadXRenderDriver implements
* different ways depending on the Core Driver. For example, the MainCoreDriver
* implements it with it's `MainOnlyNode` while the ThreadXCoreDriver implements
* it with it's `ThreadXMainNode`.
*/
export interface INode extends INodeWritableProps, IEventEmitter<INodeEvents> {
Expand Down
10 changes: 5 additions & 5 deletions src/main-api/RendererMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import type {
ITextNode,
ITextNodeWritableProps,
} from './INode.js';
import type { IRenderDriver } from './IRenderDriver.js';
import type { ICoreDriver } from './ICoreDriver.js';
import {
ManualCountTextureUsageTracker,
type ManualCountTextureUsageTrackerOptions,
Expand Down Expand Up @@ -213,7 +213,7 @@ export interface RendererMainSettings {
*
* Example:
* ```ts
* import { RendererMain, MainRenderDriver } from '@lightningjs/renderer';
* import { RendererMain, MainCoreDriver } from '@lightningjs/renderer';
*
* // Initialize the Renderer
* const renderer = new RendererMain(
Expand All @@ -222,13 +222,13 @@ export interface RendererMainSettings {
* appHeight: 1080
* },
* 'app',
* new MainRenderDriver(),
* new MainCoreDriver(),
* );
* ```
*/
export class RendererMain {
readonly root: INode | null = null;
readonly driver: IRenderDriver;
readonly driver: ICoreDriver;
readonly canvas: HTMLCanvasElement;
readonly settings: Readonly<Required<RendererMainSettings>>;
private nodes: Map<number, INode> = new Map();
Expand All @@ -252,7 +252,7 @@ export class RendererMain {
constructor(
settings: RendererMainSettings,
target: string | HTMLElement,
driver: IRenderDriver,
driver: ICoreDriver,
) {
const resolvedSettings: Required<RendererMainSettings> = {
appWidth: settings.appWidth || 1920,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import { assertTruthy } from '../../utils.js';
import type { IRenderDriver } from '../../main-api/IRenderDriver.js';
import type { ICoreDriver } from '../../main-api/ICoreDriver.js';
import type {
INode,
INodeWritableProps,
Expand All @@ -33,7 +33,7 @@ import type {
import { MainOnlyTextNode } from './MainOnlyTextNode.js';
import { loadCoreExtension } from '../utils.js';

export class MainRenderDriver implements IRenderDriver {
export class MainCoreDriver implements ICoreDriver {
private root: MainOnlyNode | null = null;
private stage: Stage | null = null;
private rendererMain: RendererMain | null = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import type {
ITextNodeWritableProps,
} from '../../main-api/INode.js';
import { NodeStruct, type NodeStructWritableProps } from './NodeStruct.js';
import type { IRenderDriver } from '../../main-api/IRenderDriver.js';
import type { ICoreDriver } from '../../main-api/ICoreDriver.js';
import { ThreadXMainNode } from './ThreadXMainNode.js';
import { assertTruthy } from '../../utils.js';
import type {
Expand All @@ -46,7 +46,7 @@ export interface ThreadXRendererSettings {
coreWorkerUrl: string;
}

export class ThreadXRenderDriver implements IRenderDriver {
export class ThreadXCoreDriver implements ICoreDriver {
private settings: ThreadXRendererSettings;
private threadx: ThreadX;
private rendererMain: RendererMain | null = null;
Expand Down

0 comments on commit 7845b78

Please sign in to comment.