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:
43
main.lua
43
main.lua
@@ -51,7 +51,10 @@ function love.load()
|
||||
require "scene"
|
||||
require "game.vctrl" -- VCTRL
|
||||
|
||||
SCENE = SETTINGS.firstTime and InputConfigScene(true) or TitleScene()
|
||||
SCENE.update = function()
|
||||
SCENE = SETTINGS.firstTime and InputConfigScene(true) or TitleScene()
|
||||
end
|
||||
|
||||
-- VCTRL.toggle(love.system.getOS()=='Android' or true)
|
||||
VCTRL.new{ -- up down left right --- right left down up
|
||||
-- {type='button',x= 100,y=320,key= 'up',r=35,iconSize=60,alpha=0.75},
|
||||
@@ -116,11 +119,11 @@ function love.draw()
|
||||
love.graphics.pop()
|
||||
end
|
||||
|
||||
function love.mousepressed(x, y, b, _, presses)
|
||||
function love.mousepressed(x, y, b, isTouch, presses)
|
||||
local x,y=GLOBAL_TRANSFORM:inverseTransformPoint(x,y)
|
||||
SCENE:onInputPress{type = "mouse", x = x, y = y, button = b, presses = presses}
|
||||
end
|
||||
function love.mousereleased(x,y, b, _, presses)
|
||||
function love.mousereleased(x, y, b, isTouch, presses)
|
||||
local x,y=GLOBAL_TRANSFORM:inverseTransformPoint(x,y)
|
||||
SCENE:onInputRelease{type = "mouse", x = x, y = y, button = b, presses = presses}
|
||||
end
|
||||
@@ -370,11 +373,10 @@ function love.run()
|
||||
end
|
||||
|
||||
function love.errorhandler(msg)
|
||||
local msg = msg or "REV! BÀ ĂN CÁI TỜ TIN NHẮN LỖI RỒI À?!"
|
||||
local showScreenshot = false
|
||||
local errorCopied = false
|
||||
|
||||
-- Reset audio.
|
||||
if love.audio then love.audio.stop() end
|
||||
local enter_fullscreen = SETTINGS and SETTINGS["fullscreen"] or false
|
||||
|
||||
-- Render everything again in a canva
|
||||
love.graphics.origin()
|
||||
@@ -403,13 +405,15 @@ function love.errorhandler(msg)
|
||||
)
|
||||
love.graphics.setCanvas()
|
||||
|
||||
love.audio.stop()
|
||||
|
||||
-- Handling the error
|
||||
local err={"Error:"..msg}
|
||||
local c=2
|
||||
for l in debug.traceback("",2):gmatch("(.-)\n") do
|
||||
if c>2 then
|
||||
if not l:find("boot") then
|
||||
err[c]=l:gsub("^\t*","")
|
||||
err[c]=l:gsub("^\t*","\t")
|
||||
c=c+1
|
||||
end
|
||||
else
|
||||
@@ -434,17 +438,20 @@ function love.errorhandler(msg)
|
||||
drawText([[
|
||||
OH NO! Tromi has crashed.
|
||||
Since this is not the official port, please do not report any bugs to mycophobia.
|
||||
Instead, report this to me via my Discord ``sweetsea`` with a screenshot of this.
|
||||
Instead, report this to me via my Discord ``sweetsea'' with a screenshot of this.
|
||||
|
||||
REMEMBER TO SCREENSHOT BECAUSE ERROR INFO IS NOT SAVED!
|
||||
REMEMBER TO SCREENSHOT ERROR INFO BEFORE QUITTING BECAUSE THEY ARE NOT SAVED!
|
||||
|
||||
Ctrl + C: copy the error info | If you click or tap, a window appear with 4 options:
|
||||
Space : show/hide screenshot | OK: Quit Copy: copy error info
|
||||
Ctrl + C: copy the error info | If you click / tap, a window appears with 4 options:
|
||||
Space : show/hide screenshot | OK : Quit Copy: copy error info
|
||||
Escape : Quit | Cancel: Go back Show: show/hide screenshot
|
||||
]], 20, 10, 620, "left")
|
||||
|
||||
Traceback:]]..(errorCopied and " (Copied to clipboard)" or ""),
|
||||
20, 10, 620, "left")
|
||||
drawText(p, 40, 200, 600, "left")
|
||||
drawText(err[1]:sub(7).."\nTraceback:"..(errorCopied and " (Copied to clipboard)\n" or "\n")..p, 20, 180, 620, "left")
|
||||
else
|
||||
love.graphics.setColor(0, 0, 0, 0.8)
|
||||
love.graphics.rectangle("fill", 15, 450, 400, 25, 5, 5)
|
||||
drawText("Tromi has crashed! Press Space or tap to show error info", 15, 455, 400, "left")
|
||||
end
|
||||
|
||||
love.graphics.present()
|
||||
@@ -471,10 +478,10 @@ Traceback:]]..(errorCopied and " (Copied to clipboard)" or ""),
|
||||
elseif e == "keypressed" and a == "space" then
|
||||
showScreenshot = not showScreenshot
|
||||
elseif e == "keypressed" and a == "f4" then
|
||||
SETTINGS["fullscreen"] = not SETTINGS["fullscreen"]
|
||||
love.window.setFullscreen(SETTINGS["fullscreen"])
|
||||
elseif e == "touchpressed" or e == "mousepressed" then
|
||||
local pressed = love.window.showMessageBox("Quit Tromi?", "Remember to save a copy of screenshot, since they are not saved!", buttons)
|
||||
enter_fullscreen = not enter_fullscreen
|
||||
love.window.setFullscreen(enter_fullscreen)
|
||||
elseif e == "mousepressed" then
|
||||
local pressed = love.window.showMessageBox("Quit? Screenshot? Copy?", "Remember to screenshot error info before quitting because they are not saved!", buttons)
|
||||
if pressed == 1 then
|
||||
return 1
|
||||
elseif pressed == 3 then
|
||||
|
||||
Reference in New Issue
Block a user