Skip to content

Commit

Permalink
changes plugin dest directory
Browse files Browse the repository at this point in the history
  • Loading branch information
xharris committed Apr 18, 2020
1 parent 1245974 commit 066f7bc
Show file tree
Hide file tree
Showing 82 changed files with 11,881 additions and 85 deletions.
9 changes: 9 additions & 0 deletions copydeps.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// copies engines, plugins, themes folders to dist folder

const asar = require("asar");
const nwFS = require("fs-extra");

nwFS.ensureDirSync("./dist/engines");
asar.createPackage("./engines/love2d/", "./dist/engines/love2d").then(e => {
console.log(e);
});
38 changes: 19 additions & 19 deletions engines/love2d/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ const nwZIP = require("archiver"); // used for zipping

const re_sprite_props = /(\w+)[=\{\s'"]+([\w\-\.\s]+)[\}\s'",]+?/g;

const requireConf = () => {
const requireConf = (is_exporting) => {
const type = app.projSetting("engine_type");
switch (type) {
case "oop":
return `require "blanke"`;
return `
package.path = "./lua/?/init.lua;./lua/?;" .. package.path
require("${is_exporting ? "lua.blanke" : "blanke"}")
`;

case "ecs":
return `require "lua.ecs"
Expand All @@ -26,16 +29,6 @@ const runConf = () => {
nwFS.writeFileSync(
nwPATH.join(app.getAssetPath("scripts"), "conf.lua"),
`io.stdout:setvbuf('no')
package.path = package.path .. ";${[
"/?.lua",
"/?/init.lua",
"/lua/?/init.lua",
"/lua/?.lua",
"/plugins/?/init.lua",
"/plugins/?.lua",
]
.map(p => app.engine_path + p)
.join(";")}"
${requireConf()}
function love.conf(t)
t.console = true
Expand All @@ -50,7 +43,7 @@ const exportConf = os => {
let resolution = getGameSize(os);
return app.projSetting("write_conf")
? `
${requireConf()}
${requireConf(true)}
${os == "web" ? 'Window.os = "web"' : ""}
function love.conf(t)
${
Expand Down Expand Up @@ -125,9 +118,11 @@ module.exports.settings = {
["web_game_size", "number", { inputs: 2, default: [800, 600] }],
],
get script_path() {
console.log('ok its',app.project_path)
return app.project_path;
},
get plugin_path() {
return nwPATH.join(app.engine_path, 'lua', 'blanke', 'plugins')
},
plugin_info_key: k => `--\s*${k}\s*:\s*(.+)`,
code_associations: [
[/\bEntity\s*\(\s*[\'\"](\w+)[\'\"],\s*/g, "entity"],
Expand Down Expand Up @@ -224,7 +219,6 @@ module.exports.settings = {
},
export_assets: false,
bundle: (dir, target_os, cb_done) => {
// checkOS(target_os);
let love_path = nwPATH.join(dir, app.projSetting("export").name + ".love");
let engine_path = app.engine_path;

Expand All @@ -245,12 +239,18 @@ module.exports.settings = {
const engine_ignore = [];
const eng_type = app.projSetting("engine_type");
if (eng_type === "oop") engine_ignore.push("lua/ecs", "lua/ecs/**/*");
if (eng_type === "ecs") engine_ignore.push("blanke.lua");
if (eng_type === "ecs") engine_ignore.push("lua/blanke.lua");

archive.glob("**/*.lua", {
archive.glob("*.lua", {
cwd: nwPATH.join(engine_path),
ignore: engine_ignore,
});
})
// archive.glob("lua/**/*.lua", {
// cwd: nwPATH.join(engine_path),
// ignore: engine_ignore,
// root: 'wow'
// });
archive.directory(nwPATH.join(engine_path, "lua"), "/lua")

archive.finalize();
},
extra_bundle_assets: {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
25 changes: 13 additions & 12 deletions engines/love2d/blanke.lua → engines/love2d/lua/blanke/init.lua
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
-- TODO Images have their own hitbox instead of entity. Entity just uses the current animations hitbox
-- TODO rework Image to autobatch
-- TODO Blanke.config
local _NAME = ...
math.randomseed(os.time())
local do_profiling = nil -- false/#
local profiling_color = {1,0,0,1}

local bitop = require 'lua.bitop'
local bitop = require(_NAME..'.bitop')
local bit = bitop.bit
local bump = require "lua.bump"
uuid = require "lua.uuid"
json = require "lua.json"
class = require "lua.clasp"
local bump = require(_NAME..".bump")
uuid = require(_NAME..".uuid")
json = require(_NAME..".json")
class = require(_NAME..".clasp")
require(_NAME..".noobhub")
require(_NAME..".print_r")

local socket = require("socket")
callable = function(t)
if t.__ then
for _, mm in ipairs(t) do t['__'..mm] = t.__[mm] end
end
return setmetatable(t, { __call = t.__call })
end
require "lua.print_r"
-- yes, plugins folder is listed twice
love.filesystem.setRequirePath('?.lua;?/init.lua;lua/?/init.lua;lua/?.lua;plugins/?/init.lua;plugins/?.lua;./plugins/?/init.lua;./plugins/?.lua')
--love.filesystem.setRequirePath('?.lua;?/init.lua;lua/?/init.lua;lua/?.lua;plugins/?/init.lua;plugins/?.lua;./plugins/?/init.lua;./plugins/?.lua')

-- is given version greater than or equal to current LoVE version?
local ge_version = function(major, minor, rev)
Expand Down Expand Up @@ -707,7 +711,7 @@ do
-- load plugins
if Game.options.plugins then
for _,f in ipairs(Game.options.plugins) do
table.insert(scripts,'plugins.'..f)
table.insert(scripts,_NAME..'.plugins.'..f)
end
end
-- load scripts
Expand Down Expand Up @@ -2940,9 +2944,6 @@ end
--NET
Net = nil
do
local socket = require "socket"
local uuid = require "lua.uuid"
require "lua.noobhub"
local client
local leader = false
local net_objects = {}
Expand Down Expand Up @@ -3520,7 +3521,7 @@ Signal.emit('__main')

love.load = function()
if do_profiling then
love.profiler = require 'profile'
love.profiler = require(_NAME..'.profile')
end

Blanke.load()
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
65 changes: 65 additions & 0 deletions engines/love2d/lua/blanke/plugins/plugins/cmpl/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
--[[
-------------------------------------------------------------------------------
-- @author Colby Klein
-- @author Landon Manning
-- @copyright 2016
-- @license MIT/X11
-------------------------------------------------------------------------------
.'@@@@@@@@@@@@@@#:
,@@@@#; .'@@@@+
,@@@' .@@@#
+@@+ .... .@@@
;@@; '@@@@@@@@@@@@. @@@
@@# @@@@@@@@++@@@@@@@; `@@;
.@@` @@@@@# #@@@@@ @@@
`@@ @@@@@` Cirno's `@@@@# +@@
@@ `@@@@@ Perfect @@@@@ @@+
@@+ ;@@@@+ Math +@@@@+ @@
@@ `@@@@@ Library @@@@@@ #@'
`@@ @@@@@@ @@@@@@@ `@@
:@@ #@@@@@@. .@@@@@@@@@ @@
.@@ #@@@@@@@@@@@@;;@@@@@ @@
@@ .;+@@#'. ;@@@@@ :@@
@@` +@@@@+ @@.
,@@ @@@@@ .@@
@@# ;;;;;. `@@@@@ @@
@@+ .@@@@@ @@@@@ @@`
#@@ '@@@@@#` ;@@@@@@ ;@@
.@@' @@@@@@@@@@@@@@@ @@#
+@@' '@@@@@@@; @@@
'@@@` '@@@
#@@@; .@@@@:
:@@@@@@@++;;;+#@@@@@@+`
.;'+++++;.
--]]
local modules = (...) and (...):gsub('%.init$', '') .. ".modules." or ""

local cpml = {
_LICENSE = "CPML is distributed under the terms of the MIT license. See LICENSE.md.",
_URL = "https://github.com/excessive/cpml",
_VERSION = "1.2.9",
_DESCRIPTION = "Cirno's Perfect Math Library: Just about everything you need for 3D games. Hopefully."
}

local files = {
"bvh",
"color",
"constants",
"intersect",
"mat4",
"mesh",
"octree",
"quat",
"simplex",
"utils",
"vec2",
"vec3",
"bound2",
"bound3",
}

for _, file in ipairs(files) do
cpml[file] = require(modules .. file)
end

return cpml
Loading

0 comments on commit 066f7bc

Please sign in to comment.