CS-Coursework/website/index.js

28 lines
439 B
JavaScript
Raw Normal View History

2022-09-29 15:11:33 +01:00
let canvas;
2022-09-29 16:22:48 +01:00
let textbox;
2022-09-29 15:11:33 +01:00
function setup() {
// Creating the canvas
canvas = new Canvas();
canvas.resize();
canvas.center();
2022-09-29 16:22:48 +01:00
2022-09-29 19:11:20 +01:00
textbox = new Textbox(400, 200, 700);
2022-09-29 15:11:33 +01:00
}
function draw() {
background(255,100,100);
2022-09-29 19:11:20 +01:00
textbox.draw();
}
// whenever a key is pressed this function is called
function keyPressed() {
textbox.letterTyped(key);
2022-09-29 12:12:55 +01:00
}
2022-09-29 15:11:33 +01:00
function windowResized() {
canvas.resize();
canvas.center();
2022-09-29 12:12:55 +01:00
}