2021-06-26 22:02:00 +02:00
|
|
|
// SPDX-FileCopyrightText: 2021 Johannes Loher
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
|
2021-03-14 19:04:28 +01:00
|
|
|
export function getCanvas(): Canvas {
|
|
|
|
if (!(canvas instanceof Canvas) || !canvas.ready) {
|
2021-07-07 19:22:35 +02:00
|
|
|
throw new Error(getGame().i18n.localize("DS4.ErrorCanvasIsNotInitialized"));
|
2021-03-14 19:04:28 +01:00
|
|
|
}
|
|
|
|
return canvas;
|
|
|
|
}
|
2021-07-07 19:22:35 +02:00
|
|
|
|
|
|
|
export function getGame(): Game {
|
|
|
|
if (!(game instanceof Game)) {
|
|
|
|
throw new Error("Game is not initialized yet."); // Cannot localize this as we would need to access game to do this.
|
|
|
|
}
|
|
|
|
return game;
|
|
|
|
}
|