mirror of
https://gitea.com/SweetSea-ButImNotSweet/tromi_mobile.git
synced 2025-01-08 17:33:09 +08:00
Main file changed a bit
This commit is contained in:
59
main.lua
59
main.lua
@@ -1,25 +1,15 @@
|
||||
require 'funcs'
|
||||
-- savedir = love.filesystem.getSaveDirectory()
|
||||
-- if love.system.getOS() == 'Windows' then
|
||||
-- local test_for_separator = string.find(savedir, '/')
|
||||
-- if test_for_separator ~= nil then savedir = table.concat(split_string(savedir, '/'), '\\') end
|
||||
-- savedir = savedir..'\\saves\\'
|
||||
-- configfile = savedir..'config.sav'
|
||||
-- replaydir = savedir..'replays\\'
|
||||
-- hiscorefile = savedir..'hiscores.sav'
|
||||
-- else
|
||||
-- savedir = savedir..'/saves/'
|
||||
-- configfile = savedir..'config.sav'
|
||||
-- replaydir = savedir..'replays/'
|
||||
-- hiscorefile = savedir..'hiscores.sav'
|
||||
-- end
|
||||
SAVE_DIR = '/saves/'
|
||||
CONFIG_FILE = 'config.sav'
|
||||
REPLAY_DIR = 'replays/'
|
||||
HIscoreFILE = 'hiscores.sav'
|
||||
DEBUG_showKey=true
|
||||
|
||||
PENTO_MODE = false
|
||||
|
||||
SAVE_DIR = 'saves/'
|
||||
REPLAY_DIR = 'saves/replays/'
|
||||
if not love.filesystem.exists(REPLAY_DIR) then
|
||||
love.filesystem.createDirectory(REPLAY_DIR)
|
||||
end
|
||||
CONFIG_FILE = 'config.sav'
|
||||
HIscoreFILE = 'hiscores.sav'
|
||||
|
||||
function love.load()
|
||||
math.randomseed(os.time())
|
||||
@@ -31,12 +21,9 @@ function love.load()
|
||||
require "load.bigint"
|
||||
loadSave()
|
||||
require "scene"
|
||||
|
||||
love.window.setMode(love.graphics.getWidth(), love.graphics.getHeight(), {resizable = true});
|
||||
|
||||
|
||||
love.mouse.setVisible(false)
|
||||
love.keyboard.setKeyRepeat(true)
|
||||
love.keyboard.setTextInput(true)
|
||||
love.window.setMode(love.graphics.getWidth(), love.graphics.getHeight(), {resizable = true});
|
||||
|
||||
-- used for screenshots
|
||||
GLOBAL_CANVAS = love.graphics.newCanvas()
|
||||
@@ -66,7 +53,9 @@ function love.draw()
|
||||
scene:render()
|
||||
love.graphics.pop()
|
||||
|
||||
drawText("Pressed: "..(lastPressedKey or '[NONE]').." | Released key: "..(lastReleasedKey or '[NONE]'),0,0,1000,"left")
|
||||
if DEBUG_showKey then
|
||||
drawText("Pressed: "..(LastPressedKey or '[NONE]').." | Released: "..(LastReleasedKey or '[NONE]'),0,0,1000,"left")
|
||||
end
|
||||
|
||||
love.graphics.setCanvas()
|
||||
love.graphics.setColor(1,1,1,1)
|
||||
@@ -97,14 +86,14 @@ function love.keypressed(key, scancode)
|
||||
scene:onInputPress({input=input_pressed, type="key", key=key, scancode=scancode})
|
||||
end
|
||||
|
||||
lastPressedKey = input_pressed or scancode
|
||||
LastPressedKey = input_pressed or scancode
|
||||
end
|
||||
|
||||
function love.keyreleased(key, scancode)
|
||||
local input_released = nil
|
||||
|
||||
-- escape is reserved for menu_back
|
||||
if scancode == "escape" then
|
||||
if scancode == "escape" or scancode=='acback' then
|
||||
scene:onInputRelease({input="menu_back", type="key", key=key, scancode=scancode})
|
||||
-- function keys are reserved
|
||||
elseif string.match(scancode, "^f[1-9]$") or string.match(scancode, "^f[1-9][0-9]+$") then
|
||||
@@ -117,7 +106,7 @@ function love.keyreleased(key, scancode)
|
||||
scene:onInputRelease({input=input_released, type="key", key=key, scancode=scancode})
|
||||
end
|
||||
|
||||
lastReleasedKey = input_released or scancode
|
||||
LastReleasedKey = input_released or scancode
|
||||
end
|
||||
|
||||
function love.joystickpressed(joystick, button)
|
||||
@@ -171,7 +160,7 @@ function love.joystickaxis(joystick, axis, value)
|
||||
end
|
||||
end
|
||||
|
||||
function love.touchPressed()
|
||||
function love.touchpressed()
|
||||
love.keyboard.setKeyRepeat(true)
|
||||
love.keyboard.setTextInput(false)
|
||||
love.keyboard.setTextInput(true)
|
||||
@@ -303,19 +292,19 @@ function love.run()
|
||||
end
|
||||
end
|
||||
|
||||
minos = {'R_d', 'O_d', 'Y_d', 'G_d', 'C_d', 'B_d', 'M_d'}
|
||||
main_bg_grid = {}
|
||||
local minos = {'R_d', 'O_d', 'Y_d', 'G_d', 'C_d', 'B_d', 'M_d'}
|
||||
local main_bg_grid = {}
|
||||
for x=1, 40 do
|
||||
main_bg_grid[x] = {}
|
||||
for y=1, 30 do
|
||||
main_bg_grid[x][y] = 0
|
||||
end
|
||||
end
|
||||
main_bg_cur_pos = {20,6}
|
||||
main_bg_cur_color = minos[love.math.random(1,7)]
|
||||
main_bg_cur_mino = 1
|
||||
main_bg_draw_frame = 0
|
||||
main_bg_last_color = nil
|
||||
local main_bg_cur_pos = {20,6}
|
||||
local main_bg_cur_color = minos[love.math.random(1,7)]
|
||||
local main_bg_cur_mino = 1
|
||||
local main_bg_draw_frame = 0
|
||||
local main_bg_last_color = nil
|
||||
|
||||
function mainBackground()
|
||||
if config["music"] and not sounds["bgm_title"]:isPlaying() then
|
||||
|
||||
Reference in New Issue
Block a user