samengine 1.7.3 → 1.7.4
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/build/index.js +1 -1
- package/dist/types/button.d.ts +2 -1
- package/dist/types/button.js +1 -3
- package/package.json +1 -1
package/dist/build/index.js
CHANGED
package/dist/types/button.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Rect } from "./rectangle.js";
|
|
2
|
+
import { Mouse } from "../input.js";
|
|
2
3
|
export type Button = {
|
|
3
4
|
form: Rect;
|
|
4
5
|
text: string;
|
|
5
6
|
};
|
|
6
7
|
export declare function makeButton(form: Rect, text: string): Button;
|
|
7
|
-
export declare function clickedButton(btn: Button): boolean;
|
|
8
|
+
export declare function clickedButton(btn: Button, mouse: Mouse): boolean;
|
|
8
9
|
export declare function drawButton(btn: Button, ctx: CanvasRenderingContext2D, color?: string, textColor?: string, font?: string): void;
|
package/dist/types/button.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// Button
|
|
2
|
-
import { getMouse } from "../input.js";
|
|
3
2
|
import { isRectClicked } from "./rectangle.js";
|
|
4
3
|
import { drawRect } from "../renderer.js";
|
|
5
4
|
import { renderText } from "../renderer.js";
|
|
@@ -11,8 +10,7 @@ export function makeButton(form, text) {
|
|
|
11
10
|
};
|
|
12
11
|
}
|
|
13
12
|
// Prüft, ob der Button geklickt wurde
|
|
14
|
-
export function clickedButton(btn) {
|
|
15
|
-
const mouse = getMouse();
|
|
13
|
+
export function clickedButton(btn, mouse) {
|
|
16
14
|
return isRectClicked(mouse, btn.form);
|
|
17
15
|
}
|
|
18
16
|
// Zeichnet den Button (Rechteck + Text)
|