Skip to content
Snippets Groups Projects
Commit d96e9e93 authored by Bye's avatar Bye
Browse files

Button

parent 80bd199b
Branches
No related tags found
No related merge requests found
File added
src/img/2024-07-30 09.58.25.jpg

50.7 KiB

src/img/button.webp

52 B

import Canvas from "../../hampsterengine/src/canvas.js";
import Engine from "../../hampsterengine/src/engine.js";
import {Room} from "../../hampsterengine/src/things";
import {Room} from "../../hampsterengine/src/things.js";
import {Logo, MainMenuButton} from "./objects";
import {Logo, MainMenuButton} from "./objects.js";
const canvas = new Canvas('canvas');
const engine = new Engine(canvas);
......@@ -11,6 +11,7 @@ const assets = engine.assetStore;
canvas.width = 640;
canvas.height = 480;
canvas.pixelRatio = 2;
canvas.ctx.setTransform(canvas.pixelRatio, 0, 0, canvas.pixelRatio, 0, 0);
canvas.ctx.imageSmoothingEnabled = false;
......@@ -48,4 +49,5 @@ function main() {
}
engine.room = engine.getRoomIndex('mainMenu');
if (document.location.hash) engine.room = engine.getRoomIndex(document.location.hash);
main();
import {Thing} from "../../hampsterengine/src/things";
import ButtonBKG from "../img/button.webp";
export class Button extends Thing {
constructor(props) {
super(props);
this.sprite = ButtonBKG;
}
}
export class MainMenuButton extends Thing {
constructor(label, action=function(){}) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment