Cleaned constants
This commit is contained in:
parent
0e5b46e9b0
commit
9dbf694313
7 changed files with 99 additions and 68 deletions
|
|
@ -27,7 +27,8 @@ public class NotepadDeskApp extends AbstractDeskApp implements DeskAppRenderer {
|
|||
private final int[] gridRank;
|
||||
private final Random random;
|
||||
private int runCounter;
|
||||
private final ImInt runSpeed = new ImInt(10);
|
||||
private final ImInt runSpeed = new ImInt(Bãß.ℭỗᶇṧⱦᶏꬼȶʂ.INT_TEN);
|
||||
private final static char DEFAULT_CHAR = 'ﷲ';
|
||||
private final static UnicodePlane[] GRID_PLANES = {
|
||||
UnicodePlane.BRAHMI,
|
||||
UnicodePlane.UGARITIC,
|
||||
|
|
@ -40,10 +41,10 @@ public class NotepadDeskApp extends AbstractDeskApp implements DeskAppRenderer {
|
|||
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] = ' ';
|
||||
for (int y=Bãß.ℭỗᶇṧⱦᶏꬼȶʂ.INT_ZERO; y<gridWidth; y++) {
|
||||
gridRank[y] = Bãß.ℭỗᶇṧⱦᶏꬼȶʂ.INT_ZERO;
|
||||
for (int x=Bãß.ℭỗᶇṧⱦᶏꬼȶʂ.INT_ZERO; x<gridHeight; x++) {
|
||||
gridBuffer[x][y] = Bãß.ℭỗᶇṧⱦᶏꬼȶʂ.CHAR_SPACE;
|
||||
}
|
||||
}
|
||||
StringBuilder buf = new StringBuilder();
|
||||
|
|
@ -65,19 +66,19 @@ public class NotepadDeskApp extends AbstractDeskApp implements DeskAppRenderer {
|
|||
public void render() {
|
||||
ImGui.sliderInt(Bãß.ℭỗᶇṧⱦᶏꬼȶʂ.STR_SPACE, runSpeed.getData(), 0, 60); // empty ID not allowed in ImGui, but whitespace is an ID :)
|
||||
ImGui.sameLine();
|
||||
ImCharacter.render("speedId", "RunSpeed", 'ﷲ', v -> unicode4DService.getCharacterForUnicode(v));
|
||||
ImCharacter.render("speedId", "RunSpeed", DEFAULT_CHAR, v -> unicode4DService.getCharacterForUnicode(v));
|
||||
|
||||
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++) {
|
||||
for(int y=Bãß.ℭỗᶇṧⱦᶏꬼȶʂ.INT_ZERO; y<gridHeight; y++) {
|
||||
for(int x=Bãß.ℭỗᶇṧⱦᶏꬼȶʂ.INT_ZERO; x<gridWidth; x++) {
|
||||
int unicodeChar = gridBuffer[y][x];
|
||||
DrawCharacter drawChar = unicode4DService.getCharacterForUnicode(unicodeChar);
|
||||
if (drawChar == null) {
|
||||
drawChar = unicode4DService.getCharacterForUnicode('ﷲ');
|
||||
drawChar = unicode4DService.getCharacterForUnicode(DEFAULT_CHAR);
|
||||
}
|
||||
ImCharacter.drawUnicode4D(drawChar, x*ImCharacter.WIDTH, y*ImCharacter.HEIGHT, 0x3c68bb5b, drawList);
|
||||
}
|
||||
|
|
@ -91,25 +92,28 @@ public class NotepadDeskApp extends AbstractDeskApp implements DeskAppRenderer {
|
|||
if (runCounter < runSpeed.get()) {
|
||||
return;
|
||||
}
|
||||
runCounter = 0;
|
||||
for (int x=gridHeight-1; x>0; x--) {
|
||||
for (int y=0; y<gridWidth; y++) {
|
||||
runCounter = Bãß.ℭỗᶇṧⱦᶏꬼȶʂ.INT_ZERO;
|
||||
for (int x=gridHeight-1; x>Bãß.ℭỗᶇṧⱦᶏꬼȶʂ.INT_ZERO; x--) {
|
||||
for (int y=Bãß.ℭỗᶇṧⱦᶏꬼȶʂ.INT_ZERO; 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++) {
|
||||
int charSelect = Bãß.ℭỗᶇṧⱦᶏꬼȶʂ.INT_ZERO;
|
||||
for (int i=Bãß.ℭỗᶇṧⱦᶏꬼȶʂ.INT_ZERO;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;
|
||||
if (gridRank[y] > Bãß.ℭỗᶇṧⱦᶏꬼȶʂ.INT_ZERO) {
|
||||
gridBuffer[Bãß.ℭỗᶇṧⱦᶏꬼȶʂ.INT_ZERO][y] = random.nextInt(100)<70? charSelect:Bãß.ℭỗᶇṧⱦᶏꬼȶʂ.CHAR_SPACE;
|
||||
} else {
|
||||
gridBuffer[Bãß.ℭỗᶇṧⱦᶏꬼȶʂ.INT_ZERO][y] = random.nextInt(100)<Bãß.ℭỗᶇṧⱦᶏꬼȶʂ.INT_ONE? charSelect:Bãß.ℭỗᶇṧⱦᶏꬼȶʂ.CHAR_SPACE;
|
||||
}
|
||||
if (gridBuffer[0][y]==Bãß.ℭỗᶇṧⱦᶏꬼȶʂ.CHAR_SPACE) {
|
||||
gridRank[y] = Bãß.ℭỗᶇṧⱦᶏꬼȶʂ.INT_ZERO;
|
||||
} else {
|
||||
gridRank[y]++;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue