chore: Idk

This commit is contained in:
Jakub Žitník 2025-03-14 18:07:15 +01:00
parent d1a08eccf7
commit 20d9525fd2
Signed by: jzitnik
GPG Key ID: C577A802A6AF4EF3
5 changed files with 31 additions and 75 deletions

View File

@ -1,30 +1,12 @@
package cz.jzitnik.game.sprites.ui;
import cz.jzitnik.tui.ResourceLoader;
import cz.jzitnik.tui.Sprite;
import java.util.Optional;
public class Font extends Sprite {
public enum FontState {
A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, a, b, c, d, e, f, g, h, i, j, k,
l, m, n, o, p, q, r, s, t, u, v, w, x, y, z
}
public String getSprite() {
throw new RuntimeException("Invalid state");
}
public String getSprite(Enum key) {
// TODO: Implement font
String fullSprite = ResourceLoader.loadResource("ui/font.ans");
public class Font {
private String fullSprite = ResourceLoader.loadResource("ui/font.ans");
public String getChar(char character) {
// This does not work idk what is wrong with meee
return null;
}
@Override
public Optional<Class<Enum>> getStates() {
return Optional.empty();
}
}

View File

@ -85,10 +85,16 @@ public class InputHandlerThread extends Thread {
screenRenderer.render(game);
}
case 'q' -> {
System.out.println("Exiting game...");
isRunning[0] = false;
game.getGameStates().dependencies.gameSaver.save(game);
System.exit(0);
if (game.getWindow() != Window.WORLD) {
game.setWindow(Window.WORLD);
} else {
game.setWindow(Window.ESC);
}
screenRenderer.render(game);
// System.out.println("Exiting game...");
// isRunning[0] = false;
// game.getGameStates().dependencies.gameSaver.save(game);
// System.exit(0);
}
default -> {
}

View File

@ -1,5 +1,5 @@
package cz.jzitnik.game.ui;
public enum Window {
WORLD, INVENTORY, CRAFTING_TABLE, CHEST, FURNACE
WORLD, INVENTORY, CRAFTING_TABLE, CHEST, FURNACE, ESC
}

View File

@ -5,6 +5,7 @@ import cz.jzitnik.game.Game;
import cz.jzitnik.game.sprites.Steve;
import cz.jzitnik.game.blocks.Chest;
import cz.jzitnik.game.blocks.Furnace;
import cz.jzitnik.game.ui.Escape;
import cz.jzitnik.game.ui.Healthbar;
import cz.jzitnik.tui.utils.SpriteCombiner;
import lombok.Getter;
@ -54,6 +55,7 @@ public class ScreenRenderer {
case FURNACE -> ((Furnace) game.getWorld()[game.getGameStates().clickY][game.getGameStates().clickX]
.stream().filter(i -> i.getBlockId().equals("furnace")).toList().getFirst().getData()).render(game,
main, terminal, spriteList);
case ESC -> Escape.render(main, terminal);
case WORLD -> {
// World

View File

@ -1,48 +1,14 @@
    ▓▓▓▓       ▓▓▓▓▓▓▓▓▓▓       ▓▓▓▓▓▓▓▓   ▓▓▓▓▓▓▓▓▓▓▓   ▓▓▓▓▓▓▓▓▓▓▓▓░ ▓▓▓▓▓▓▓▓▓▓▓▓▓     ▓▓▓▓▓▓▓    ▓▓▓    ▓▓▓     ▓▓▓▓▓▓▓▓          ▓▓▓▓▓▓▓  ▓▓▓▓▓    ▓▓▓
  ▓▓▓▓▓▓▓       ▓▓▓▓   ░▓▓▓   ▒▓▓▓▓   ▓▓▓    ▓▓▓    ▓▓▓    ▓▓▓      ▓░   ▓▓▓▓     ▓▓   ▓▓▓▓▓  ▓▓▓▓  ▓▓▓    ▓▓▓       ▓▓▓▓              ▓▓▓░     ▓▓▓    ▓▓▓
▓▓▓▓   ░▓▓▓     ▓▓▓▓   ░▓▓▓  ▓▓▓▓            ▓▓▓    ▓▓▓    ▓▓▓  ▓▓       ▓▓▓▓ ▓▓     ▓▓▓▓▓          ▓▓▓    ▓▓▓       ▓▓▓▓              ▓▓▓░     ▓▓▓  ▓▓▓▓▓
▓▓▓▓   ░▓▓▓     ▓▓▓▓▓▓▓▓▓    ▓▓▓             ▓▓▓    ▓▓▓    ▓▓▓▓▓▓▓       ▓▓▓▓▓▓▓     ▓▓▓▓           ▓▓▓▓▓▓▓▓▓▓       ▓▓▓▓              ▓▓▓░     ▓▓▓▓▓▓▓▓  
▓▓▓▓▓▓▓▓▓▓▓     ▓▓▓▓   ░▓▓▓  ▓▓▓▓            ▓▓▓    ▓▓▓    ▓▓▓  ▓▓       ▓▓▓▓ ▓▓     ▓▓▓▓▓  ▓▓▓▓▓▓  ▓▓▓    ▓▓▓       ▓▓▓▓       ▓▓▓▒   ▓▓▓░     ▓▓▓  ▓▓▓▓▓
▓▓▓▓   ░▓▓▓     ▓▓▓▓   ░▓▓▓   ▒▓▓▓▓   ▓▓▓    ▓▓▓    ▓▓▓    ▓▓▓      ▓░   ▓▓▓▓          ▓▓▓▓▓  ▓▓▓▓  ▓▓▓    ▓▓▓       ▓▓▓▓       ▓▓▓▒   ▓▓▓░     ▓▓▓    ▓▓▓
▓▓▓▓   ░▓▓▓    ▓▓▓▓▓▓▓▓▓▓       ▓▓▓▓▓▓▓▓   ▓▓▓▓▓▓▓▓▓▓▓   ▓▓▓▓▓▓▓▓▓▓▓▓░ ▓▓▓▓▓▓▓           ▓▓▓▓▓▓▓▓▓  ▓▓▓    ▓▓▓     ▓▓▓▓▓▓▓▓       ▓▓▓▓▓▓▓     ▓▓▓▓▓    ▓▓▓
                                                                                                                                                          
▓▓▓▓▓▓▓▓       ▓▓▓     ░▓▓▓  ▓▓▓      ▓▓▓     ░▓▓▓▓▓     ▓▓▓▓▓▓▓▓▓▓▓     ▓▓▓▓▓▓▓     ▓▓▓▓▓▓▓▓▓▓▓     ▓▓▓▓▓▓▓▒     ▓▓▓▓▓▓▓▓▓▓    ▓▓▓▒   ▓▓▓░   ▓▓▓▓   ▓▓▓▓ 
  ▓▓▓▓         ▓▓▓▓▓  ▓▓▓▓▓  ▓▓▓▓▓    ▓▓▓    ▓▓▓  ▓▓▓▓     ▓▓▓    ▓▓▓░ ▓▓▓▓   ▓▓▓▓     ▓▓▓▓   ▓▓▓▓  ▓▓▓    ▓▓▓    ▓░ ▓▓▓▓  ▓    ▓▓▓▒   ▓▓▓░   ▓▓▓▓   ▓▓▓▓ 
  ▓▓▓▓         ▓▓▓▓▓▓▓▓▓▓▓▓  ▓▓▓▓▓▓▓  ▓▓▓  ▓▓▓░     ▓▓▓    ▓▓▓    ▓▓▓░ ▓▓▓▓   ▓▓▓▓     ▓▓▓▓   ▓▓▓▓  ▓▓▓▓▓            ▓▓▓▓       ▓▓▓▒   ▓▓▓░   ▓▓▓▓   ▓▓▓▓ 
  ▓▓▓▓         ▓▓▓ ▓▓▓▓░▓▓▓  ▓▓▓ ▓▓▓▓▓▓▓▓  ▓▓▓░     ▓▓▓    ▓▓▓▓▓▓▓▓▓▓  ▓▓▓▓   ▓▓▓▓     ▓▓▓▓▓▓▓▓▓▓   ░▓▓▓▓▓▓▓▒        ▓▓▓▓       ▓▓▓▒   ▓▓▓░   ▓▓▓▓   ▓▓▓▓ 
  ▓▓▓▓    ▓▓▓  ▓▓▓     ░▓▓▓  ▓▓▓   ▒▓▓▓▓▓  ▓▓▓░     ▓▓▓    ▓▓▓         ▓▓▓▓ ▓▓▓▓▓▓     ▓▓▓▓▓▓▓▓         ▒▓▓▓▓▓       ▓▓▓▓       ▓▓▓▒   ▓▓▓░   ▓▓▓▓   ▓▓▓▓ 
  ▓▓▓▓   ▓▓▓▓  ▓▓▓     ░▓▓▓  ▓▓▓      ▓▓▓    ▓▓▓  ▓▓▓▓     ▓▓▓           ▓▓▓▓▓▓▓       ▓▓▓▓ ▓▓▓▓▓   ▓▓▓    ▓▓▓       ▓▓▓▓       ▓▓▓▒   ▓▓▓░     ▓▓▓▓▓▓▓   
▓▓▓▓▓▓▓▓▓▓▓▓▓  ▓▓▓     ░▓▓▓  ▓▓▓      ▓▓▓     ░▓▓▓▓▓     ▓▓▓▓▓▓▓            ▓▓▓▓▓▓   ▓▓▓▓▓▓   ▓▓▓▓   ▓▓▓▓▓▓▓▒      ▓▓▓▓▓▓▓▓     ▓▓▓▓▓▓▓▓▓▓░      ▓▓▓▓     
                                                                                                                                                          
▓▓▓▓     ▓▓▓▓  ▓▓▓     ░▓▓▓  ▓▓▓    ▓▓▓▓   ▓▓▓▓▓▓▓▓▓▓▓▓                ▓▓▓▓▓▓                            ▓▓▓▓▓                     ▓▓▓▓▓▓                 
▓▓▓▓     ▓▓▓▓  ▓▓▓     ░▓▓▓  ▓▓▓    ▓▓▓▓   ▓▓▓░   ▓▓▓▓▒                  ▓▓▓▓                              ▓▓▓                    ▓▓▓  ▓▓▓░               
▓▓▓▓     ▓▓▓▓   ▓▓▓▓  ▓▓▓▓   ▓▓▓    ▓▓▓▓   ▓▓▓  ▓▓▓▓▓      ▓▓▓▓▓▓▓       ▓▓▓▓▓▓▓▓▓     ▓▓▓▓▓▓▓             ▓▓▓     ▓▓▓▓▓▓▓▓       ▓▓▓           ▓▓▓▓▓▓ ▓▓▓
▓▓▓▓ ░▓▓▓▓▓▓▓     ▓▓▓▓▓▒      ░▓▓▓▓▓▓▓░      ▒▓▓▓▓░             ▓▓▓▓     ▓▓▓▓   ▓▓▓▓ ▓▓▓▓   ▓▓▓▓    ░▓▓▓▓▓▓▓▓▓    ▓▓▓    ▓▓▓    ▓▓▓▓▓▓▓       ▓▓▓▓   ▓▓▓▓ 
▓▓▓▓▓▓▓▓▓▓▓▓▓   ▓▓▓▓  ▓▓▓▓      ▓▓▓▓        ▓▓▓▓     ▓▓   ▓▓▓▓▓▓▓▓▓▓     ▓▓▓▓   ▓▓▓▓ ▓▓▓▓           ▓▓▓    ▓▓▓    ▓▓▓▓▓▓▓▓▓▓      ▓▓▓         ▓▓▓▓   ▓▓▓▓ 
▓▓▓▓▓▓ ░▓▓▓▓▓  ▓▓▓     ░▓▓▓     ▓▓▓▓       ▓▓▓░     ▓▓▓  ▓▓▓▓   ▓▓▓▓     ▓▓▓▓   ▓▓▓▓ ▓▓▓▓   ▓▓▓▓    ▓▓▓    ▓▓▓    ▓▓▓             ▓▓▓           ▓▓▓▓▓▓▓▓▓ 
▓▓▓▓     ▓▓▓▓  ▓▓▓     ░▓▓▓   ▒▓▓▓▓▓▓▓     ▓▓▓▓▓▓▓▓▓▓▓▓    ▓▓▓▓▓▓ ▓▓▓░ ▓▓▓▓ ▓▓▓▓▓▓     ▓▓▓▓▓▓▓       ▓▓▓▓▓▓░▓▓▓▓   ▓▓▓▓▓▓▓▓     ▓▓▓▓▓▓▓              ▓▓▓▓ 
                                                                                                                                              ▒▒▒░▒▒▒▒▒   
▓▓▓▓▓▓            ▓▓▓▓            ▓▓▓▓     ▓▓▓▓▓           ▓▓▓▓▓                                                                                          
  ▓▓▓▓                                       ▓▓▓             ▓▓▓                                                                                          
  ▓▓▓▓ ░▓▓▓     ▓▓▓▓▓▓        ▒▓▓▓▓▓▓▓       ▓▓▓    ▓▓▓      ▓▓▓       ▓▓▓▓▓▓ ▓▓▓▓   ▓▓▓▓▓▓▓▓▓       ▓▓▓▓▓▓▓▒     ▓▓▓ ▓▓▓▓▓▓      ▓▓▓▓▓▓ ▓▓▓  ▓▓▓▓░▓▓▓▓   
  ▓▓▓▓▓▓▓▓▓▓▓     ▓▓▓▓            ▓▓▓▓       ▓▓▓  ▓▓▓▓▓      ▓▓▓       ▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓   ▓▓▓▓    ▓▓▓    ▓▓▓     ▓▓▓▓    ▓▓▓  ▓▓▓▒   ▓▓▓░     ▓▓▓  ▓▓▓▓ 
  ▓▓▓▓   ▓▓▓▓     ▓▓▓▓            ▓▓▓▓       ▓▓▓▓▓▓▓▓        ▓▓▓       ▓▓▓▓ ▓▓  ▓▓▓▓ ▓▓▓▓   ▓▓▓▓    ▓▓▓    ▓▓▓     ▓▓▓▓    ▓▓▓  ▓▓▓▒   ▓▓▓░     ▓▓▓  ▓▓▓▓ 
  ▓▓▓▓   ▓▓▓▓     ▓▓▓▓            ▓▓▓▓       ▓▓▓  ▓▓▓▓▒      ▓▓▓       ▓▓▓▓     ▓▓▓▓ ▓▓▓▓   ▓▓▓▓    ▓▓▓    ▓▓▓     ▓▓▓▓▓▓▓▓▓      ▓▓▓▓▓▓▓▓░     ▓▓▓       
▓▓▓▓▓▓   ▓▓▓▓   ▓▓▓▓▓▓▓▒     ▓▓▓  ▓▓▓▓     ▓▓▓▓▓    ▓▓▓    ▓▓▓▓▓▓▓     ▓▓▓▓     ▓▓▓▓ ▓▓▓▓   ▓▓▓▓     ▓▓▓▓▓▓▓▒      ▓▓▓▓                ▓▓▓░   ▓▓▓▓▓▓▓     
                              ▓░░░░░                                                                              ░░░░░░░            ░░░░░░░              
                    ▓▓                                                                                             ▓▓▓▓▓▓▓▓        ▓▓▓▓         ▓▓▓▓▓▓▓   
                  ▓▓▓▓                                                                                            ▓▓▓    ▓▓▓    ▓▓▓▓▓▓▓       ▓▓▓▓   ▓▓▓▓ 
 ░▓▓▓▓▓▓▓▓▓     ▓▓▓▓▓▓▓▓▓    ▓▓▓    ▓▓▓▓   ▓▓▓░   ▓▓▓▓   ▓▓▓▓     ▓▓▓░ ▓▓▓▓░   ░▓▓▓▓ ▓▓▓▓   ▓▓▓▓    ▓▓▓▓▓▓▓▓▓▓    ▓▓▓ ░▓▓▓▓▓       ▓▓▓▓             ░▓▓▓▓ 
▓▓▓▓              ▓▓▓▓       ▓▓▓    ▓▓▓▓   ▓▓▓░   ▓▓▓▓   ▓▓▓▓     ▓▓▓░  ▒▓▓▓▓▓▓▓▓▓▒  ▓▓▓▓   ▓▓▓▓    ▓▒  ▓▓▓▓░     ▓▓▓▓▓▓▓▓▓▓       ▓▓▓▓          ▓▓▓▓▓▓▒  
  ▓▓▓▓▓▓▓▓        ▓▓▓▓       ▓▓▓    ▓▓▓▓   ▓▓▓░   ▓▓▓▓   ▓▓▓▓░▓▓▓ ▓▓▓░    ▓▓▓▓▓▓▓    ▓▓▓▓   ▓▓▓▓      ▓▓▓▓▓       ▓▓▓▓▓  ▓▓▓       ▓▓▓▓        ▓▓▓▓       
       ░▓▓▓       ▓▓▓▓ ░▓    ▓▓▓    ▓▓▓▓     ▓▓▓▓▓▓▓     ▓▓▓▓▓▓▓▓▓▓▓▓░  ▓▓▓▓▓ ▓▓▓▓▓    ▓▓▓▓▓▓▓▓▓    ░▓▓▓▓  ░▓▓    ▓▓▓    ▓▓▓       ▓▓▓▓       ▓▓▓▓   ▓▓▓▓ 
▓▓▓▓▓▓▓▓▓           ▓▓▓▒      ▒▓▓▓▓▓▓ ▓▓▓     ░▓▓▓         ▓▓▓  ▓▓▓▓   ▓▓▓▓     ▓▓▓▓        ▓▓▓▓    ▓▓▓▓▓▓▓▓▓▓     ▓▓▓▓▓▓▓▓     ▓▓▓▓▓▓▓▓▓▓░   ▓▓▓▓▓▓▓▓▓▓▓ 
                                                                                     ▒▒▒▒▒▒▒▒▒                                                            
  ▓▓▓▓▓▓▓           ▓▓▓▓▓    ▓▓▓▓▓▓▓▓▓▓▓      ░▓▓▓▓▓     ▓▓▓▓▓▓▓▓▓▓▓     ▓▓▓▓▓▓▓       ▓▓▓▓▓▓▓                                    ▓▓▓  ▓▓▓░     ▓▓▓  ▓▓▓▓ 
▓▓▓▓   ░▓▓▓       ▓▓▓▓▓▓▓    ▓▓▓             ▓▓▓▓        ▓▓▓▓   ▓▓▓▓   ▓▓▓▓   ▓▓▓▓   ▓▓▓▓   ▓▓▓▓                                  ▓▓▓  ▓▓▓░     ▓▓▓  ▓▓▓▓ 
       ░▓▓▓    ▒▓▓▓▓▓ ▓▓▓    ▓▓▓▓▓▓▓▓▓░    ▓▓▓▓                ░▓▓▓▓   ▓▓▓▓   ▓▓▓▓   ▓▓▓▓   ▓▓▓▓                                  ▓▓▓  ▓▓▓░     ▓▓▓  ▓▓▓▓ 
    ▓▓▓▓▓      ▓▓▓▓   ▓▓▓           ▓▓▓▓   ▓▓▓▓▓▓▓▓▓▓        ░▓▓▓▓▓      ▓▓▓▓▓▓▓      ▓▓▓▓▓▓▓▓▓▓                                                          
       ░▓▓▓    ▓▓▓▓▓▓▓▓▓▓▓▓         ▓▓▓▓   ▓▓▓░   ▓▓▓▓      ▓▓▓▓       ▓▓▓▓   ▓▓▓▓          ▓▓▓▓                                                          
▓▓▓▓   ░▓▓▓           ▓▓▓    ▓▓▓    ▓▓▓▓   ▓▓▓░   ▓▓▓▓     ▓▓▓         ▓▓▓▓   ▓▓▓▓        ▓▓▓▓           ▓▓▓▒        ▓▓▓▓▓▓                               
  ░░░░░▓░             ░░░     ▒░░░░░░░       ░▓░░░░░       ░░░           ░░░░░░░       ░░░░░░            ░░░▒        ░░▓▓▓░