From f2e4f563661e5203f0531e37110d060b20b2f04c Mon Sep 17 00:00:00 2001 From: Indrajith K L Date: Mon, 2 Aug 2021 17:10:03 +0530 Subject: * Adds Music Management * Code Refactoring * Adds Fonts --- main.wren | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'main.wren') diff --git a/main.wren b/main.wren index 370860e..9e94aa3 100644 --- a/main.wren +++ b/main.wren @@ -4,31 +4,33 @@ import "graphics" for Canvas, Color import "dome" for Window, Process import "math" for Math import "config" for Config -import "input" for Keyboard import "./controls" for Controls import "./game_state" for GameState -import "./levels/level1" for Level1 +import "./levels/menu" for Menu class Main { construct new() { - Config.setup() - __gameState = GameState.new() - __gameState.switch(Level1) } init() { - + Config.new() + __gameState = GameState.new() + __gameState.switch(Menu) } update() { - if(Controls.detect(Config.KeyboardConstants["QUIT"])) { + if(Controls.isKeyDown(Config.KeyboardConstants["QUIT"])) { Process.exit(0) } + + if(Controls.justPressed(Config.KeyboardConstants["FULLSCREEN"])) { + __gameState.toggleFullscreen() + } __gameState.update() } draw(dt) { - Canvas.cls(Color.pink) + Canvas.cls(Color.black) __gameState.draw(dt) } } -- cgit v1.2.3