Skip to content

Commit

Permalink
Add Icon for Dane Launcher,
Browse files Browse the repository at this point in the history
Improve Icon for Dane
add dane_arwes module
  • Loading branch information
OmegaRogue committed Dec 9, 2020
1 parent dbf68a8 commit 3a36580
Show file tree
Hide file tree
Showing 6 changed files with 122 additions and 4 deletions.
3 changes: 2 additions & 1 deletion apps.json
Original file line number Diff line number Diff line change
Expand Up @@ -1522,7 +1522,8 @@
],
"storage": [
{"name":"dane_tcr.app.js","url":"app.js"},
{"name":"dane_tcr.settings.js","url":"settings.js"}
{"name":"dane_tcr.settings.js","url":"settings.js"},
{"name": "dane_tcr.img", "url": "app-icon.js", "evaluate": true}
],
"sortorder" : -10
},
Expand Down
2 changes: 1 addition & 1 deletion apps/dane/app-icon.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion apps/dane/app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var d = require("https://raw.githubusercontent.com/OmegaVoid/EspruinoDocs/master/modules/dane_arwes.js");
var d = require("dane_arwes");
var Arwes = d.default();


Expand Down
1 change: 1 addition & 0 deletions apps/dane_tcr/app-icon.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion core
Submodule core updated 1 files
+1 −4 js/appinfo.js
116 changes: 116 additions & 0 deletions modules/dane_arwes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
/* Copyright (c) 2020 OmegaRogue. See the file LICENSE for copying permission. */
/*
Graphics Functions based on the React Sci-Fi UI Framework Arwes
*/

var C = {
cornerSize: 14, // description
cornerOffset: 3, // description
borderWidth: 1 // description
};

function Arwes(cornerSize, cornerOffset) {
this.cornerSize = cornerSize;
this.cornerOffset = cornerOffset;
}


/** 'public' constants here */
Arwes.prototype.C = {
color: {
primary: {
base: "#26dafd",
light: "#8bebfe",
dark: "#029dbb"
},
secondary: {
base: "#df9527",
light: "#ecc180",
dark: "#8b5c15"
},
header: {
base: "#a1ecfb",
light: "#fff",
dark: "#3fd8f7"
},
control: {
base: "#acf9fb",
light: "#fff",
dark: "#4bf2f6"
},
success: {
base: "#00ff00",
light: "#6f6",
dark: "#090"
},
alert: {
base: "#ff0000",
light: "#f66",
dark: "#900"
},
disabled: {
base: "#999999",
light: "#ccc",
dark: "#666"
}
}
};


function drawCorner(obj, x, y, n) {
g.setColor(obj.C.color.primary.base);
let s1 = (n&1)?1:-1, s2 = (n&2)?1:-1;
const x1 = x + obj.cornerOffset * s1;
const y1 = y + obj.cornerOffset * s2;
g.fillRect(x1, y1, x - obj.cornerSize*s1 + obj.cornerOffset*s1, y);
g.fillRect(x1, y1, x, y - obj.cornerSize*s2 + obj.cornerOffset*s2);

}

Arwes.prototype.drawFrameNoCorners = function (x1, y1, x2, y2) {
g.setColor(this.C.color.primary.dark);
g.drawRect(x1, y1, x2, y2);
}

Arwes.prototype.drawFrame = function (x1, y1, x2, y2) {
drawCorner(this, x1, y1, 0);
drawCorner(this, x2, y1, 1);
drawCorner(this, x1, y2, 2);
drawCorner(this, x2, y2, 3);
this.drawFrameNoCorners(x1, y1, x2, y2);
}

Arwes.prototype.drawFrameBottomCorners = function (x1, y1, x2, y2) {
drawCorner(this, x1, y2, 2);
drawCorner(this, x2, y2, 3);
this.drawFrameNoCorners(x1, y1, x2, y2);
}

Arwes.prototype.drawFrameTopCorners = function (x1, y1, x2, y2) {
drawCorner(this, x1, y1, 0);
drawCorner(this, x2, y1, 1);
this.drawFrameNoCorners(x1, y1, x2, y2);
}

Arwes.prototype.drawFrameLeftCorners = function (x1, y1, x2, y2) {
drawCorner(this, x1, y1, 0);
drawCorner(this, x1, y2, 2);
this.drawFrameNoCorners(x1, y1, x2, y2);
}

Arwes.prototype.drawFrameRightCorners = function (x1, y1, x2, y2) {
drawCorner(this, x2, y1, 1);
drawCorner(this, x2, y2, 3);
this.drawFrameNoCorners(x1, y1, x2, y2);
}




exports.create = function (cornerSize, cornerOffset) {
return new Arwes(cornerSize, cornerOffset);
};

exports.default = function () {
return new Arwes(C.cornerSize, C.cornerOffset);
};

0 comments on commit 3a36580

Please sign in to comment.