Hewbrew+unicode=hell

This commit is contained in:
Willem Cazander 2022-10-10 18:04:27 +02:00
parent 76f3da5da7
commit ca1fe9d9d0
27 changed files with 460 additions and 115 deletions

View file

@ -1,21 +1,58 @@
package love.distributedrebirth.gdxapp4d.app.notepad;
import java.util.Random;
import imgui.ImDrawList;
import imgui.ImGui;
import imgui.ImVec2;
import imgui.type.ImInt;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
import love.distributedrebirth.gdxapp4d.vrgem4.service.VrGem4Unicode4DService;
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.AbstractDeskApp;
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppContourSection;
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppRenderer;
import love.distributedrebirth.numberxd.unicode.UnicodePlane;
import love.distributedrebirth.unicode4d.draw.DrawCharacter;
import love.distributedrebirth.unicode4d.draw.ImCharacter;
@BãßBȍőnAuthorInfoʸᴰ(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天")
public class NotepadDeskApp extends AbstractDeskApp implements DeskAppRenderer {
private final VrGem4Unicode4DService unicode4DService;
private String value = "";
private final int gridWidth = 120;
private final int gridHeight = 40;
private final String gridChars;
private final int[][] gridBuffer;
private final int[] gridRank;
private final Random random;
private int runCounter;
private final ImInt runSpeed = new ImInt(30);
private final static UnicodePlane[] GRID_PLANES = {
UnicodePlane.BRAHMI,
UnicodePlane.UGARITIC,
UnicodePlane.BAMUM_SUPPLEMENT,
UnicodePlane.TAI_XUAN_JING_SYMBOLS
};
public NotepadDeskApp(VrGem4Unicode4DService unicode4DService) {
this.unicode4DService = unicode4DService;
this.gridBuffer = new int[gridHeight][gridWidth];
this.gridRank = new int[gridWidth];
this.random = new Random();
for (int y=0; y<gridWidth; y++) {
gridRank[y] = 0;
for (int x=0; x<gridHeight; x++) {
gridBuffer[x][y] = ' ';
}
}
StringBuilder buf = new StringBuilder();
buf.append("仙上主天");
for (UnicodePlane plane:GRID_PLANES) {
for (int i=plane.getStart();i<plane.getStop();i++) {
buf.appendCodePoint(i);
}
}
gridChars = buf.toString();
}
public void create() {
@ -25,27 +62,53 @@ public class NotepadDeskApp extends AbstractDeskApp implements DeskAppRenderer {
@Override
public void render() {
ImGui.text("Value:");
ImGui.text(value);
ImCharacter.render(unicode4DService.getCharacterForUnicode('ﷲ'));
ImGui.sameLine();
ImCharacter.render(unicode4DService.getCharacterForUnicode('v'));
ImGui.sameLine();
ImCharacter.render(unicode4DService.getCharacterForUnicode('r'));
ImGui.sameLine();
ImCharacter.render(unicode4DService.getCharacterForUnicode('G'));
ImGui.sameLine();
ImCharacter.render(unicode4DService.getCharacterForUnicode('E'));
ImGui.sameLine();
ImCharacter.render(unicode4DService.getCharacterForUnicode('M'));
ImGui.sameLine();
ImCharacter.render(unicode4DService.getCharacterForUnicode('⁴'));
ImCharacter.render(unicode4DService.getCharacterForUnicode('M'));
ImGui.sameLine();
ImCharacter.render(unicode4DService.getCharacterForUnicode(Integer.parseInt("27d6", 16)));
ImGui.sameLine();
ImCharacter.render(unicode4DService.getCharacterForUnicode('仙'));
ImGui.sliderInt("RunSpeed", runSpeed.getData(), 0, 60);
ImGui.invisibleButton("matrix", ImGui.getWindowWidth(), ImGui.getWindowHeight()-(2*ImGui.getFontSize()));
ImVec2 p0 = ImGui.getItemRectMin();
ImVec2 p1 = ImGui.getItemRectMax();
ImDrawList drawList = ImGui.getWindowDrawList();
drawList.pushClipRect(p0.x, p0.y, p1.x, p1.y);
for(int y=0; y<gridHeight; y++) {
for(int x=0; x<gridWidth; x++) {
int unicodeChar = gridBuffer[y][x];
DrawCharacter drawChar = unicode4DService.getCharacterForUnicode(unicodeChar);
if (drawChar == null) {
drawChar = unicode4DService.getCharacterForUnicode('ﷲ');
}
ImCharacter.drawUnicode4D(drawChar, x*ImCharacter.WIDTH, y*ImCharacter.HEIGHT, 0x3c68bb5b, drawList);
}
}
drawList.popClipRect();
updateGrid();
}
private void updateGrid() {
runCounter++;
if (runCounter < runSpeed.get()) {
return;
}
runCounter = 0;
for (int x=gridHeight-1; x>0; x--) {
for (int y=0; y<gridWidth; y++) {
gridBuffer[x][y] = gridBuffer[x-1][y];
}
}
for (int y=0; y<gridWidth; y++) {
int charSelect = 0;
for (int i=0;i<4;i++) {
charSelect = gridChars.codePointAt(random.nextInt(gridChars.length()));
DrawCharacter drawChar = unicode4DService.getCharacterForUnicode(charSelect);
if (drawChar != null) {
break;
}
}
int charRandom = gridRank[y]>0?(random.nextInt(100)<70? charSelect:' '):(random.nextInt(100)<1? charSelect:' ');
gridBuffer[0][y] = charRandom;
if (gridBuffer[0][y]==' ') {
gridRank[y] = 0;
} else {
gridRank[y]++;
}
}
}
}