Compare commits
No commits in common. "4a25dc469488a2386b2c2bab1483307e31cefefc" and "aa68958a772bebffe426255d3118d22565c9369c" have entirely different histories.
4a25dc4694
...
aa68958a77
|
@ -40,12 +40,8 @@ public interface IWindow {
|
||||||
|
|
||||||
void setDebug(boolean on);
|
void setDebug(boolean on);
|
||||||
|
|
||||||
void setRenderSize(Vec2i size);
|
|
||||||
|
|
||||||
void setScaler(String scaler);
|
void setScaler(String scaler);
|
||||||
|
|
||||||
void setWindowSize(Vec2i size);
|
|
||||||
|
|
||||||
boolean shouldClose();
|
boolean shouldClose();
|
||||||
|
|
||||||
void startFrame();
|
void startFrame();
|
||||||
|
|
|
@ -17,8 +17,7 @@ public class Test3D extends BaseGame {
|
||||||
Model model;
|
Model model;
|
||||||
|
|
||||||
public Test3D() {
|
public Test3D() {
|
||||||
super(new Vec2i(1920, 1080), "Skunkworks 3d test");
|
super(new Vec2i(1920/4, 1080/4), "Skunkworks 3d test");
|
||||||
window.setRenderSize(new Vec2i(1920/8, 1080/8));
|
|
||||||
System.out.printf("assimp version: %d.%d.%d\n",
|
System.out.printf("assimp version: %d.%d.%d\n",
|
||||||
Assimp.aiGetVersionMajor(),
|
Assimp.aiGetVersionMajor(),
|
||||||
Assimp.aiGetVersionMinor(),
|
Assimp.aiGetVersionMinor(),
|
||||||
|
@ -26,8 +25,8 @@ public class Test3D extends BaseGame {
|
||||||
);
|
);
|
||||||
trans = 255;
|
trans = 255;
|
||||||
var path = "C:\\stream\\models\\Dani.vrm";
|
var path = "C:\\stream\\models\\Dani.vrm";
|
||||||
path = "C:\\stream\\models\\Amber_Arakada_V5_Blendshape.glb";
|
//path = "C:\\stream\\models\\Amber_Arakada_V5_Blendshape.glb";
|
||||||
path = "C:\\stream\\models\\Temp Chan 3.glb";
|
//path = "C:\\stream\\models\\Temp Chan 3.glb";
|
||||||
var bytes = engine.loadBytes(path);
|
var bytes = engine.loadBytes(path);
|
||||||
model = new Model(bytes, window);
|
model = new Model(bytes, window);
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package com.danitheskunk.skunkworks;
|
package com.danitheskunk.skunkworks;
|
||||||
|
|
||||||
import com.danitheskunk.skunkworks.audio.ISample;
|
import com.danitheskunk.skunkworks.audio.ISample;
|
||||||
import com.danitheskunk.skunkworks.gfx.Color;
|
import com.danitheskunk.skunkworks.gfx.font.FontTileset;
|
||||||
import com.danitheskunk.skunkworks.gfx.IRenderContext;
|
|
||||||
import com.danitheskunk.skunkworks.nodes.NodeSprite;
|
import com.danitheskunk.skunkworks.nodes.NodeSprite;
|
||||||
import com.danitheskunk.skunkworks.nodes.NodeText;
|
import com.danitheskunk.skunkworks.nodes.NodeText;
|
||||||
|
import org.lwjgl.glfw.GLFW;
|
||||||
|
|
||||||
public class TestNode extends BaseGame {
|
public class TestNode extends BaseGame {
|
||||||
private final ISample kick;
|
private final ISample kick;
|
||||||
|
@ -14,23 +14,15 @@ public class TestNode extends BaseGame {
|
||||||
float[] axes;
|
float[] axes;
|
||||||
|
|
||||||
public TestNode() {
|
public TestNode() {
|
||||||
super(new Vec2i(1920, 1080), "Skunkworks");
|
super(new Vec2i(1280, 720), "Skunkworks");
|
||||||
|
|
||||||
kick = loadSample("demoassets/kick.wav");
|
kick = loadSample("demoassets/kick.wav");
|
||||||
var font = window.loadFontTileset("fonts/ega-8x14.png");
|
var font = window.loadFontTileset("fonts/ega-8x14.png");
|
||||||
var font2 = window.loadFontTTF("fonts/m3x6.ttf", 12.7f);
|
var font2 = window.loadFontTTF("fonts/LiberationSans-Regular.ttf", 24.0f);
|
||||||
var str =
|
text = new NodeText(font, "Hello World! this is an extra long test meow meow nya nya! nyaaa!");
|
||||||
"As Gauntlet of Power enters the battlefield, choose a color.\n" +
|
text2 = new NodeText(font2, "Hello World! this is an extra long test meow meow nya nya! nyaaa!");
|
||||||
"\n" +
|
text.setMaxSize(new Vec2i(100, 100));
|
||||||
"Creatures of the chosen color get +1/+1.\n" +
|
text2.setMaxSize(new Vec2i(100, 100));
|
||||||
"\n" +
|
|
||||||
"Whenever a basic land is tapped for mana of the chosen color, its controller adds an additional one mana of that color.\n";
|
|
||||||
text = new NodeText(font, str);
|
|
||||||
text2 = new NodeText(font2, str);
|
|
||||||
text.setMaxSize(new Vec2i(300, 100));
|
|
||||||
text2.setMaxSize(new Vec2i(200, 100));
|
|
||||||
text2.setColor(Color.BLACK);
|
|
||||||
text.setColor(Color.BLACK);
|
|
||||||
sprite = new NodeSprite();
|
sprite = new NodeSprite();
|
||||||
sprite.setTexture(loadTexture("demoassets/card.png"));
|
sprite.setTexture(loadTexture("demoassets/card.png"));
|
||||||
sprite.setPos(new Vec2f(100, 100));
|
sprite.setPos(new Vec2f(100, 100));
|
||||||
|
@ -41,10 +33,6 @@ public class TestNode extends BaseGame {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
new TestNode().run();
|
|
||||||
}
|
|
||||||
|
|
||||||
void doThing() {
|
void doThing() {
|
||||||
sprite.tweenPos(new Vec2f(800, 400), 120).delay(60).then(() -> {
|
sprite.tweenPos(new Vec2f(800, 400), 120).delay(60).then(() -> {
|
||||||
System.out.println("yay! got there! now lets go home");
|
System.out.println("yay! got there! now lets go home");
|
||||||
|
@ -53,24 +41,17 @@ public class TestNode extends BaseGame {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void render(IRenderContext rc) {
|
|
||||||
rc.clear(Color.WHITE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void update(double delta) {
|
protected void update(double delta) {
|
||||||
text.setPos(new Vec2f(
|
text.setPos(new Vec2f(640 + 640 * gamepad.getAxis(0), 360 + 360 * gamepad.getAxis(1)));
|
||||||
640 + 640 * gamepad.getAxis(0),
|
text2.setPos(new Vec2f(440 + 640 * gamepad.getAxis(0), 360 + 360 * gamepad.getAxis(1)));
|
||||||
360 + 360 * gamepad.getAxis(1)
|
|
||||||
));
|
|
||||||
text2.setPos(new Vec2f(
|
|
||||||
440 + 640 * gamepad.getAxis(0),
|
|
||||||
360 + 360 * gamepad.getAxis(1)
|
|
||||||
));
|
|
||||||
if(gamepad.getButtonPressed(0)) {
|
if(gamepad.getButtonPressed(0)) {
|
||||||
playSample(kick);
|
playSample(kick);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
new TestNode().run();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,10 +23,6 @@ public abstract class Filter {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void apply() {
|
public void apply() {
|
||||||
//shouldn't be calculating size ratio every frame,
|
|
||||||
//but getting all the callbacks right is hard
|
|
||||||
calcSizeRatio();
|
|
||||||
|
|
||||||
output.bind();
|
output.bind();
|
||||||
input.bindTexture();
|
input.bindTexture();
|
||||||
program.use();
|
program.use();
|
||||||
|
@ -57,6 +53,7 @@ public abstract class Filter {
|
||||||
if(!resizing) {
|
if(!resizing) {
|
||||||
output.setSize(input.getSize());
|
output.setSize(input.getSize());
|
||||||
}
|
}
|
||||||
|
calcSizeRatio();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOutputSize(Vec2i size) {
|
public void setOutputSize(Vec2i size) {
|
||||||
|
@ -64,6 +61,7 @@ public abstract class Filter {
|
||||||
throw new RuntimeException("this filter doesn't allow output resizing");
|
throw new RuntimeException("this filter doesn't allow output resizing");
|
||||||
}
|
}
|
||||||
output.setSize(size);
|
output.setSize(size);
|
||||||
|
calcSizeRatio();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void calcSizeRatio() {
|
private void calcSizeRatio() {
|
||||||
|
|
|
@ -154,22 +154,12 @@ public class Window extends BaseWindow {
|
||||||
pipeline2D.setDebug(on);
|
pipeline2D.setDebug(on);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setRenderSize(Vec2i size) {
|
|
||||||
framebuffer.setSize(size);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setScaler(String scaler) {
|
public void setScaler(String scaler) {
|
||||||
super.setScaler(scaler);
|
super.setScaler(scaler);
|
||||||
mouse.setScaler(scalers.get(scaler));
|
mouse.setScaler(scalers.get(scaler));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setWindowSize(Vec2i size) {
|
|
||||||
glfwSetWindowSize(window, size.getX(), size.getY());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldClose() {
|
public boolean shouldClose() {
|
||||||
return shouldClose;
|
return shouldClose;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.danitheskunk.skunkworks.nodes;
|
package com.danitheskunk.skunkworks.nodes;
|
||||||
|
|
||||||
import com.danitheskunk.skunkworks.Vec2i;
|
import com.danitheskunk.skunkworks.Vec2i;
|
||||||
import com.danitheskunk.skunkworks.gfx.Color;
|
|
||||||
import com.danitheskunk.skunkworks.gfx.IRenderContext;
|
import com.danitheskunk.skunkworks.gfx.IRenderContext;
|
||||||
import com.danitheskunk.skunkworks.gfx.font.IFont;
|
import com.danitheskunk.skunkworks.gfx.font.IFont;
|
||||||
|
|
||||||
|
@ -9,7 +8,6 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class NodeText extends Node {
|
public class NodeText extends Node {
|
||||||
private Color color;
|
|
||||||
private IFont font;
|
private IFont font;
|
||||||
private List<String> lines;
|
private List<String> lines;
|
||||||
private Vec2i maxSize;
|
private Vec2i maxSize;
|
||||||
|
@ -20,7 +18,6 @@ public class NodeText extends Node {
|
||||||
maxSize = Vec2i.ZERO;
|
maxSize = Vec2i.ZERO;
|
||||||
lines = new ArrayList<>();
|
lines = new ArrayList<>();
|
||||||
setText(text);
|
setText(text);
|
||||||
color = Color.WHITE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void layoutText() {
|
private void layoutText() {
|
||||||
|
@ -47,15 +44,11 @@ public class NodeText extends Node {
|
||||||
public void render(IRenderContext rc) {
|
public void render(IRenderContext rc) {
|
||||||
Vec2i pos = getAbsolutePos().toVec2i();
|
Vec2i pos = getAbsolutePos().toVec2i();
|
||||||
for(var line : lines) {
|
for(var line : lines) {
|
||||||
rc.drawString(pos, line, font, color);
|
rc.drawString(pos, line, font);
|
||||||
pos = Vec2i.add(pos, new Vec2i(0, font.getLineHeight()));
|
pos = Vec2i.add(pos, new Vec2i(0, font.getLineHeight()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setColor(Color color) {
|
|
||||||
this.color = color;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFont(IFont font) {
|
public void setFont(IFont font) {
|
||||||
this.font = font;
|
this.font = font;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue