Skip to content

Commit

Permalink
Merge pull request #2 from elluminance/master
Browse files Browse the repository at this point in the history
added custom icons for mods/tabs
  • Loading branch information
krypciak authored Mar 12, 2024
2 parents 64f6186 + 1ee2fff commit ad8aaf4
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 12 deletions.
Binary file removed assets/media/ccmodmanager-icons.png
Binary file not shown.
Binary file added assets/media/font/ccmodmanager-icons.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion ccmod.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"description": "Mod manager for CrossCode!",
"repository": "https://github.com/CCDirectLink/CCModManager",
"tags": ["QoL"],
"authors": ["krypek", "dmitmel", "2767mr"],
"authors": ["krypek", "dmitmel", "2767mr", "elluminance"],
"icons": {
"24": "icon/icon.png"
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"scripts": {
"start": "npx esbuild --target=es2018 --format=esm --platform=node --bundle --sourcemap=inline --outfile=plugin.js src/plugin.ts",
"watch": "npx esbuild --target=es2018 --format=esm --platform=node --bundle --sourcemap=inline --watch --outfile=plugin.js src/plugin.ts",
"build": "npx esbuild --target=es2018 --format=esm --platform=node --bundle --outfile='plugin.js' 'src/plugin.ts'",
"build": "npx esbuild --target=es2018 --format=esm --platform=node --bundle --outfile=plugin.js src/plugin.ts",
"format": "prettier ./src -w; npx prettier ./assets -w --tab-width 4 --no-semi --print-width 500 --bracket-same-line",
"types": "tsc --noEmit false --outDir types --emitDeclarationOnly true --declaration --isolatedModules false"
},
Expand Down
21 changes: 15 additions & 6 deletions src/gui/gui.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
import { Lang } from '../lang-manager.js'
import './menu.js'

const iconsFont = new ig.Font('media/ccmodmanager-icons.png', 16, 16)
const page = sc.fontsystem.font.iconSets.push(iconsFont) - 1
const icons = ['ccmodmanager-git'] as const
for (const iconName of icons) {
sc.fontsystem.font.mapping[iconName] = [page, 0]
sc.fontsystem.font.indexMapping.push(iconName)
const iconsFont = new ig.Font('media/font/ccmodmanager-icons.png', 16, 16)
const page = sc.fontsystem.font.iconSets.length;
sc.fontsystem.font.pushIconSet(iconsFont);
const icons = [
'ccmodmanager-git',
'mod-icon',
'mod-icon-online',
'mod-icon-selected',
'mod-icon-enabled',
'mod-icon-disabled'
] as const
let mapping: Record<string, [number, number]> = {};
for (let i = 0; i < icons.length; i++) {
mapping[icons[i]] = [page, i];
}
sc.fontsystem.font.setMapping(mapping);

// @ts-expect-error
sc.MENU_SUBMENU.MODS = Math.max(...Object.values(sc.MENU_SUBMENU)) + 1
Expand Down
8 changes: 4 additions & 4 deletions src/gui/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ sc.ModMenuList = sc.ListTabbedPane.extend({
this.gridColumns = 3

this.tabz = [
{ name: Lang.onlineTab, populateFunc: this.populateOnline, icon: 'quest-all' },
{ name: Lang.selectedModsTab, populateFunc: this.populateSelected, icon: 'quest-fav' },
{ name: Lang.enabledTab, populateFunc: this.populateEnabled, icon: 'quest-solve' },
{ name: Lang.disabledTab, populateFunc: this.populateDisabled, icon: 'quest-elite' },
{ name: Lang.onlineTab, populateFunc: this.populateOnline, icon: 'mod-icon-online' },
{ name: Lang.selectedModsTab, populateFunc: this.populateSelected, icon: 'mod-icon-selected' },
{ name: Lang.enabledTab, populateFunc: this.populateEnabled, icon: 'mod-icon-enabled' },
{ name: Lang.disabledTab, populateFunc: this.populateDisabled, icon: 'mod-icon-disabled' },
{ name: Lang.settingsTab, populateFunc: this.populateSettings, icon: 'stats-log' },
]
this.filters = {}
Expand Down

0 comments on commit ad8aaf4

Please sign in to comment.