local ConfigScene = SCENE:extend() ConfigScene.title = "Input Config" local menu_screens = { KeyConfigScene, StickConfigScene, TouchConfigScene } function ConfigScene:new(first_time) self.menu_state = 1 if first_time then self.first_time = true else self.first_time = false end end function ConfigScene:update() end function ConfigScene:render() MainBackground() if not self.first_time then drawText("Which controls do you want to configure?", 80, 70, 1000) else drawText("Thanks for playing Tromi!", 80, 40, 1000) drawText("Please begin by configuring your controls:", 80, 70, 1000) end love.graphics.setColor(1, 1, 1, 0.5) love.graphics.rectangle("fill", 75, 118 + 50 * self.menu_state, 400, 35) love.graphics.setColor(1, 1, 1, 1) for i, screen in pairs(menu_screens) do drawText(screen.title, 80, 120 + 50 * i, 400, "left") end end function ConfigScene:changeOption(rel) local len = #menu_screens self.menu_state = (self.menu_state + len + rel - 1) % len + 1 end function ConfigScene:onInputPress(e) if e.input == "menu_decide" or e.input == "rotate_left" or e.scancode == "return" then SCENE = menu_screens[self.menu_state]() elseif e.input == "up" or e.scancode == "up" then self:changeOption(-1) elseif e.input == "down" or e.scancode == "down" then self:changeOption(1) elseif not SETTINGS.firstTime and ( e.input == "menu_back" or e.input == "rotate_right" or e.scancode == "backspace" or e.scancode == "delete" ) then SCENE = TitleScene() end end return ConfigScene