diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2023-12-06 20:14:24 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2023-12-06 20:14:24 -0800 |
commit | 01a26cad5f0abcd9aeb010ba91d33bcdb570256f (patch) | |
tree | d6b306fba9af6bd27f89e142fa557798205ad710 /main.lua | |
parent | fa778f95a17f5050cff52330576e51955bcb4e1d (diff) | |
download | lines.love-01a26cad5f0abcd9aeb010ba91d33bcdb570256f.tar.gz |
redo version checks
This is still ugly, but hopefully easier to follow.
Diffstat (limited to 'main.lua')
-rw-r--r-- | main.lua | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/main.lua b/main.lua index 034953e..af53451 100644 --- a/main.lua +++ b/main.lua @@ -72,24 +72,10 @@ function App.load() end end -function App.version_check() - -- available modes: run, error - Error_message = nil - Error_count = 0 - -- we'll reuse error mode on load for an initial version check - local supported_versions = {'11.5', '11.4', '12.0'} -- put the recommended version first - local minor_version - Major_version, minor_version = love.getVersion() - Version = Major_version..'.'..minor_version - if array.find(supported_versions, Version) == nil then - Current_app = 'error' - Error_message = ("This app doesn't support version %s; please use version %s. Press any key to try it with this version anyway."):format(Version, supported_versions[1]) - print(Error_message) - -- continue initializing everything; hopefully we won't have errors during initialization - end -end - function App.initialize_globals() + Supported_versions = {'11.5', '11.4', '12.0'} -- put the recommended version first + check_love_version_for_tests() + if Current_app == 'run' then run.initialize_globals() elseif Current_app == 'source' then @@ -105,6 +91,23 @@ function App.initialize_globals() Last_resize_time = 0 end +function check_love_version_for_tests() + if array.find(Supported_versions, Version) == nil then + Unsupported_version = true + -- warning to include in an error message if any tests failed + Warning_before_tests = ("This app hasn't been tested with LÖVE version %s."):format(Version) + end +end + +function App.love_version_check() + if Unsupported_version then + Current_app = 'error' + Error_message = ("This app hasn't been tested with LÖVE version %s; please switch to version %s if you run into issues. Press any key to continue."):format(Version, Supported_versions[1]) + print(Error_message) + -- continue initializing everything; hopefully we won't have errors during initialization + end +end + function App.initialize(arg) love.keyboard.setTextInput(true) -- bring up keyboard on touch screen love.keyboard.setKeyRepeat(true) |