Easter cleaning bunnies credits
This commit is contained in:
parent
4b38d3f248
commit
0b9d19b991
5 changed files with 356 additions and 275 deletions
|
|
@ -25,129 +25,112 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* DEATH TO UNICODE */ package love.distributedrebirth.unicode4d.draw; // death to unicode
|
||||
/* DEATH TO UNICODE */ //death to unicode
|
||||
/* DEATH TO UNICODE */ import java.util.function.Function; // death to unicode
|
||||
/* DEATH TO UNICODE */ //death to unicode
|
||||
/* DEATH TO UNICODE */ import imgui.ImColor; // death to unicode
|
||||
/* DEATH TO UNICODE */ import imgui.ImDrawList; // death to unicode
|
||||
/* DEATH TO UNICODE */ import imgui.ImGui; // death to unicode
|
||||
/* DEATH TO UNICODE */ import imgui.ImVec2; // death to unicode
|
||||
/* DEATH TO UNICODE */ import imgui.flag.ImGuiStyleVar; // death to unicode
|
||||
/* DEATH TO UNICODE */ import imgui.flag.ImGuiWindowFlags; // death to unicode
|
||||
/* DEATH TO UNICODE */ import love.distributedrebirth.unicode4d.draw.DrawGlyphPath.ImGlyphLineTo; // death to unicode
|
||||
/* DEATH TO UNICODE */ import love.distributedrebirth.unicode4d.draw.DrawGlyphPath.ImGlyphPathCommand; // death to unicode
|
||||
/* DEATH TO UNICODE */ import love.distributedrebirth.unicode4d.draw.DrawGlyphPath.ImGlyphQuadCurveTo; // death to unicode
|
||||
package love.distributedrebirth.unicode4d.draw;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import imgui.ImColor;
|
||||
import imgui.ImDrawList;
|
||||
import imgui.ImGui;
|
||||
import imgui.ImVec2;
|
||||
import imgui.flag.ImGuiStyleVar;
|
||||
import imgui.flag.ImGuiWindowFlags;
|
||||
import love.distributedrebirth.unicode4d.draw.DrawGlyphPath.ImGlyphLineTo;
|
||||
import love.distributedrebirth.unicode4d.draw.DrawGlyphPath.ImGlyphPathCommand;
|
||||
import love.distributedrebirth.unicode4d.draw.DrawGlyphPath.ImGlyphQuadCurveTo;
|
||||
import ᒢᐩᐩ.ᔆʸᔆᐪᓫᔿ.ᒃᣔᒃᓫᒻ.ᑊᐣᓑᖮᐪᔆ.DuytsDocAuthor注;
|
||||
/* DEATH TO UNICODE */ //death to unicode
|
||||
/* DEATH TO UNICODE */ @DuytsDocAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天") // death to unicode
|
||||
/* DEATH TO UNICODE */ public class ImCharacter { // death to unicode
|
||||
/* DEATH TO UNICODE */ // death to unicode
|
||||
/* DEATH TO UNICODE */ public static final float HEIGHT = 26f; // death to unicode
|
||||
/* DEATH TO UNICODE */ public static final float WIDTH = 22f; // death to unicode
|
||||
/* DEATH TO UNICODE */ public static final float MARGIN_MENUBAR = 4f; // death to unicode
|
||||
/* DEATH TO UNICODE */ private static final ImVec2 SIZE = new ImVec2(WIDTH, HEIGHT); // death to unicode
|
||||
/* DEATH TO UNICODE */ private static final int DEFAULT_COLOR = ImColor.intToColor(255, 255, 255, 255); // death to unicode
|
||||
/* DEATH TO UNICODE */ // death to unicode
|
||||
/* DEATH TO UNICODE */ public static void render(String childId, String text, int fallbackChar, Function<Integer, DrawCharacter> letterResolver) { // death to unicode
|
||||
/* DEATH TO UNICODE */ // death to unicode
|
||||
/* DEATH TO UNICODE */ // death to unicode
|
||||
/* DEATH TO UNICODE */ // death to unicode
|
||||
/* DEATH TO UNICODE */ // death to unicode
|
||||
/* DEATH TO UNICODE */ ImGui.pushStyleVar(ImGuiStyleVar.ItemSpacing, 0f, 0f); // death to unicode
|
||||
/* DEATH TO UNICODE */ // death to unicode
|
||||
/* DEATH TO UNICODE */ // death to unicode
|
||||
/* DEATH TO UNICODE */ // death to unicode
|
||||
/* DEATH TO UNICODE */ // death to unicode
|
||||
/* DEATH TO UNICODE */ // workaround for error; Too many vertices in ImDrawList using 16-bit indices. DEATH TO UNICODE
|
||||
/* DEATH TO UNICODE */ // hard coded height to fix line height and row0 height + no scoll to disable mouse scroll DEATH TO UNICODE
|
||||
/* DEATH TO UNICODE */ ImGui.beginChild(childId, 0f, ImCharacter.HEIGHT, false, ImGuiWindowFlags.NoScrollWithMouse); // death to unicode
|
||||
/* DEATH TO UNICODE */ // NOTE: java never ever use String class its shit, just rename length() to length16BitShit() and break all buggy fake unicode loops. DEATH TO UNICODE
|
||||
/* DEATH TO UNICODE */ // codePoints() is the only valid iterator, all methods should be removed from String, humans are not allowed to write code, DEATH TO UNICODE
|
||||
/* DEATH TO UNICODE */ // death to unicode
|
||||
/* DEATH TO UNICODE */ // death to unicode
|
||||
/* DEATH TO UNICODE */ // death to unicode
|
||||
/* DEATH TO UNICODE */ // death to unicode
|
||||
/* DEATH TO UNICODE */ text.codePoints().forEach(unicodeChar -> { // death to unicode
|
||||
/* DEATH TO UNICODE */ DrawCharacter drawChar = letterResolver.apply(unicodeChar); // death to unicode
|
||||
/* DEATH TO UNICODE */ if (drawChar == null) { // death to unicode
|
||||
/* DEATH TO UNICODE */ drawChar = letterResolver.apply(fallbackChar); // death to unicode
|
||||
/* DEATH TO UNICODE */ } // death to unicode
|
||||
/* DEATH TO UNICODE */ render(drawChar); // death to unicode
|
||||
/* DEATH TO UNICODE */ ImGui.sameLine(); // death to unicode
|
||||
/* DEATH TO UNICODE */ }); // death to unicode
|
||||
/* DEATH TO UNICODE */ ImGui.endChild(); // death to unicode
|
||||
/* DEATH TO UNICODE */ ImGui.popStyleVar(); // death to unicode
|
||||
/* DEATH TO UNICODE */ // death to unicode
|
||||
/* DEATH TO UNICODE */ // death to unicode
|
||||
/* DEATH TO UNICODE */ // death to unicode
|
||||
/* DEATH TO UNICODE */ // death to unicode
|
||||
/* DEATH TO UNICODE */ } // death to unicode
|
||||
/* DEATH TO UNICODE */ // death to unicode
|
||||
/* DEATH TO UNICODE */ public static void render(DrawCharacter drawChar) { // death to unicode
|
||||
/* DEATH TO UNICODE */ ImGui.invisibleButton("canvas", SIZE.x, SIZE.y); // death to unicode
|
||||
/* DEATH TO UNICODE */ ImVec2 p0 = ImGui.getItemRectMin(); // death to unicode
|
||||
/* DEATH TO UNICODE */ ImVec2 p1 = ImGui.getItemRectMax(); // death to unicode
|
||||
/* DEATH TO UNICODE */ ImDrawList drawList = ImGui.getWindowDrawList(); // death to unicode
|
||||
/* DEATH TO UNICODE */ drawList.pushClipRect(p0.x, p0.y, p1.x, p1.y); // death to unicode
|
||||
/* DEATH TO UNICODE */ drawUnicode4D(drawChar, p0.x, p0.y, DEFAULT_COLOR, drawList); // death to unicode
|
||||
/* DEATH TO UNICODE */ drawList.popClipRect(); // death to unicode
|
||||
/* DEATH TO UNICODE */ } // death to unicode
|
||||
/* DEATH TO UNICODE */ // death to unicode
|
||||
/* DEATH TO UNICODE */ public static void drawUnicode4D(DrawCharacter drawChar, float posX, float posY, int color, ImDrawList drawList) { // death to unicode
|
||||
/* DEATH TO UNICODE */ drawUnicode4D(drawChar, posX, posY, color, drawList, 1f);
|
||||
/* DEATH TO UNICODE */ }
|
||||
/* DEATH TO UNICODE */ public static void drawUnicode4D(DrawCharacter drawChar, float posX, float posY, int color, ImDrawList drawList, float scaleOffset) { // death to unicode
|
||||
/* DEATH TO UNICODE */ float xOff = posX; // death to unicode
|
||||
/* DEATH TO UNICODE */ float yOff = posY + 19f; // death to unicode
|
||||
/* DEATH TO UNICODE */ float yFlip = -1f; // death to unicode
|
||||
/* DEATH TO UNICODE */ float scale = 0.0199f; // death to unicode
|
||||
/* DEATH TO UNICODE */ if (drawChar.getyMax() > 900) { // death to unicode
|
||||
/* DEATH TO UNICODE */ scale = 0.0100f; // death to unicode
|
||||
/* DEATH TO UNICODE */ } // death to unicode
|
||||
/* DEATH TO UNICODE */ scale = scale * scaleOffset; // death to unicode
|
||||
/* DEATH TO UNICODE */ ImGlyphPathCommand first = null; // death to unicode
|
||||
/* DEATH TO UNICODE */ ImGlyphPathCommand prev = null; // death to unicode
|
||||
/* DEATH TO UNICODE */ for (ImGlyphPathCommand cmd: drawChar.getGlyphPath().getPath()) { // death to unicode
|
||||
/* DEATH TO UNICODE */ if (cmd.isImGlyphMoveTo()) { // death to unicode
|
||||
/* DEATH TO UNICODE */ first = cmd; // death to unicode
|
||||
/* DEATH TO UNICODE */ prev = cmd; // death to unicode
|
||||
/* DEATH TO UNICODE */ continue; // death to unicode
|
||||
/* DEATH TO UNICODE */ } // death to unicode
|
||||
/* DEATH TO UNICODE */ if (cmd.isImGlyphLineTo()) { // death to unicode
|
||||
/* DEATH TO UNICODE */ ImGlyphLineTo lineTo = cmd.toImGlyphLineTo(); // death to unicode
|
||||
/* DEATH TO UNICODE */ drawList.addLine( // death to unicode
|
||||
/* DEATH TO UNICODE */ xOff+prev.getX()*scale, // death to unicode
|
||||
/* DEATH TO UNICODE */ yOff+prev.getY()*scale*yFlip, // death to unicode
|
||||
/* DEATH TO UNICODE */ xOff+lineTo.getX()*scale, // death to unicode
|
||||
/* DEATH TO UNICODE */ yOff+lineTo.getY()*scale*yFlip, // death to unicode
|
||||
/* DEATH TO UNICODE */ color); // death to unicode
|
||||
/* DEATH TO UNICODE */ prev = cmd; // death to unicode
|
||||
/* DEATH TO UNICODE */ continue; // death to unicode
|
||||
/* DEATH TO UNICODE */ } // death to unicode
|
||||
/* DEATH TO UNICODE */ if (cmd.isImGlyphQuadCurveTo()) { // death to unicode
|
||||
/* DEATH TO UNICODE */ ImGlyphQuadCurveTo quadCurveTo = cmd.toImGlyphQuadCurveTo(); // death to unicode
|
||||
/* DEATH TO UNICODE */ drawList.addBezierQuadratic( // death to unicode
|
||||
/* DEATH TO UNICODE */ xOff+prev.getX()*scale, // death to unicode
|
||||
/* DEATH TO UNICODE */ yOff+prev.getY()*scale*yFlip, // death to unicode
|
||||
/* DEATH TO UNICODE */ xOff+quadCurveTo.getX1()*scale, // death to unicode
|
||||
/* DEATH TO UNICODE */ yOff+quadCurveTo.getY1()*scale*yFlip, // death to unicode
|
||||
/* DEATH TO UNICODE */ xOff+quadCurveTo.getX()*scale, // death to unicode
|
||||
/* DEATH TO UNICODE */ yOff+quadCurveTo.getY()*scale*yFlip, // death to unicode
|
||||
/* DEATH TO UNICODE */ color, // death to unicode
|
||||
/* DEATH TO UNICODE */ 1); // death to unicode
|
||||
/* DEATH TO UNICODE */ prev = cmd; // death to unicode
|
||||
/* DEATH TO UNICODE */ continue; // death to unicode
|
||||
/* DEATH TO UNICODE */ } // death to unicode
|
||||
/* DEATH TO UNICODE */ if (cmd.isImGlyphClosePath()) { // death to unicode
|
||||
/* DEATH TO UNICODE */ drawList.addLine( // death to unicode
|
||||
/* DEATH TO UNICODE */ xOff+prev.getX()*scale, // death to unicode
|
||||
/* DEATH TO UNICODE */ yOff+prev.getY()*scale*yFlip, // death to unicode
|
||||
/* DEATH TO UNICODE */ xOff+first.getX()*scale, // death to unicode
|
||||
/* DEATH TO UNICODE */ yOff+first.getY()*scale*yFlip, // death to unicode
|
||||
/* DEATH TO UNICODE */ color); // death to unicode
|
||||
/* DEATH TO UNICODE */ } // death to unicode
|
||||
/* DEATH TO UNICODE */ } // death to unicode
|
||||
/* DEATH TO UNICODE */ } // death to unicode
|
||||
/* DEATH TO UNICODE */ } // death to unicode
|
||||
/* DEATH TO UNICODE */ //death to unicode
|
||||
|
||||
@DuytsDocAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天")
|
||||
public class ImCharacter {
|
||||
|
||||
public static final float HEIGHT = 26f;
|
||||
public static final float WIDTH = 22f;
|
||||
public static final float MARGIN_MENUBAR = 4f;
|
||||
private static final ImVec2 SIZE = new ImVec2(WIDTH, HEIGHT);
|
||||
private static final int DEFAULT_COLOR = ImColor.intToColor(255, 255, 255, 255);
|
||||
|
||||
public static void render(String childId, String text, int fallbackChar, Function<Integer, DrawCharacter> letterResolver) {
|
||||
ImGui.pushStyleVar(ImGuiStyleVar.ItemSpacing, 0f, 0f);
|
||||
// workaround for error; Too many vertices in ImDrawList using 16-bit indices.
|
||||
// hard coded height to fix line height and row0 height + no scoll to disable mouse scroll
|
||||
ImGui.beginChild(childId, 0f, ImCharacter.HEIGHT, false, ImGuiWindowFlags.NoScrollWithMouse);
|
||||
// NOTE: java never ever use String class its shit, just rename length() to length16BitShit() and break all buggy fake unicode loops.
|
||||
// codePoints() is the only valid iterator, all methods should be removed from String, humans are not allowed to write code,
|
||||
text.codePoints().forEach(unicodeChar -> {
|
||||
DrawCharacter drawChar = letterResolver.apply(unicodeChar);
|
||||
if (drawChar == null) {
|
||||
drawChar = letterResolver.apply(fallbackChar);
|
||||
}
|
||||
render(drawChar);
|
||||
ImGui.sameLine();
|
||||
});
|
||||
ImGui.endChild();
|
||||
ImGui.popStyleVar();
|
||||
}
|
||||
|
||||
public static void render(DrawCharacter drawChar) {
|
||||
ImGui.invisibleButton("canvas", SIZE.x, SIZE.y);
|
||||
ImVec2 p0 = ImGui.getItemRectMin();
|
||||
ImVec2 p1 = ImGui.getItemRectMax();
|
||||
ImDrawList drawList = ImGui.getWindowDrawList();
|
||||
drawList.pushClipRect(p0.x, p0.y, p1.x, p1.y);
|
||||
drawUnicode4D(drawChar, p0.x, p0.y, DEFAULT_COLOR, drawList);
|
||||
drawList.popClipRect();
|
||||
}
|
||||
|
||||
public static void drawUnicode4D(DrawCharacter drawChar, float posX, float posY, int color, ImDrawList drawList) {
|
||||
drawUnicode4D(drawChar, posX, posY, color, drawList, 1f);
|
||||
}
|
||||
public static void drawUnicode4D(DrawCharacter drawChar, float posX, float posY, int color, ImDrawList drawList, float scaleOffset) {
|
||||
float xOff = posX;
|
||||
float yOff = posY + 19f;
|
||||
float yFlip = -1f;
|
||||
float scale = 0.0199f;
|
||||
if (drawChar.getyMax() > 900) {
|
||||
scale = 0.0100f;
|
||||
}
|
||||
scale = scale * scaleOffset;
|
||||
ImGlyphPathCommand first = null;
|
||||
ImGlyphPathCommand prev = null;
|
||||
for (ImGlyphPathCommand cmd: drawChar.getGlyphPath().getPath()) {
|
||||
if (cmd.isImGlyphMoveTo()) {
|
||||
first = cmd;
|
||||
prev = cmd;
|
||||
continue;
|
||||
}
|
||||
if (cmd.isImGlyphLineTo()) {
|
||||
ImGlyphLineTo lineTo = cmd.toImGlyphLineTo();
|
||||
drawList.addLine(
|
||||
xOff+prev.getX()*scale,
|
||||
yOff+prev.getY()*scale*yFlip,
|
||||
xOff+lineTo.getX()*scale,
|
||||
yOff+lineTo.getY()*scale*yFlip,
|
||||
color);
|
||||
prev = cmd;
|
||||
continue;
|
||||
}
|
||||
if (cmd.isImGlyphQuadCurveTo()) {
|
||||
ImGlyphQuadCurveTo quadCurveTo = cmd.toImGlyphQuadCurveTo();
|
||||
drawList.addBezierQuadratic(
|
||||
xOff+prev.getX()*scale,
|
||||
yOff+prev.getY()*scale*yFlip,
|
||||
xOff+quadCurveTo.getX1()*scale,
|
||||
yOff+quadCurveTo.getY1()*scale*yFlip,
|
||||
xOff+quadCurveTo.getX()*scale,
|
||||
yOff+quadCurveTo.getY()*scale*yFlip,
|
||||
color,
|
||||
1);
|
||||
prev = cmd;
|
||||
continue;
|
||||
}
|
||||
if (cmd.isImGlyphClosePath()) {
|
||||
drawList.addLine(
|
||||
xOff+prev.getX()*scale,
|
||||
yOff+prev.getY()*scale*yFlip,
|
||||
xOff+first.getX()*scale,
|
||||
yOff+first.getY()*scale*yFlip,
|
||||
color);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,10 +64,8 @@ public class TestConvFont {
|
|||
// gdxapp4d-chain-font-unicode4d/src/main/nodejs$ ./conv-font.sh ../chain/plane0/ ../../../target/chain2/plane0/
|
||||
// gdxapp4d-chain-font-unicode4d/src/main/nodejs$ ./conv-font.sh ../chain/plane1/ ../../../target/chain2/plane1/
|
||||
// gdxapp4d-chain-font-unicode4d/src/main/nodejs$ ./conv-font.sh ../chain/plane2/ ../../../target/chain2/plane2/
|
||||
// cd ../../../..
|
||||
// mvn package
|
||||
|
||||
// TODO: convert and split code-2000 and code-2002 because bitjunk want to force LFS into GIT and I can't commit anymore
|
||||
//
|
||||
// Than run this file
|
||||
public void run() {
|
||||
System.out.println("Starting conversion;");
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue