mirror of
https://gitea.com/SweetSea-ButImNotSweet/tromi_mobile.git
synced 2025-01-08 17:33:09 +08:00
Update
This commit is contained in:
@@ -1,11 +1,22 @@
|
||||
local NameEntryScene = SCENE:extend()
|
||||
NameEntryScene.title = "Game Start"
|
||||
|
||||
local buttonList = {
|
||||
BUTTON.new{
|
||||
text = "<\nCHAR", font = FONT_big,
|
||||
x = 40, y = 160, w = 70, h = 70,
|
||||
},
|
||||
BUTTON.new{
|
||||
text = ">\nCHAR", font = FONT_big,
|
||||
x = 130, y = 160, w = 70, h = 70,
|
||||
}
|
||||
}
|
||||
|
||||
local Grid = require 'game.grid'
|
||||
local bitser = require 'libs.bitser'
|
||||
|
||||
function NameEntryScene:new()
|
||||
self.chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890."
|
||||
self.hars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890."
|
||||
self.char_pos = 1
|
||||
self.name_entry = {'A','A','A'}
|
||||
self.entry_pos = 1
|
||||
@@ -48,6 +59,8 @@ end
|
||||
|
||||
function NameEntryScene:render()
|
||||
MainBackground()
|
||||
BUTTON.draw(buttonList)
|
||||
|
||||
love.graphics.setColor(1, 1, 1, 1)
|
||||
love.graphics.line(216,80,216,80+(16*self.grid.height))
|
||||
love.graphics.line(216+(16*self.grid.width),80,216+(16*self.grid.width),80+(16*self.grid.height))
|
||||
@@ -108,8 +121,16 @@ function NameEntryScene:update()
|
||||
self.entry_chars = self.name_entry[1]..self.name_entry[2]..self.name_entry[3]
|
||||
end
|
||||
|
||||
function NameEntryScene:onInputMove(e)
|
||||
if e.type == "mouse" then
|
||||
BUTTON.checkHovering(buttonList, e.x, e.y)
|
||||
end
|
||||
end
|
||||
|
||||
function NameEntryScene:onInputPress(e)
|
||||
if e.input == "menu_decide" or e.input == "rotate_left" or e.scancode == "return" then
|
||||
if e.type == "mouse" or e.type == "touch" then
|
||||
BUTTON.press(buttonList, e.x, e.y)
|
||||
elseif e.input == "menu_decide" or e.input == "rotate_left" or e.scancode == "return" then
|
||||
self.delete_confirm = false
|
||||
self.delete_input_count = 0
|
||||
if self.entry_pos == 4 then
|
||||
@@ -177,7 +198,11 @@ function NameEntryScene:onInputPress(e)
|
||||
end
|
||||
|
||||
function NameEntryScene:onInputRelease(e)
|
||||
if e.input == "left" or e.scancode == "left" or e.input == "right" or e.scancode == "right" then
|
||||
if e.type == "mouse" then
|
||||
BUTTON.release(buttonList, e.x, e.y)
|
||||
elseif e.type == "touch" then
|
||||
BUTTON.release(buttonList, e.x, e.y, true)
|
||||
elseif e.input == "left" or e.scancode == "left" or e.input == "right" or e.scancode == "right" then
|
||||
self.direction = nil
|
||||
self.repeat_counter = self.repeat_limit-1
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user