From 4b9349b3f8bee21eb086cfd6e7668532a50e6048 Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Sat, 2 Mar 2024 04:02:20 -0700 Subject: add text on lambda factory --- src/engine/components/Text.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/engine/components/Text.ts (limited to 'src/engine/components/Text.ts') diff --git a/src/engine/components/Text.ts b/src/engine/components/Text.ts new file mode 100644 index 0000000..94dc7a7 --- /dev/null +++ b/src/engine/components/Text.ts @@ -0,0 +1,22 @@ +import { Component, ComponentNames } from "."; + +export class Text extends Component { + public text: string = ""; + public fillStyle: string; + public font: string; + public textAlign: CanvasTextAlign; + + constructor( + text: string, + fillStyle = "white", + font = "25px scientifica", + textAlign: CanvasTextAlign = "center", + ) { + super(ComponentNames.Text); + + this.text = text; + this.fillStyle = fillStyle; + this.font = font; + this.textAlign = textAlign; + } +} -- cgit v1.2.3-70-g09d2