firts interface and elementsgroup imp. + new scenemaster
This commit is contained in:
@@ -1,3 +1,56 @@
|
||||
class GameSelectButton extends ElementsGroup {
|
||||
name;
|
||||
|
||||
x;
|
||||
y;
|
||||
width;
|
||||
height;
|
||||
|
||||
constructor(x,y,w,h,name) {
|
||||
super();
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.width = w;
|
||||
this.height = h;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
load() {
|
||||
var logo = new Rectangle(this.x + 10, this.y + 5, 40, this.height - 5, "rgba(245, 245, 245, 1)");
|
||||
|
||||
var text_name = new Text(this.name ,logo.startX + 50,this.y + 30, "16px serif" , "rgba(190, 32, 32, 1)");
|
||||
|
||||
var background = new Rectangle(this.x,this.y, this.width, this.height, "rgba(26, 32, 29, 1)");
|
||||
|
||||
|
||||
this.addElement(background);
|
||||
|
||||
this.addElement(logo);
|
||||
|
||||
this.addElement(text_name);
|
||||
|
||||
console.log(this.elements);
|
||||
|
||||
|
||||
this.draw_selection = (ctx) => {
|
||||
//background.color = "rgba(214, 0, 221, 1)";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const canvas = document.getElementById("main_window");
|
||||
|
||||
canvas.width = window.innerWidth;
|
||||
@@ -21,15 +74,32 @@ var logo = new Rectangle(10,10,100,100, "rgb(100,200,200)");
|
||||
var separator = new Line(0, 150, windowSize.width, 150 );
|
||||
separator.width = 2;
|
||||
|
||||
|
||||
var game1 = new GameSelectButton(20,200,200,50, "Test 1");
|
||||
|
||||
|
||||
console.log(game1);
|
||||
|
||||
|
||||
|
||||
menu.load = () => {
|
||||
document.addEventListener("keypress" , e => { menu.keypress(e)});
|
||||
menu.user_can_select = true;
|
||||
|
||||
|
||||
|
||||
|
||||
menu.addElement(logo);
|
||||
|
||||
menu.addElement(separator);
|
||||
|
||||
menu.addElement(game1);
|
||||
menu.makeSelectable(game1);
|
||||
menu.addToSelectable(game1, {x:0, y:0});
|
||||
|
||||
menu.select(game1);
|
||||
|
||||
menu.loadAll();
|
||||
/* //rect1 = new Rectangle(70,20,100,100, "green");
|
||||
rect2 = new Rectangle(10,10,50,50, "red");
|
||||
|
||||
@@ -77,6 +147,47 @@ menu.load = () => {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
currentScene.load();
|
||||
function onFrame() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user