Customizable edge stencil / Reduced redundant sprites

This commit is contained in:
Anuken
2019-01-28 23:30:11 -05:00
parent 54bade668e
commit 76af3e3077
19 changed files with 1874 additions and 2286 deletions
@@ -107,10 +107,10 @@ public class StructAnnotationProcessor extends AbstractProcessor{
getter.addStatement("return ($L & (1L << $L)) != 0", structParam, offset); getter.addStatement("return ($L & (1L << $L)) != 0", structParam, offset);
}else if(varType == TypeName.FLOAT){ }else if(varType == TypeName.FLOAT){
//floats: need conversion //floats: need conversion
getter.addStatement("return Float.intBitsToFloat((int)(($L >> $L) & $L))", structParam, offset, bitString(size, structTotalSize)); getter.addStatement("return Float.intBitsToFloat((int)(($L >>> $L) & $L))", structParam, offset, bitString(size, structTotalSize));
}else{ }else{
//bytes, shorts, chars, ints //bytes, shorts, chars, ints
getter.addStatement("return ($T)(($L >> $L) & $L)", varType, structParam, offset, bitString(size, structTotalSize)); getter.addStatement("return ($T)(($L >>> $L) & $L)", varType, structParam, offset, bitString(size, structTotalSize));
} }
//[setter] + [constructor building] //[setter] + [constructor building]
Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 498 B

Before

Width:  |  Height:  |  Size: 506 B

After

Width:  |  Height:  |  Size: 506 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 130 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 130 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 B

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 145 B

Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1013 KiB

After

Width:  |  Height:  |  Size: 975 KiB

+276 -49
View File
@@ -8,74 +8,301 @@ Color: {
accent: { hex: "ffd37f" } accent: { hex: "ffd37f" }
}, },
TintedDrawable: { TintedDrawable: {
dialogDim: {name: white, color: {r: 0, g: 0, b: 0, a: 0.9} }, dialogDim: {
invis: {name: white, color: {r: 0, g: 0, b: 0, a: 0} } name: white,
loadDim: {name: white, color: {r: 0, g: 0, b: 0, a: 0.8} }, color: { r: 0, g: 0, b: 0, a: 0.9 }
chatfield: {name: white, color: {r: 0, g: 0, b: 0, a: 0.2}}, },
dark: {name: white, color: {hex: "#000000ff"}}, invis: {
none: {name: white, color: {r: 0, g: 0, b: 0, a: 0}}, name: white,
flat: {name: white, color: {r: 0.0, g: 0.0, b: 0.0, a: 0.6}}, color: { r: 0, g: 0, b: 0, a: 0 }
flat-over: {name: white, color: { hex: "#ffffff82" }}, }
flat-down: {name: white, color: { hex: "#ffd37fff" }} loadDim: {
name: white,
color: { r: 0, g: 0, b: 0, a: 0.8 }
},
chatfield: {
name: white,
color: { r: 0, g: 0, b: 0, a: 0.2 }
},
dark: {
name: white,
color: { hex: "#000000ff" }
},
none: {
name: white,
color: { r: 0, g: 0, b: 0, a: 0 }
},
flat: {
name: white,
color: { r: 0.0, g: 0.0, b: 0.0, a: 0.6 }
},
flat-over: {
name: white,
color: { hex: "#ffffff82" }
},
flat-down: {
name: white,
color: { hex: "#ffd37fff" }
}
}, },
ButtonStyle: { ButtonStyle: {
default: {down: button-down, up: button }, default: {
toggle: {checked: button-down, down: button-down, up: button } down: button-down,
up: button
},
toggle: {
checked: button-down,
down: button-down,
up: button
}
}, },
TextButtonStyle: { TextButtonStyle: {
default: {over: button-over, disabled: button, font: default-font, fontColor: white, disabledFontColor: gray, down: button-down, up: button}, default: {
node: {disabled: content-background-locked, font: default-font, fontColor: white, disabledFontColor: gray, up: content-background, over: content-background-over}, over: button-over,
right: {over: button-right-over, font: default-font, fontColor: white, disabledFontColor: gray, down: button-right-down, up: button-right}, disabled: button,
wave: {font: default-font, fontColor: white, disabledFontColor: gray, up: button-edge-4}, font: default-font,
clear: {over: flat-over, font: default-font, fontColor: white, disabledFontColor: gray, down: flat-over, up: flat}, fontColor: white,
discord: {font: default-font, fontColor: white, up: discord-banner}, disabledFontColor: gray,
info: {font: default-font, fontColor: white, up: info-banner}, down: button-down,
clear-partial: {down: white, up: button-select, over: flat-down, font: default-font, fontColor: white, disabledFontColor: gray }, up: button
clear-partial-2: {down: flat-over, up: none, over: flat-over, font: default-font, fontColor: white, disabledFontColor: gray }, },
empty: {font: default-font}, node: {
clear-toggle: {font: default-font, fontColor: white, checked: flat-down, down: flat-down, up: flat, over: flat-over, disabled: flat, disabledFontColor: gray } disabled: content-background-locked,
toggle: {font: default-font, fontColor: white, checked: button-down, down: button-down, up: button, over: button-over, disabled: button, disabledFontColor: gray } font: default-font,
fontColor: white,
disabledFontColor: gray,
up: content-background,
over: content-background-over
},
right: {
over: button-right-over,
font: default-font,
fontColor: white,
disabledFontColor: gray,
down: button-right-down,
up: button-right
},
wave: {
font: default-font,
fontColor: white,
disabledFontColor: gray,
up: button-edge-4
},
clear: {
over: flat-over,
font: default-font,
fontColor: white,
disabledFontColor: gray,
down: flat-over,
up: flat
},
discord: {
font: default-font,
fontColor: white,
up: discord-banner
},
info: {
font: default-font,
fontColor: white,
up: info-banner
},
clear-partial: {
down: white,
up: button-select,
over: flat-down,
font: default-font,
fontColor: white,
disabledFontColor: gray
},
clear-partial-2: {
down: flat-over,
up: none,
over: flat-over,
font: default-font,
fontColor: white,
disabledFontColor: gray
},
empty: {
font: default-font
},
clear-toggle: {
font: default-font,
fontColor: white,
checked: flat-down,
down: flat-down,
up: flat,
over: flat-over,
disabled: flat,
disabledFontColor: gray
}
toggle: {
font: default-font,
fontColor: white,
checked: button-down,
down: button-down,
up: button,
over: button-over,
disabled: button,
disabledFontColor: gray
}
}, },
ImageButtonStyle: { ImageButtonStyle: {
default: {down: button-down, up: button, over: button-over, imageDisabledColor: gray, imageUpColor: white }, default: {
node: {up: content-background, over: content-background-over}, down: button-down,
right: {over: button-right-over, down: button-right-down, up: button-right}, up: button,
empty: { imageDownColor: accent, imageUpColor: white}, over: button-over,
emptytoggle: {imageCheckedColor: white, imageDownColor: white, imageUpColor: gray}, imageDisabledColor: gray,
static: {up: button }, imageUpColor: white
static-down: {up: button-down }, },
toggle: {checked: button-down, down: button-down, up: button, imageDisabledColor: gray, imageUpColor: white }, node: {
select: {checked: button-select, up: none }, up: content-background,
clear: {down: flat-over, up: flat, over: flat-over}, over: content-background-over
clear-full: {down: white, up: button-select, over: flat-down}, },
clear-partial: {down: flat-down, up: none, over: flat-over}, right: {
clear-toggle: {down: flat-down, checked: flat-down, up: flat, over: flat-over}, over: button-right-over,
clear-toggle-partial: {down: flat-down, checked: flat-down, up: none, over: flat-over}, down: button-right-down,
up: button-right
},
empty: {
imageDownColor: accent,
imageUpColor: white
},
emptytoggle: {
imageCheckedColor: white,
imageDownColor: white,
imageUpColor: gray
},
static: {
up: button
},
static-down: {
up: button-down
},
toggle: {
checked: button-down,
down: button-down,
up: button,
imageDisabledColor: gray,
imageUpColor: white
},
select: {
checked: button-select,
up: none
},
clear: {
down: flat-over,
up: flat,
over: flat-over
},
clear-full: {
down: white,
up: button-select,
over: flat-down
},
clear-partial: {
down: flat-down,
up: none,
over: flat-over
},
clear-toggle: {
down: flat-down,
checked: flat-down,
up: flat,
over: flat-over
},
clear-toggle-partial: {
down: flat-down,
checked: flat-down,
up: none,
over: flat-over
},
}, },
ScrollPaneStyle: { ScrollPaneStyle: {
default: {vScroll: scroll, vScrollKnob: scroll-knob-vertical-black}, default: {
horizontal: {vScroll: scroll, vScrollKnob: scroll-knob-vertical-black, hScroll: scroll-horizontal, hScrollKnob: scroll-knob-horizontal-black}, vScroll: scroll,
vScrollKnob: scroll-knob-vertical-black
},
horizontal: {
vScroll: scroll,
vScrollKnob: scroll-knob-vertical-black,
hScroll: scroll-horizontal,
hScrollKnob: scroll-knob-horizontal-black
},
}, },
WindowStyle: { WindowStyle: {
default: {titleFont: default-font, titleFontColor: accent }, default: {
dialog: {stageBackground: dialogDim, titleFont: default-font, background: window-empty, titleFontColor: accent } titleFont: default-font,
titleFontColor: accent
},
dialog: {
stageBackground: dialogDim,
titleFont: default-font,
background: window-empty,
titleFontColor: accent
}
}, },
KeybindDialogStyle: { KeybindDialogStyle: {
default: {keyColor: accent, keyNameColor: white, controllerColor: lightgray}, default: {
keyColor: accent,
keyNameColor: white,
controllerColor: lightgray
},
}, },
SliderStyle: { SliderStyle: {
default-horizontal: {background: slider, knob: slider-knob, knobOver: slider-knob-over, knobDown: slider-knob-down}, default-horizontal: {
default-vertical: {background: slider-vertical, knob: slider-knob, knobOver: slider-knob-over, knobDown: slider-knob-down} background: slider,
knob: slider-knob,
knobOver: slider-knob-over,
knobDown: slider-knob-down
},
default-vertical: {
background: slider-vertical,
knob: slider-knob,
knobOver: slider-knob-over,
knobDown: slider-knob-down
}
}, },
LabelStyle: { LabelStyle: {
default: {font: default-font, fontColor: white }, default: {
small: {font: default-font, fontColor: white } font: default-font,
fontColor: white
},
small: {
font: default-font,
fontColor: white
}
}, },
TextFieldStyle: { TextFieldStyle: {
default: {font: default-font-chat, fontColor: white, disabledFontColor: gray, selection: selection, background: underline, cursor: cursor, messageFont: default-font, messageFontColor: gray } default: {
textarea: {font: default-font-chat, fontColor: white, disabledFontColor: gray, selection: selection, background: underline, cursor: cursor, messageFont: default-font, messageFontColor: gray } font: default-font-chat,
fontColor: white,
disabledFontColor: gray,
selection: selection,
background: underline,
cursor: cursor,
messageFont: default-font,
messageFontColor: gray
}
textarea: {
font: default-font-chat,
fontColor: white,
disabledFontColor: gray,
selection: selection,
background: underline,
cursor: cursor,
messageFont: default-font,
messageFontColor: gray
}
}, },
CheckBoxStyle: { CheckBoxStyle: {
default: {checkboxOn: check-on, checkboxOff: check-off, checkboxOnOver: check-on-over, checkboxOver: check-over, font: default-font, fontColor: white, disabledFontColor: gray } default: {
checkboxOn: check-on,
checkboxOff: check-off,
checkboxOnOver: check-on-over,
checkboxOver: check-over,
font: default-font,
fontColor: white,
disabledFontColor: gray
}
} }
} }
@@ -165,6 +165,10 @@ public class Blocks implements ContentList{
playerUnmineable = true; playerUnmineable = true;
}}; }};
iceSnow = new Floor("ice-snow"){{
variants = 3;
}};
ice = new Floor("ice"){{ ice = new Floor("ice"){{
dragMultiplier = 0.2f; dragMultiplier = 0.2f;
speedMultiplier = 0.4f; speedMultiplier = 0.4f;
@@ -173,6 +177,7 @@ public class Blocks implements ContentList{
holostone = new Floor("holostone"){{ holostone = new Floor("holostone"){{
hasOres = true; hasOres = true;
edgeStyle = "blocky";
}}; }};
snow = new Floor("snow"){{ snow = new Floor("snow"){{
@@ -212,10 +217,6 @@ public class Blocks implements ContentList{
variants = 3; variants = 3;
}}; }};
iceSnow = new Floor("iceSnow"){{
variants = 3;
}};
//endregion //endregion
//region crafting //region crafting
+1 -1
View File
@@ -486,7 +486,7 @@ public class Block extends BlockStorage{
public TextureRegion icon(Icon icon){ public TextureRegion icon(Icon icon){
if(icons[icon.ordinal()] == null){ if(icons[icon.ordinal()] == null){
icons[icon.ordinal()] = Core.atlas.find(name + "-icon-" + icon.name()); icons[icon.ordinal()] = Core.atlas.find(name + "-icon-" + icon.name(), icon == Icon.full ? getGeneratedIcons()[0] : Core.atlas.find("__error"));
} }
return icons[icon.ordinal()]; return icons[icon.ordinal()];
} }
@@ -53,6 +53,8 @@ public class Floor extends Block{
public float heat = 0f; public float heat = 0f;
/** if true, this block cannot be mined by players. useful for annoying things like sand. */ /** if true, this block cannot be mined by players. useful for annoying things like sand. */
public boolean playerUnmineable = false; public boolean playerUnmineable = false;
/**Style of the edge stencil. Loaded by looking up "edge-stencil-{name}".*/
public String edgeStyle = "smooth";
protected TextureRegion[][] edges; protected TextureRegion[][] edges;
protected byte eq = 0; protected byte eq = 0;
+3 -1
View File
@@ -34,7 +34,9 @@ public class Generators {
image.draw(region); image.draw(region);
} }
if(regions.length > 1){
image.save(block.name + "-icon-full"); image.save(block.name + "-icon-full");
}
for(Icon icon : Icon.values()){ for(Icon icon : Icon.values()){
if(icon.size == 0) continue; if(icon.size == 0) continue;
@@ -157,7 +159,7 @@ public class Generators {
try{ try{
Image image = ImagePacker.get(floor.generateIcons()[0]); Image image = ImagePacker.get(floor.generateIcons()[0]);
Image edge = ImagePacker.get("edge-stencil"); Image edge = ImagePacker.get("edge-stencil-" + floor.edgeStyle);
for(int x = 0; x < edge.width(); x++){ for(int x = 0; x < edge.width(); x++){
for(int y = 0; y < edge.height(); y++){ for(int y = 0; y < edge.height(); y++){