NewLevelState = class(Group, function(o)
	Group.init(o)
	if not keyboard then
		keyboard = bludKeyboard(20, 20, 200, 10)
	end
	keyboard:setFontSize(sfontSize)
	keyboard:setText("")
	keyboard:setBgColor(0,0,0,0)
	keyboard:setFontColor(255,0,0,0)
	keyboard:setVisible(true)
	keyboard:setPosition(bludG.camera.w, bludG.camera.h)
	keyboard:setSize(0, 0)
	keyboard:updateOrientation()
	keyboard:openKeyboard()
	o.textBackground = o:add(Button(0,0,bludG.camera.w, 80))
	o.textBackground.sprite = sprites["tiles"]["white.png"]
	o.textBackground.drawType = "stretched"
	o.textBackground.onPress = function()
		if not keyboard:isKeyboardShowing() then
			keyboard:openKeyboard()
		end
	end
	o.textBackground:setLayer(1)
	o.textDisplay = o:add(StringObject(0,0,""))
	o.textDisplay:setColor(0, 0, 0)
	o.textDisplay:setLayer(2)
	o.editButton = o:add(RoundedButton(0,80,200, 80, "Edit"))
	FixButton(o.editButton)
	o.editButton.onPress = function()
		if o.currentText ~= "" then
			mainState:changeState(LayoutState(o.currentText))
			keyboard:setVisible(false)
		end
	end
	o.currentText = ""
	bludG.camera:scrollTo(0,0)
end)
function NewLevelState:update()
	Group.update(self)
	local keyText = keyboard:getText()
	if self.currentText ~= keyText then
		self.textDisplay:setValue(keyText)
		self.currentText = keyText
	end
end
-- lstate = NewLevelState()
-- mainState = WrapperState(Group());
-- mainState:changeState(lstate)
-- bludG.camera:scrollTo(0,0)
-- lstate.keyboard:updateOrientation()
-- lstate.keyboard:setPosition(20, 10)
-- lstate.keyboard:openKeyboard()

-- lstate.keyboard:setBgColor(0,0,0,255)
-- lstate.keyboard:setFontColor(255,0,0,255)
-- lstate.keyboard:setVisible(true)
