Compare commits

..

No commits in common. "4a25dc469488a2386b2c2bab1483307e31cefefc" and "aa68958a772bebffe426255d3118d22565c9369c" have entirely different histories.

6 changed files with 20 additions and 63 deletions

View File

@ -40,12 +40,8 @@ public interface IWindow {
void setDebug(boolean on);
void setRenderSize(Vec2i size);
void setScaler(String scaler);
void setWindowSize(Vec2i size);
boolean shouldClose();
void startFrame();

View File

@ -17,8 +17,7 @@ public class Test3D extends BaseGame {
Model model;
public Test3D() {
super(new Vec2i(1920, 1080), "Skunkworks 3d test");
window.setRenderSize(new Vec2i(1920/8, 1080/8));
super(new Vec2i(1920/4, 1080/4), "Skunkworks 3d test");
System.out.printf("assimp version: %d.%d.%d\n",
Assimp.aiGetVersionMajor(),
Assimp.aiGetVersionMinor(),
@ -26,8 +25,8 @@ public class Test3D extends BaseGame {
);
trans = 255;
var path = "C:\\stream\\models\\Dani.vrm";
path = "C:\\stream\\models\\Amber_Arakada_V5_Blendshape.glb";
path = "C:\\stream\\models\\Temp Chan 3.glb";
//path = "C:\\stream\\models\\Amber_Arakada_V5_Blendshape.glb";
//path = "C:\\stream\\models\\Temp Chan 3.glb";
var bytes = engine.loadBytes(path);
model = new Model(bytes, window);

View File

@ -1,10 +1,10 @@
package com.danitheskunk.skunkworks;
import com.danitheskunk.skunkworks.audio.ISample;
import com.danitheskunk.skunkworks.gfx.Color;
import com.danitheskunk.skunkworks.gfx.IRenderContext;
import com.danitheskunk.skunkworks.gfx.font.FontTileset;
import com.danitheskunk.skunkworks.nodes.NodeSprite;
import com.danitheskunk.skunkworks.nodes.NodeText;
import org.lwjgl.glfw.GLFW;
public class TestNode extends BaseGame {
private final ISample kick;
@ -14,23 +14,15 @@ public class TestNode extends BaseGame {
float[] axes;
public TestNode() {
super(new Vec2i(1920, 1080), "Skunkworks");
super(new Vec2i(1280, 720), "Skunkworks");
kick = loadSample("demoassets/kick.wav");
var font = window.loadFontTileset("fonts/ega-8x14.png");
var font2 = window.loadFontTTF("fonts/m3x6.ttf", 12.7f);
var str =
"As Gauntlet of Power enters the battlefield, choose a color.\n" +
"\n" +
"Creatures of the chosen color get +1/+1.\n" +
"\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);
var font2 = window.loadFontTTF("fonts/LiberationSans-Regular.ttf", 24.0f);
text = new NodeText(font, "Hello World! this is an extra long test meow meow nya nya! nyaaa!");
text2 = new NodeText(font2, "Hello World! this is an extra long test meow meow nya nya! nyaaa!");
text.setMaxSize(new Vec2i(100, 100));
text2.setMaxSize(new Vec2i(100, 100));
sprite = new NodeSprite();
sprite.setTexture(loadTexture("demoassets/card.png"));
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() {
sprite.tweenPos(new Vec2f(800, 400), 120).delay(60).then(() -> {
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
protected void update(double delta) {
text.setPos(new Vec2f(
640 + 640 * gamepad.getAxis(0),
360 + 360 * gamepad.getAxis(1)
));
text2.setPos(new Vec2f(
440 + 640 * gamepad.getAxis(0),
360 + 360 * gamepad.getAxis(1)
));
text.setPos(new Vec2f(640 + 640 * gamepad.getAxis(0), 360 + 360 * gamepad.getAxis(1)));
text2.setPos(new Vec2f(440 + 640 * gamepad.getAxis(0), 360 + 360 * gamepad.getAxis(1)));
if(gamepad.getButtonPressed(0)) {
playSample(kick);
}
}
public static void main(String[] args) {
new TestNode().run();
}
}

View File

@ -23,10 +23,6 @@ public abstract class Filter {
}
public void apply() {
//shouldn't be calculating size ratio every frame,
//but getting all the callbacks right is hard
calcSizeRatio();
output.bind();
input.bindTexture();
program.use();
@ -57,6 +53,7 @@ public abstract class Filter {
if(!resizing) {
output.setSize(input.getSize());
}
calcSizeRatio();
}
public void setOutputSize(Vec2i size) {
@ -64,6 +61,7 @@ public abstract class Filter {
throw new RuntimeException("this filter doesn't allow output resizing");
}
output.setSize(size);
calcSizeRatio();
}
private void calcSizeRatio() {

View File

@ -154,22 +154,12 @@ public class Window extends BaseWindow {
pipeline2D.setDebug(on);
}
@Override
public void setRenderSize(Vec2i size) {
framebuffer.setSize(size);
}
@Override
public void setScaler(String scaler) {
super.setScaler(scaler);
mouse.setScaler(scalers.get(scaler));
}
@Override
public void setWindowSize(Vec2i size) {
glfwSetWindowSize(window, size.getX(), size.getY());
}
@Override
public boolean shouldClose() {
return shouldClose;

View File

@ -1,7 +1,6 @@
package com.danitheskunk.skunkworks.nodes;
import com.danitheskunk.skunkworks.Vec2i;
import com.danitheskunk.skunkworks.gfx.Color;
import com.danitheskunk.skunkworks.gfx.IRenderContext;
import com.danitheskunk.skunkworks.gfx.font.IFont;
@ -9,7 +8,6 @@ import java.util.ArrayList;
import java.util.List;
public class NodeText extends Node {
private Color color;
private IFont font;
private List<String> lines;
private Vec2i maxSize;
@ -20,7 +18,6 @@ public class NodeText extends Node {
maxSize = Vec2i.ZERO;
lines = new ArrayList<>();
setText(text);
color = Color.WHITE;
}
private void layoutText() {
@ -47,15 +44,11 @@ public class NodeText extends Node {
public void render(IRenderContext rc) {
Vec2i pos = getAbsolutePos().toVec2i();
for(var line : lines) {
rc.drawString(pos, line, font, color);
rc.drawString(pos, line, font);
pos = Vec2i.add(pos, new Vec2i(0, font.getLineHeight()));
}
}
public void setColor(Color color) {
this.color = color;
}
public void setFont(IFont font) {
this.font = font;
}