diff --git a/README.md b/README.md index a5813e66..da55a1ac 100644 --- a/README.md +++ b/README.md @@ -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 ); // ... @@ -141,7 +141,7 @@ It can be configured into the Renderer like so: ```ts import { - ThreadXRenderDriver, + ThreadXCoreDriver, RendererMain, } from '@lightningjs/renderer'; @@ -153,7 +153,7 @@ const renderer = new RendererMain( // App Config }, 'app', // App div ID - new ThreadXRenderDriver({ + new ThreadXCoreDriver({ coreWorkerUrl, }); ); diff --git a/examples/index.ts b/examples/index.ts index 4dbc1b47..a8a324ab 100644 --- a/examples/index.ts +++ b/examples/index.ts @@ -18,10 +18,10 @@ */ import { - MainRenderDriver, + MainCoreDriver, RendererMain, - ThreadXRenderDriver, - type IRenderDriver, + ThreadXCoreDriver, + type ICoreDriver, type NodeLoadedPayload, type RendererMainSettings, } from '@lightningjs/renderer'; @@ -145,12 +145,12 @@ async function initRenderer( driverName: string, customSettings?: Partial, ) { - 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, }); } diff --git a/exports/main-api.ts b/exports/main-api.ts index a7c29392..75f1197c 100644 --- a/exports/main-api.ts +++ b/exports/main-api.ts @@ -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'; diff --git a/src/main-api/IRenderDriver.ts b/src/main-api/ICoreDriver.ts similarity index 93% rename from src/main-api/IRenderDriver.ts rename to src/main-api/ICoreDriver.ts index 29a4db01..6c675014 100644 --- a/src/main-api/IRenderDriver.ts +++ b/src/main-api/ICoreDriver.ts @@ -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, diff --git a/src/main-api/INode.ts b/src/main-api/INode.ts index ce935900..0acbe4c6 100644 --- a/src/main-api/INode.ts +++ b/src/main-api/INode.ts @@ -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 { diff --git a/src/main-api/RendererMain.ts b/src/main-api/RendererMain.ts index a27962bb..4b60d8cd 100644 --- a/src/main-api/RendererMain.ts +++ b/src/main-api/RendererMain.ts @@ -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, @@ -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( @@ -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>; private nodes: Map = new Map(); @@ -252,7 +252,7 @@ export class RendererMain { constructor( settings: RendererMainSettings, target: string | HTMLElement, - driver: IRenderDriver, + driver: ICoreDriver, ) { const resolvedSettings: Required = { appWidth: settings.appWidth || 1920, diff --git a/src/render-drivers/main/MainRenderDriver.ts b/src/render-drivers/main/MainCoreDriver.ts similarity index 96% rename from src/render-drivers/main/MainRenderDriver.ts rename to src/render-drivers/main/MainCoreDriver.ts index f80037d5..3a982a98 100644 --- a/src/render-drivers/main/MainRenderDriver.ts +++ b/src/render-drivers/main/MainCoreDriver.ts @@ -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, @@ -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; diff --git a/src/render-drivers/threadx/ThreadXRenderDriver.ts b/src/render-drivers/threadx/ThreadXCoreDriver.ts similarity index 98% rename from src/render-drivers/threadx/ThreadXRenderDriver.ts rename to src/render-drivers/threadx/ThreadXCoreDriver.ts index a97914dd..7ee064f4 100644 --- a/src/render-drivers/threadx/ThreadXRenderDriver.ts +++ b/src/render-drivers/threadx/ThreadXCoreDriver.ts @@ -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 { @@ -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;