Crosshair + Images
BIN
cubyz-client/assets/cubyz/textures/crosshair.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
24
cubyz-client/src/io/cubyz/ui/GameOverlay.java
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -31,6 +31,7 @@ public class MainMenuGUI extends MenuGUI {
|
|||||||
world.generate();
|
world.generate();
|
||||||
Cubyz.gameUI.setMenu(null);
|
Cubyz.gameUI.setMenu(null);
|
||||||
Cubyz.loadWorld(world);
|
Cubyz.loadWorld(world);
|
||||||
|
Cubyz.gameUI.addOverlay(new GameOverlay());
|
||||||
Cubyz.log.info("World Generated!");
|
Cubyz.log.info("World Generated!");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ import java.util.ArrayList;
|
|||||||
import org.jungle.hud.Font;
|
import org.jungle.hud.Font;
|
||||||
import org.jungle.hud.Hud;
|
import org.jungle.hud.Hud;
|
||||||
import org.lwjgl.nanovg.NVGColor;
|
import org.lwjgl.nanovg.NVGColor;
|
||||||
|
import org.lwjgl.nanovg.NVGPaint;
|
||||||
import org.lwjgl.nanovg.NanoVG;
|
import org.lwjgl.nanovg.NanoVG;
|
||||||
|
|
||||||
import io.cubyz.CubzLogger;
|
import io.cubyz.CubzLogger;
|
||||||
@ -16,6 +17,7 @@ public class NGraphics {
|
|||||||
|
|
||||||
private static long nvg;
|
private static long nvg;
|
||||||
private static NVGColor color = NVGColor.create();
|
private static NVGColor color = NVGColor.create();
|
||||||
|
private static NVGPaint imagePaint = NVGPaint.create();
|
||||||
private static int textAlign = NVG_ALIGN_LEFT | NVG_ALIGN_TOP;
|
private static int textAlign = NVG_ALIGN_LEFT | NVG_ALIGN_TOP;
|
||||||
|
|
||||||
private static final boolean LOG_OPERATIONS = false;
|
private static final boolean LOG_OPERATIONS = false;
|
||||||
@ -26,6 +28,20 @@ public class NGraphics {
|
|||||||
NGraphics.nvg = nvg;
|
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) {
|
public static void fillCircle(int x, int y, int radius) {
|
||||||
if (LOG_OPERATIONS)
|
if (LOG_OPERATIONS)
|
||||||
CubzLogger.instance.fine("[NGRAPHICS] fill circle at " + x + ", " + y + " with radius " + radius);
|
CubzLogger.instance.fine("[NGRAPHICS] fill circle at " + x + ", " + y + " with radius " + radius);
|
||||||
|
8
cubyz-client/src/io/cubyz/ui/ToastManager.java
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
package io.cubyz.ui;
|
||||||
|
|
||||||
|
import org.jungle.Window;
|
||||||
|
|
||||||
|
public class ToastManager {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -20,7 +20,7 @@ public class DiscordIntegration {
|
|||||||
|
|
||||||
public static void startRPC() {
|
public static void startRPC() {
|
||||||
DiscordRPC lib = DiscordRPC.INSTANCE;
|
DiscordRPC lib = DiscordRPC.INSTANCE;
|
||||||
String appID = "527033701343952896"; //NOTE: Normal > 527033701343952896
|
String appID = "527033701343952896";
|
||||||
String steamID = "";
|
String steamID = "";
|
||||||
DiscordEventHandlers handlers = new DiscordEventHandlers();
|
DiscordEventHandlers handlers = new DiscordEventHandlers();
|
||||||
handlers.ready = new OnReady() {
|
handlers.ready = new OnReady() {
|
||||||
|
@ -26,8 +26,8 @@ public class TextureConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static BufferedImage convert(BufferedImage in, String name) {
|
public static BufferedImage convert(BufferedImage in, String name) {
|
||||||
File cached = new File("res/cache/cached_tex_" + name + ".png");
|
File cached = new File("cache/" + name.replace('/', '.') + ".png");
|
||||||
File cacheDir = new File("res/cache");
|
File cacheDir = new File("cache");
|
||||||
if (!cacheDir.exists())
|
if (!cacheDir.exists())
|
||||||
cacheDir.mkdirs();
|
cacheDir.mkdirs();
|
||||||
if (cached.exists()) {
|
if (cached.exists()) {
|
||||||
|