Created
March 17, 2020 12:52
-
-
Save EngineerSmith/9fb2c243c8ae4317c149a98365eb7294 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local PATH = ....."." | |
| local dirPATH = PATH:gsub("%.","/") | |
| local helium = require("Lib.helium") | |
| local lg = love.graphics | |
| local function resize(element, w, h) | |
| if element.anchor then | |
| local v = element.view | |
| v.x, v.y, v.w, v.h = element.anchor:getRect(w, h) | |
| end | |
| end | |
| local newElement = function(file) | |
| local factory | |
| if helium.conf.HOTSWAP then | |
| factory = helium.loader.loader(dirPATH..file..".lua") | |
| else | |
| factory = helium(require(PATH..file)) | |
| end | |
| return function(anchor, param) | |
| local element = factory(param) | |
| element.anchor = anchor | |
| element.resize = resize | |
| element:resize(lg.getDimensions()) | |
| return element | |
| end | |
| end | |
| local gui = {} | |
| gui.anchor = require("Scripts.Ui.anchor") | |
| gui.button = newElement("button") | |
| gui.progressBar = newElement("progressBar") | |
| gui.image = newElement("image") | |
| return gui |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment