feat(modules): make modules loadable directly from core object
This commit is contained in:
parent
c339129566
commit
e40ea3cfab
2 changed files with 36 additions and 1 deletions
|
@ -35,13 +35,14 @@ utils = require(cwd .. "utils")
|
||||||
local CoreSystem = Object:extend()
|
local CoreSystem = Object:extend()
|
||||||
|
|
||||||
local DebugSystem = require(cwd .. "debug")
|
local DebugSystem = require(cwd .. "debug")
|
||||||
|
|
||||||
local Options = require(cwd .. "options")
|
local Options = require(cwd .. "options")
|
||||||
local Input = require(cwd .. "input")
|
local Input = require(cwd .. "input")
|
||||||
local Screen = require(cwd .. "screen")
|
local Screen = require(cwd .. "screen")
|
||||||
local Lang = require(cwd .. "lang")
|
local Lang = require(cwd .. "lang")
|
||||||
local SceneManager = require(cwd .. "scenemanager")
|
local SceneManager = require(cwd .. "scenemanager")
|
||||||
|
|
||||||
|
local modules = require(cwd .. "modules")
|
||||||
|
|
||||||
require(cwd .. "callbacks")
|
require(cwd .. "callbacks")
|
||||||
|
|
||||||
-- INIT FUNCTIONS
|
-- INIT FUNCTIONS
|
||||||
|
@ -54,6 +55,8 @@ function CoreSystem:new(DEBUGMODE)
|
||||||
self.screen = Screen(self)
|
self.screen = Screen(self)
|
||||||
self.scenemanager = SceneManager(self)
|
self.scenemanager = SceneManager(self)
|
||||||
self.lang = Lang(self)
|
self.lang = Lang(self)
|
||||||
|
|
||||||
|
self.modules = modules
|
||||||
end
|
end
|
||||||
|
|
||||||
function CoreSystem:registerGameSystem(gamesystem)
|
function CoreSystem:registerGameSystem(gamesystem)
|
||||||
|
|
32
gamecore/modules/init.lua
Normal file
32
gamecore/modules/init.lua
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
-- modules : different modules that are usable as part of gamecore
|
||||||
|
|
||||||
|
--[[
|
||||||
|
Copyright © 2019 Kazhnuz
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
]]
|
||||||
|
|
||||||
|
local modules = {}
|
||||||
|
|
||||||
|
local cwd = (...):gsub('%.init$', '') .. "."
|
||||||
|
|
||||||
|
modules.Assets = require(cwd .. "assets")
|
||||||
|
modules.GameSystem = require(cwd .. "gamesystem")
|
||||||
|
modules.MenuSystem = require(cwd .. "menusystem")
|
||||||
|
|
||||||
|
return modules
|
Loading…
Reference in a new issue