skunkworks/Test.java

86 lines
4.4 KiB
Java
Raw Normal View History

2022-09-14 19:08:16 +02:00
import com.danitheskunk.skunkworks.*;
import com.danitheskunk.skunkworks.gfx.Color;
2022-10-09 05:36:12 +02:00
import com.danitheskunk.skunkworks.gfx.vt.Terminal;
import java.nio.charset.StandardCharsets;
2022-09-14 00:59:35 +02:00
public class Test {
2022-09-14 01:09:28 +02:00
public static void main(String[] args) {
2022-10-05 02:36:19 +02:00
/*
2022-09-27 04:41:21 +02:00
var windows = Window.getAllVisible();
System.out.printf("%d Open Windows:\n", windows.size());
for(var window: windows) {
System.out.printf("%s -- %s -- %s\n", window.getTitle(), window.getClassName(), window.getExecutableName());
}
windows.get(0).setBorder(true);
windows.get(0).setBorderRounded(false);
2022-09-28 02:17:33 +02:00
windows.get(0).move(new Recti(1280, 720, 2560, 1440));
windows.get(0).debugPrintStyles();
windows.get(0).debugPrintStylesEx();
2022-09-28 02:17:33 +02:00
Window.onKey();
Window.onNewWindow();
Window.messageLoop();
2022-10-05 02:36:19 +02:00
*/
2022-09-14 05:47:24 +02:00
var engine = new Engine();
var window = engine.openWindow(new Vec2i(1280, 720), "Skunkworks");
var img = engine.loadImage("C:\\Users\\dani\\Videos\\Screenshot 2022-06-25 17-00-59.png");
var tex2 = window.loadTexture("C:\\art\\pixel stuff.png");
var tileset = window.loadTextureArray("C:\\stream\\coding\\rlc\\tilemap.png", new Vec2i(16, 16));
var font = window.loadFontTileset("EGA8x14.png");
2022-10-09 05:36:12 +02:00
var fontThin = window.loadFontTileset("fonts\\thin-6x12.png");
var fontThin2 = window.loadFontTileset("fonts\\thin-12x12.png");
var font2 = window.loadFontTTF("fonts\\LiberationSans-Regular.ttf", 16 * 8.f);
var font3 = window.loadFontTTF("fonts\\LiberationSans-Regular.ttf", 16);
var tex = window.loadTexture(img);
var slice = window.loadNineSlice("demoassets\\9slice-2.png");
2022-10-09 05:36:12 +02:00
var term = new Terminal(new Vec2i(80, 45), fontThin2, fontThin);
2022-10-05 02:36:19 +02:00
//window.setDebug(true);
2022-09-14 05:47:24 +02:00
2022-10-09 05:36:12 +02:00
term.setChar(new Vec2i(0, 0), 0xC9, Color.GREEN);
term.setChar(new Vec2i(9, 9), 0xC9, Color.GREEN);
term.setChar(new Vec2i(10, 10), 0xC9, Color.GREEN);
2022-10-09 07:23:50 +02:00
term.drawHalfString(new Vec2i(11, 11), "AHello world. This is a test.", Color.GREEN);
term.drawBoxDouble(new Recti(11, 12, 4, 4), Color.GREEN, Color.DARK_GRAY, true);
2022-10-09 05:36:12 +02:00
2022-09-14 05:47:24 +02:00
while(!window.shouldClose()) {
window.tick();
2022-09-14 19:08:16 +02:00
var renderContext = window.renderStart();
2022-10-09 05:36:12 +02:00
/*renderContext.drawTextureRectangle(
2022-10-06 08:22:30 +02:00
new Recti(0, 0, 1280, 720),
tex,
false
2022-10-09 05:36:12 +02:00
);*/
2022-10-06 07:37:54 +02:00
//renderContext.drawTextureRectangle(
// new Recti(new Vec2i(200, 100), tex2.getSize()),
// tex2,
// true
//);
2022-10-09 05:36:12 +02:00
/*renderContext.drawTextureRectangle(
2022-10-06 07:37:54 +02:00
new Recti(new Vec2i(400, 400), new Vec2i(160, 160)),
tileset.get(0x30),
true
2022-10-09 05:36:12 +02:00
);*/
2022-10-09 05:36:12 +02:00
//byte[] str = {(byte)0xC9, (byte)0xCD, (byte)0xCD, (byte)0xCD, (byte)0xCD, (byte)0xCD, (byte)0xCD, (byte)0xCD, (byte)0xCD, (byte)0xCD, (byte)0xCD, (byte)0xCD, (byte)0xCD, (byte)0xCD, (byte)0xCD, (byte)0xCD, (byte)0xCD, (byte)0xCD, (byte)0xCD, (byte)0xCD, (byte)0xCD, (byte)0xCD, (byte)0xCD, (byte)0xBB};
//renderContext.drawString(new Vec2i(36, 36), new String(str), fontThin2, new Color(0, 255, 0));
//renderContext.drawString(new Vec2i(36, 36), "\u00c9\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00BB", fontThin2, new Color(0, 255, 0));
//renderContext.drawString(new Vec2i(36, 48), "\u00ba \u00ba", fontThin2, new Color(0, 255, 0));
//renderContext.drawString(new Vec2i(36, 60), "\u00ba \u00ba", fontThin2, new Color(0, 255, 0));
//renderContext.drawString(new Vec2i(36, 72), "\u00c8\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00cd\u00BC", fontThin2, new Color(0, 255, 0));
//renderContext.drawString(new Vec2i(48, 48), "The quick brown fox jumps over the lazy dog", fontThin, new Color(0, 255, 0));
//renderContext.drawString(new Vec2i(48, 60), "Soft Kitty, Warm Kitty, Little Ball of Fur. Happy Kitty, Sleepy Kitty, Purr Purr Purr.", fontThin, new Color(0, 255, 0));
2022-10-05 02:36:19 +02:00
2022-10-09 05:36:12 +02:00
renderContext.drawTerminal(term);
2022-10-09 05:36:12 +02:00
//renderContext.drawNineSlice(slice, new Recti(100, 100, 75, 23));
//renderContext.drawString(new Vec2i(118, 117), "Meow", font3, new Color(0,0,0));
2022-10-09 05:36:12 +02:00
//renderContext.drawString(new Vec2i(122, 105), "Meow", font, new Color(0,0,0));
2022-09-14 19:08:16 +02:00
window.renderFinish(renderContext);
2022-09-14 05:47:24 +02:00
}
2022-10-05 02:36:19 +02:00
2022-09-14 01:09:28 +02:00
}
2022-09-14 00:59:35 +02:00
}