@blkc-code/render-canvas 0.1.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/draw.d.ts +22 -12
- package/dist/draw.d.ts.map +1 -1
- package/dist/draw.js +374 -273
- package/dist/draw.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/links.d.ts +16 -0
- package/dist/links.d.ts.map +1 -0
- package/dist/links.js +75 -0
- package/dist/links.js.map +1 -0
- package/dist/office.d.ts +25 -2
- package/dist/office.d.ts.map +1 -1
- package/dist/office.js +134 -20
- package/dist/office.js.map +1 -1
- package/dist/pack.d.ts +31 -0
- package/dist/pack.d.ts.map +1 -0
- package/dist/pack.js +10 -0
- package/dist/pack.js.map +1 -0
- package/dist/paint.d.ts +15 -0
- package/dist/paint.d.ts.map +1 -0
- package/dist/paint.js +18 -0
- package/dist/paint.js.map +1 -0
- package/dist/runtime.js +1 -1
- package/dist/runtime.js.map +1 -1
- package/dist/runtime.txt +1 -1
- package/dist/types.d.ts +20 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/world.d.ts +29 -13
- package/dist/world.d.ts.map +1 -1
- package/dist/world.js +150 -72
- package/dist/world.js.map +1 -1
- package/dist/worlds/office-data.d.ts +14 -0
- package/dist/worlds/office-data.d.ts.map +1 -0
- package/dist/worlds/office-data.js +52 -0
- package/dist/worlds/office-data.js.map +1 -0
- package/dist/worlds/office-paint.d.ts +13 -0
- package/dist/worlds/office-paint.d.ts.map +1 -0
- package/dist/worlds/office-paint.js +292 -0
- package/dist/worlds/office-paint.js.map +1 -0
- package/package.json +7 -2
- package/src/draw.ts +352 -272
- package/src/index.ts +4 -1
- package/src/links.ts +76 -0
- package/src/office.ts +142 -21
- package/src/pack.ts +36 -0
- package/src/paint.ts +24 -0
- package/src/runtime.ts +4 -1
- package/src/types.ts +31 -5
- package/src/world.ts +161 -77
- package/src/worlds/office-data.ts +57 -0
- package/src/worlds/office-paint.ts +276 -0
package/dist/draw.d.ts
CHANGED
|
@@ -1,16 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Draws the office. Every piece of art here is original to this project, made
|
|
3
|
-
*
|
|
2
|
+
* Draws the office. Every piece of art here is original to this project, made in code at
|
|
3
|
+
* 16 pixels a tile. The building is drawn once to a layer (drawBuilding); people, screens
|
|
4
|
+
* and anything else that moves are drawn on top each frame (drawWorld).
|
|
4
5
|
*/
|
|
5
|
-
import { type
|
|
6
|
-
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
import { type Ctx, type Palette } from "./paint.js";
|
|
7
|
+
import { type Item, type World } from "./world.js";
|
|
8
|
+
export { TILE, type Palette } from "./paint.js";
|
|
9
|
+
/** How one world looks. The engine draws the building, characters and labels around it. */
|
|
10
|
+
export interface Painter {
|
|
11
|
+
furniture(c: Ctx, item: Item, world: World, time: number, palette: Palette): void;
|
|
12
|
+
/** What lights up at night. Call `glow` for anything that does. */
|
|
13
|
+
glow(item: Item, world: World, glow: (x: number, y: number, radius: number, color: string) => void): void;
|
|
12
14
|
}
|
|
13
|
-
|
|
14
|
-
export
|
|
15
|
-
|
|
15
|
+
export declare function registerPainter(id: string, painter: Painter): void;
|
|
16
|
+
export interface Daylight {
|
|
17
|
+
sky: string;
|
|
18
|
+
sun: string;
|
|
19
|
+
night: number;
|
|
20
|
+
}
|
|
21
|
+
export declare function daylightAt(hour: number): Daylight;
|
|
22
|
+
/** Everything that doesn't move. Redrawn only when the building or the hour changes. */
|
|
23
|
+
export declare function drawBuilding(c: Ctx, world: World, palette: Palette, daylight: Daylight): void;
|
|
24
|
+
/** Everything that moves. `building` is the layer from drawBuilding. */
|
|
25
|
+
export declare function drawWorld(c: Ctx, world: World, time: number, palette: Palette, daylight: Daylight, building: CanvasImageSource | undefined, selected?: string): void;
|
|
16
26
|
//# sourceMappingURL=draw.d.ts.map
|
package/dist/draw.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"draw.d.ts","sourceRoot":"","sources":["../src/draw.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"draw.d.ts","sourceRoot":"","sources":["../src/draw.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAqD,KAAK,GAAG,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AACvG,OAAO,EAAgC,KAAK,IAAI,EAAa,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAG5F,OAAO,EAAE,IAAI,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAIhD,2FAA2F;AAC3F,MAAM,WAAW,OAAO;IACtB,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IAClF,mEAAmE;IACnE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAAC;CAC3G;AAID,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAElE;AAMD,MAAM,WAAW,QAAQ;IAAG,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE;AAErE,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAKjD;AAuUD,wFAAwF;AACxF,wBAAgB,YAAY,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAgB7F;AAoED,wEAAwE;AACxE,wBAAgB,SAAS,CACvB,CAAC,EAAE,GAAG,EACN,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,iBAAiB,GAAG,SAAS,EACvC,QAAQ,CAAC,EAAE,MAAM,GAChB,IAAI,CAgDN"}
|