summaryrefslogtreecommitdiff
path: root/src/engine.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine.js')
-rw-r--r--src/engine.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/engine.js b/src/engine.js
new file mode 100644
index 0000000..a7bb8a5
--- /dev/null
+++ b/src/engine.js
@@ -0,0 +1,34 @@
+import { start, update, draw } from "./main.js"
+import { Screen } from "./engine/screen.js"
+import { keys, setUpKeyboard } from "./engine/keyboard.js"
+import { startClock } from "./engine/clock.js"
+
+export class Engine {
+ static frame = 0
+ static audio
+ static screen = new Screen()
+ static keys = keys
+ static bgm
+
+ static startEngine() {
+ setUpKeyboard()
+ start()
+
+ startClock()
+ }
+
+ static updateEngine() {
+ update()
+ draw()
+ }
+
+ static playSound(file) {
+ let audio = new Audio(file)
+ audio.play()
+ }
+
+ static playMusic(file) {
+ this.bgm = new Audio(file)
+ this.bgm.play()
+ }
+}