diff --git a/cubyz-client/assets/base/models/3d/block.obj b/cubyz-client/assets/cubyz/models/3d/block.obj similarity index 100% rename from cubyz-client/assets/base/models/3d/block.obj rename to cubyz-client/assets/cubyz/models/3d/block.obj diff --git a/cubyz-client/assets/base/models/block.json b/cubyz-client/assets/cubyz/models/block.json similarity index 100% rename from cubyz-client/assets/base/models/block.json rename to cubyz-client/assets/cubyz/models/block.json diff --git a/cubyz-client/assets/cubyz/textures/crosshair.png b/cubyz-client/assets/cubyz/textures/crosshair.png new file mode 100644 index 00000000..510f1eb0 Binary files /dev/null and b/cubyz-client/assets/cubyz/textures/crosshair.png differ diff --git a/cubyz-client/res/cache/cached_tex_dirt.png b/cubyz-client/cache/dirt.png similarity index 100% rename from cubyz-client/res/cache/cached_tex_dirt.png rename to cubyz-client/cache/dirt.png diff --git a/cubyz-client/res/cache/cached_tex_stone.png b/cubyz-client/cache/stone.png similarity index 100% rename from cubyz-client/res/cache/cached_tex_stone.png rename to cubyz-client/cache/stone.png diff --git a/cubyz-client/res/cache/cached_tex_water.png b/cubyz-client/cache/water.png similarity index 100% rename from cubyz-client/res/cache/cached_tex_water.png rename to cubyz-client/cache/water.png diff --git a/cubyz-client/src/io/cubyz/ui/GameOverlay.java b/cubyz-client/src/io/cubyz/ui/GameOverlay.java new file mode 100644 index 00000000..0d792237 --- /dev/null +++ b/cubyz-client/src/io/cubyz/ui/GameOverlay.java @@ -0,0 +1,24 @@ +package io.cubyz.ui; + +import org.jungle.Window; + +public class GameOverlay extends MenuGUI { + + int crosshair; + + @Override + public void init(long nvg) { + crosshair = NGraphics.loadImage("assets/cubyz/textures/crosshair.png"); + } + + @Override + public void render(long nvg, Window win) { + NGraphics.drawImage(crosshair, win.getWidth() / 2 - 16, win.getHeight() / 2 - 16, 32, 32); + } + + @Override + public boolean isFullscreen() { + return false; + } + +} diff --git a/cubyz-client/src/io/cubyz/ui/MainMenuGUI.java b/cubyz-client/src/io/cubyz/ui/MainMenuGUI.java index 852fd56b..3fb3e49c 100644 --- a/cubyz-client/src/io/cubyz/ui/MainMenuGUI.java +++ b/cubyz-client/src/io/cubyz/ui/MainMenuGUI.java @@ -31,6 +31,7 @@ public class MainMenuGUI extends MenuGUI { world.generate(); Cubyz.gameUI.setMenu(null); Cubyz.loadWorld(world); + Cubyz.gameUI.addOverlay(new GameOverlay()); Cubyz.log.info("World Generated!"); }); diff --git a/cubyz-client/src/io/cubyz/ui/NGraphics.java b/cubyz-client/src/io/cubyz/ui/NGraphics.java index 73e3ca9a..16a85b56 100644 --- a/cubyz-client/src/io/cubyz/ui/NGraphics.java +++ b/cubyz-client/src/io/cubyz/ui/NGraphics.java @@ -8,6 +8,7 @@ import java.util.ArrayList; import org.jungle.hud.Font; import org.jungle.hud.Hud; import org.lwjgl.nanovg.NVGColor; +import org.lwjgl.nanovg.NVGPaint; import org.lwjgl.nanovg.NanoVG; import io.cubyz.CubzLogger; @@ -16,6 +17,7 @@ public class NGraphics { private static long nvg; private static NVGColor color = NVGColor.create(); + private static NVGPaint imagePaint = NVGPaint.create(); private static int textAlign = NVG_ALIGN_LEFT | NVG_ALIGN_TOP; private static final boolean LOG_OPERATIONS = false; @@ -26,6 +28,20 @@ public class NGraphics { NGraphics.nvg = nvg; } + public static int loadImage(String path) { + if (LOG_OPERATIONS) + CubzLogger.instance.fine("[NGRAPHICS] Load Image " + path); + return nvgCreateImage(nvg, path, 0); + } + + public static void drawImage(int id, int x, int y, int width, int height) { + imagePaint = nvgImagePattern(nvg, x, y, width, height, 0, id, 1f, imagePaint); + nvgBeginPath(nvg); + nvgRect(nvg, x, y, width, height); + nvgFillPaint(nvg, imagePaint); + nvgFill(nvg); + } + public static void fillCircle(int x, int y, int radius) { if (LOG_OPERATIONS) CubzLogger.instance.fine("[NGRAPHICS] fill circle at " + x + ", " + y + " with radius " + radius); diff --git a/cubyz-client/src/io/cubyz/ui/ToastManager.java b/cubyz-client/src/io/cubyz/ui/ToastManager.java new file mode 100644 index 00000000..8b16106a --- /dev/null +++ b/cubyz-client/src/io/cubyz/ui/ToastManager.java @@ -0,0 +1,8 @@ +package io.cubyz.ui; + +import org.jungle.Window; + +public class ToastManager { + + +} diff --git a/cubyz-client/src/io/cubyz/utils/DiscordIntegration.java b/cubyz-client/src/io/cubyz/utils/DiscordIntegration.java index 8ebbdbaa..f170229a 100644 --- a/cubyz-client/src/io/cubyz/utils/DiscordIntegration.java +++ b/cubyz-client/src/io/cubyz/utils/DiscordIntegration.java @@ -20,7 +20,7 @@ public class DiscordIntegration { public static void startRPC() { DiscordRPC lib = DiscordRPC.INSTANCE; - String appID = "527033701343952896"; //NOTE: Normal > 527033701343952896 + String appID = "527033701343952896"; String steamID = ""; DiscordEventHandlers handlers = new DiscordEventHandlers(); handlers.ready = new OnReady() { diff --git a/cubyz-client/src/io/cubyz/utils/TextureConverter.java b/cubyz-client/src/io/cubyz/utils/TextureConverter.java index 0266a8b2..8abf88c7 100644 --- a/cubyz-client/src/io/cubyz/utils/TextureConverter.java +++ b/cubyz-client/src/io/cubyz/utils/TextureConverter.java @@ -26,8 +26,8 @@ public class TextureConverter { } public static BufferedImage convert(BufferedImage in, String name) { - File cached = new File("res/cache/cached_tex_" + name + ".png"); - File cacheDir = new File("res/cache"); + File cached = new File("cache/" + name.replace('/', '.') + ".png"); + File cacheDir = new File("cache"); if (!cacheDir.exists()) cacheDir.mkdirs(); if (cached.exists()) {