From 84278ed41f61c586dbb38dd99c45ee33e2f58c77 Mon Sep 17 00:00:00 2001 From: Aki Date: Thu, 16 Mar 2017 19:05:50 +0100 Subject: Moved ? -> not.?; Renamed Player -> Hero --- main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'main.lua') diff --git a/main.lua b/main.lua index deff1a1..bbcf0e0 100644 --- a/main.lua +++ b/main.lua @@ -34,7 +34,7 @@ function newImage(path) end -- Require -require "world" +require "not.World" require "camera" require "menu" require "controller" -- cgit v1.1 From 340a3a4b92de5495b47e8e1e102178edfd97514f Mon Sep 17 00:00:00 2001 From: Aki Date: Sun, 19 Mar 2017 00:21:02 +0100 Subject: Night commit, added PhysicalBody, newImage to sprite --- main.lua | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'main.lua') diff --git a/main.lua b/main.lua index bbcf0e0..9180ebf 100644 --- a/main.lua +++ b/main.lua @@ -18,20 +18,6 @@ end function getRealScale() return math.max(1, math.max(love.graphics.getWidth() / 320, love.graphics.getHeight() / 180)) end --- Should be moved to Sprite metaclass (non-existent yet) -function newImage(path) - local imagedata = love.image.newImageData(path) - local transparency = function(x, y, r, g, b, a) - if (r == 0 and g == 128 and b == 64) or - (r == 0 and g == 240 and b == 6) then - a = 0 - end - return r, g, b, a - end - imagedata:mapPixel(transparency) - local image = love.graphics.newImage(imagedata) - return image -end -- Require require "not.World" -- cgit v1.1 From 2e352657813b37d17c2215b85189f18a50c099f9 Mon Sep 17 00:00:00 2001 From: Aki Date: Sun, 19 Mar 2017 03:29:32 +0100 Subject: Comments, todos, pretty useless --- main.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'main.lua') diff --git a/main.lua b/main.lua index 9180ebf..b985648 100644 --- a/main.lua +++ b/main.lua @@ -1,8 +1,11 @@ -- "NOTNAUTS" -- WHOLE CODE HAS FLAG OF "need a cleanup" +-- TODO: Any lua source file in root directory that is not `main` (this file), `conf` should be moved to a proper directory. Its name should be changed to show what it contains. + -- Pretend you didn't see this -- This is work for scene manager +-- TODO: Create SceneManager or similar class. Scene = nil function changeScene(scene) if Scene ~= nil then @@ -12,6 +15,7 @@ function changeScene(scene) end -- Should be moved to scene/camera +-- TODO: move following functions to `Camera`. function getScale() return math.max(1, math.floor(math.max(love.graphics.getWidth() / 320, love.graphics.getHeight() / 180))) end -- cgit v1.1 From 4cf1755d05a63452feca03d2e380b149fcaa76c2 Mon Sep 17 00:00:00 2001 From: Aki Date: Thu, 6 Apr 2017 18:40:27 +0200 Subject: Moved music.lua, cleaned-up its code; Fixed requires for main, World and Menu --- main.lua | 1 - 1 file changed, 1 deletion(-) (limited to 'main.lua') diff --git a/main.lua b/main.lua index b985648..bdee6a3 100644 --- a/main.lua +++ b/main.lua @@ -28,7 +28,6 @@ require "not.World" require "camera" require "menu" require "controller" -require "music" require "settings" -- Temporary debug -- cgit v1.1 From 93d3257ff23331c308fb32940557911a29ca608b Mon Sep 17 00:00:00 2001 From: Aki Date: Thu, 6 Apr 2017 19:22:26 +0200 Subject: Menu cleaned-up and moved to /not/ Menu is now similar to new code Menu.load => Menu.open --- main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'main.lua') diff --git a/main.lua b/main.lua index bdee6a3..eed787f 100644 --- a/main.lua +++ b/main.lua @@ -26,7 +26,7 @@ end -- Require require "not.World" require "camera" -require "menu" +require "not.Menu" require "controller" require "settings" -- cgit v1.1 From a013d70115171764ce0941fbbe18a5447447a7eb Mon Sep 17 00:00:00 2001 From: Aki Date: Thu, 6 Apr 2017 19:59:51 +0200 Subject: Settings moved to /not/, cleaned-up a bit --- main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'main.lua') diff --git a/main.lua b/main.lua index eed787f..7e1232e 100644 --- a/main.lua +++ b/main.lua @@ -28,7 +28,7 @@ require "not.World" require "camera" require "not.Menu" require "controller" -require "settings" +require "not.Settings" -- Temporary debug debug = false -- cgit v1.1 From 33b3a93138a9eee40727e9f56373b434ceab1cef Mon Sep 17 00:00:00 2001 From: Aki Date: Thu, 6 Apr 2017 20:03:17 +0200 Subject: Controller moved to /not/ and cleaned-up a bit. --- main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'main.lua') diff --git a/main.lua b/main.lua index 7e1232e..b905de6 100644 --- a/main.lua +++ b/main.lua @@ -27,7 +27,7 @@ end require "not.World" require "camera" require "not.Menu" -require "controller" +require "not.Controller" require "not.Settings" -- Temporary debug -- cgit v1.1 From e9396447537e0c6dedfb55e9a7ffc1e99575d860 Mon Sep 17 00:00:00 2001 From: Aki Date: Thu, 6 Apr 2017 20:06:12 +0200 Subject: Camera moved to /not/ and cleaned-up a bit --- main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'main.lua') diff --git a/main.lua b/main.lua index b905de6..05eb9e2 100644 --- a/main.lua +++ b/main.lua @@ -25,7 +25,7 @@ end -- Require require "not.World" -require "camera" +require "not.Camera" require "not.Menu" require "not.Controller" require "not.Settings" -- cgit v1.1 From 612a14474c9d3c28b6512aef4845e52579d7d9c9 Mon Sep 17 00:00:00 2001 From: Aki Date: Fri, 7 Apr 2017 05:15:23 +0200 Subject: Clean-up main.lua a little bit --- main.lua | 51 ++++++++++++++++++++++----------------------------- 1 file changed, 22 insertions(+), 29 deletions(-) (limited to 'main.lua') diff --git a/main.lua b/main.lua index 05eb9e2..0c20b34 100644 --- a/main.lua +++ b/main.lua @@ -1,13 +1,11 @@ --- "NOTNAUTS" --- WHOLE CODE HAS FLAG OF "need a cleanup" - +--- Roflnauts 2 -- TODO: Any lua source file in root directory that is not `main` (this file), `conf` should be moved to a proper directory. Its name should be changed to show what it contains. -- Pretend you didn't see this -- This is work for scene manager -- TODO: Create SceneManager or similar class. Scene = nil -function changeScene(scene) +function changeScene (scene) if Scene ~= nil then Scene:delete() end @@ -16,10 +14,11 @@ end -- Should be moved to scene/camera -- TODO: move following functions to `Camera`. -function getScale() +function getScale () return math.max(1, math.floor(math.max(love.graphics.getWidth() / 320, love.graphics.getHeight() / 180))) end -function getRealScale() + +function getRealScale () return math.max(1, math.max(love.graphics.getWidth() / 320, love.graphics.getHeight() / 180)) end @@ -34,25 +33,20 @@ require "not.Settings" debug = false -- LÖVE2D callbacks -function love.load() - -- Graphics +function love.load () love.graphics.setBackgroundColor(90, 90, 90) love.graphics.setDefaultFilter("nearest", "nearest") - -- Font + -- TODO: Move fonts somewhere else out of global scope. Font = love.graphics.newImageFont("assets/font-normal.png", " 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.,:;-_/\\!@#$%^&*?=+~`|'\"()[]{}<>", -1) Bold = love.graphics.newImageFont("assets/font-big.png", " 0123456789AEFILNORSTUW", -2) Font:setLineHeight(9/16) - love.graphics.setFont(Font) - -- Modules + love.graphics.setFont(Font) Controller.load() Settings.load() - -- Scene Scene = Menu:new() end -function love.update(dt) - Scene:update(dt) -end -function love.draw() + +function love.draw () Scene:draw() if debug then local scale = getScale() @@ -63,21 +57,20 @@ function love.draw() love.graphics.print("Current FPS: "..tostring(love.timer.getFPS()), 10, 10+9*scale, 0, scale, scale) end end -function love.quit() - Settings.save() -end + +function love.update (dt) Scene:update(dt) end +function love.quit () Settings.save() end + -- Pass input to Controller -function love.gamepadaxis(joystick, axis, value) Controller.gamepadaxis(joystick, axis, value) end -function love.gamepadpressed(joystick, key) Controller.gamepadpressed(joystick, key) end -function love.gamepadreleased(joystick, key) Controller.gamepadreleased(joystick, key) end -function love.keypressed(key) Controller.keypressed(key) end -function love.keyreleased(key) Controller.keyreleased(key) end +function love.gamepadaxis (joystick, axis, value) Controller.gamepadaxis(joystick, axis, value) end +function love.gamepadpressed (joystick, key) Controller.gamepadpressed(joystick, key) end +function love.gamepadreleased (joystick, key) Controller.gamepadreleased(joystick, key) end +function love.keypressed (key) Controller.keypressed(key) end +function love.keyreleased (key) Controller.keyreleased(key) end -- Controller callbacks -function Controller.controlpressed(set, action, key) - -- pass to current Scene +function Controller.controlpressed (set, action, key) Scene:controlpressed(set, action, key) - -- globals if key == "escape" then love.event.quit() end @@ -85,7 +78,7 @@ function Controller.controlpressed(set, action, key) debug = not debug end end -function Controller.controlreleased(set, action, key) - -- pass to current Scene + +function Controller.controlreleased (set, action, key) Scene:controlreleased(set, action, key) end \ No newline at end of file -- cgit v1.1 From 1c3040de93f9d5a164ccb06194eacc28eead0234 Mon Sep 17 00:00:00 2001 From: Aki Date: Fri, 7 Apr 2017 21:05:41 +0200 Subject: Maps and nauts list moved to config Implemented functions to create icons list for them Changed so game uses these functions now --- main.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'main.lua') diff --git a/main.lua b/main.lua index 0c20b34..11e4d95 100644 --- a/main.lua +++ b/main.lua @@ -23,6 +23,7 @@ function getRealScale () end -- Require +require "iconsList" require "not.World" require "not.Camera" require "not.Menu" -- cgit v1.1