generated from Anuken/MindustryJavaModTemplate
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
101 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package biotech.content; | ||
|
||
import arc.Core; | ||
import arc.graphics.Color; | ||
import arc.graphics.g2d.Font; | ||
import arc.graphics.g2d.TextureRegion; | ||
import arc.math.geom.Vec2; | ||
import arc.struct.ObjectIntMap; | ||
import arc.struct.ObjectMap; | ||
import arc.struct.Seq; | ||
import arc.util.Reflect; | ||
import arc.util.Scaling; | ||
import mindustry.game.Team; | ||
import mindustry.ui.Fonts; | ||
|
||
public class BioTeams { | ||
public static Team | ||
septaris; | ||
|
||
public static void load() { | ||
septaris = newTeam(5, "septaris", Color.valueOf("6082b6")); | ||
} | ||
|
||
private static Team newTeam(int id, String name, Color color) { | ||
Team team = Team.get(id); | ||
team.name = name; | ||
team.color.set(color); | ||
|
||
team.palette[0] = color; | ||
team.palette[1] = color.cpy().mul(0.75f); | ||
team.palette[2] = color.cpy().mul(0.5f); | ||
|
||
for(int i = 0; i < 3; i++){ | ||
team.palettei[i] = team.palette[i].rgba(); | ||
} | ||
|
||
Seq<Font> fonts = Seq.with(Fonts.def, Fonts.outline); | ||
|
||
var ch = 65000 + id; | ||
Reflect.<ObjectIntMap<String>>get(Fonts.class, "unicodeIcons").put(name, ch); | ||
var stringIcons = Reflect.<ObjectMap<String, String>>get(Fonts.class, "stringIcons"); | ||
stringIcons.put(name, ((char)ch) + ""); | ||
|
||
int size = (int)(Fonts.def.getData().lineHeight/Fonts.def.getData().scaleY); | ||
TextureRegion region = Core.atlas.find("bio-team-" + name); | ||
Vec2 out = Scaling.fit.apply(region.width, region.height, size, size); | ||
Font.Glyph glyph = new Font.Glyph(){{ | ||
id = ch; | ||
srcX = 0; | ||
srcY = 0; | ||
width = (int)out.x; | ||
height = (int)out.y; | ||
u = region.u; | ||
v = region.v2; | ||
u2 = region.u2; | ||
v2 = region.v; | ||
xoffset = 0; | ||
yoffset = -size; | ||
xadvance = size; | ||
kerning = null; | ||
fixedWidth = true; | ||
page = 0; | ||
}}; | ||
fonts.each(f -> f.getData().setGlyph(ch, glyph)); | ||
|
||
//now put whatever the heck we get for an emoji | ||
team.emoji = stringIcons.get(team.name, ""); | ||
|
||
|
||
return team; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters