Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/core/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
import { Color, Camera2D, Camera3D } from './types';

export type { Color, Vec2, Vec3, Vec4, Rect, Camera2D, Camera3D, Texture, Font, Sound, Music, Quat, Ray, BoundingBox, Model, Mat4, RayHit, FrustumPlanes } from './types';
export { Color, ColorConstants, Colors } from './colors';
// GH #53 — `Color` is deliberately NOT re-exported from './colors' any more.
// `Color` is the RGBA TYPE (`./types`, re-exported above); './colors' exports a
// palette MAP that also happened to be called `Color`, so the name arrived at
// every consumer as both a type and a value. It shadowed the thing people
// actually annotate with. The palette has always had two other names —
// `Colors` and `ColorConstants` (the latter is literally `= Color`) — so
// nothing is lost by dropping the third.
//
// Verified before removing: no code in engine, shooter, editor, garden or jump
// reads the palette through the name `Color` (i.e. `Color.Red`). `jump` imports
// `Color` from here, but only ever in TYPE position (`const WHITE: Color = {...}`),
// which the type re-export above still serves.
export { ColorConstants, Colors } from './colors';
export { Key, MouseButton } from './keys';

// FFI declarations
Expand Down
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ export {
openFileDialog, saveFileDialog,
writeFile, fileExists, readFile,
getScreenToWorld2D, getWorldToScreen2D,
Color, ColorConstants, Colors, Key, MouseButton,
// `Color` is not here: it is the RGBA type, re-exported as a type below.
// The palette map is `Colors` / `ColorConstants` (GH #53).
ColorConstants, Colors, Key, MouseButton,
injectKeyDown, injectKeyUp, isAnyInputPressed, getPlatform, isMobile, isTV, Platform,
injectGamepadAxis, injectGamepadButtonDown, injectGamepadButtonUp,
runGame,
Expand Down
Loading