From f028d9d4fe93b09e4a483a22907057c9e18f4e76 Mon Sep 17 00:00:00 2001 From: Logen Kain Date: Wed, 5 Jul 2017 07:22:58 -0700 Subject: [PATCH] love:mike moved function into it's own library; moved libs to lib folder --- love/mike/{ => lib}/Tserial.lua | 0 love/mike/lib/functions.lua | 14 ++++++++++++++ love/mike/{ => lib}/keys.lua | 2 +- love/mike/main.lua | 18 ++---------------- 4 files changed, 17 insertions(+), 17 deletions(-) rename love/mike/{ => lib}/Tserial.lua (100%) create mode 100644 love/mike/lib/functions.lua rename love/mike/{ => lib}/keys.lua (97%) diff --git a/love/mike/Tserial.lua b/love/mike/lib/Tserial.lua similarity index 100% rename from love/mike/Tserial.lua rename to love/mike/lib/Tserial.lua diff --git a/love/mike/lib/functions.lua b/love/mike/lib/functions.lua new file mode 100644 index 0000000..e71878b --- /dev/null +++ b/love/mike/lib/functions.lua @@ -0,0 +1,14 @@ +function col_detect(object, display) + if not (object.x >= -1 and + object.x <= (display.width - object.width)) then + return false + end + + if not (object.y >= -1 and + object.y <= (display.height - object.height)) then + return false + end + + return true +end + diff --git a/love/mike/keys.lua b/love/mike/lib/keys.lua similarity index 97% rename from love/mike/keys.lua rename to love/mike/lib/keys.lua index 9b49219..07d1de8 100644 --- a/love/mike/keys.lua +++ b/love/mike/lib/keys.lua @@ -1,4 +1,4 @@ -require "Tserial" +require "lib/Tserial" function love.keyreleased(key) if key == "q" then diff --git a/love/mike/main.lua b/love/mike/main.lua index 0b66f30..29b034a 100644 --- a/love/mike/main.lua +++ b/love/mike/main.lua @@ -1,19 +1,5 @@ -require "keys" - --- Make this more functional. It shouldn't depend on global state. -function col_detect(object, display) - if not (object.x >= -1 and - object.x <= (display.width - object.width)) then - return false - end - - if not (object.y >= -1 and - object.y <= (display.height - object.height)) then - return false - end - - return true -end +require "lib/keys" +require "lib/functions" function love.load() saveFile = "test.lua"