Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
031f5e5
Initial work on switching to Rivet.
oryxel1 May 27, 2026
a7e05c1
rivet test.
oryxel1 May 27, 2026
723cbc8
yeeted imgui for now.
oryxel1 May 27, 2026
2e3d85e
stuff.
oryxel1 May 27, 2026
a40e374
stuff.
oryxel1 May 30, 2026
a2525a2
stuff.
oryxel1 May 30, 2026
d077582
stuff.
oryxel1 Jun 2, 2026
36f214e
Update Rivet.
oryxel1 Jun 2, 2026
44f1cff
improve.
oryxel1 Jun 3, 2026
f67ad8d
more work, separate render elements into components and containers.
oryxel1 Jun 4, 2026
02303d2
more stuff.
oryxel1 Jun 4, 2026
61aa6e9
use scroll container.
oryxel1 Jun 4, 2026
0f24afd
Fixed broken timestamp and allat.
oryxel1 Jun 4, 2026
2540b53
more work or whatever.
oryxel1 Jun 4, 2026
b7302b7
whatever.
oryxel1 Jun 4, 2026
f398d4d
Test
oryxel1 Jun 4, 2026
0de08e4
stuff.
oryxel1 Jun 4, 2026
4dd5dc8
Fix gradlew.
oryxel1 Jun 4, 2026
5737e65
ok initially fix.
oryxel1 Jun 4, 2026
f246dda
Fix layout and proper scrolling.
oryxel1 Jun 5, 2026
a2a7c75
more work.
oryxel1 Jun 5, 2026
2ea064f
more work.
oryxel1 Jun 5, 2026
9842849
Fix scaling on a begg screen resolution for Rivet.
oryxel1 Jun 5, 2026
4db06fb
More work, selection stuff.
oryxel1 Jun 7, 2026
91845e0
more.
oryxel1 Jun 7, 2026
ef85150
Update ThinGL & Rivet.
oryxel1 Jun 7, 2026
4529e69
stuff
oryxel1 Jun 7, 2026
8bacd88
more work (broken).
oryxel1 Jun 7, 2026
ceca315
stuff.
oryxel1 Jun 8, 2026
e978169
Update Rivet.
oryxel1 Jun 28, 2026
fe47ccf
Fixes AO text tab.
oryxel1 Jun 28, 2026
65025fd
stuff.
oryxel1 Jun 30, 2026
3c77995
stuff.
oryxel1 Jul 2, 2026
8ace82f
Fix stuff and update Rivet for the N times.
oryxel1 Jul 3, 2026
3b4e7a9
Merge branch 'master' into rivet-port
oryxel1 Jul 3, 2026
aaac901
Tell JitPack to use Java 25.
oryxel1 Jul 3, 2026
0bd41b3
Oops.
oryxel1 Jul 3, 2026
5726597
Fix niche rivet bug.
oryxel1 Jul 4, 2026
0dafff7
Partial support for moving component around.
oryxel1 Jul 5, 2026
f1c8890
Fixed scrolling desync.
oryxel1 Jul 5, 2026
22e72d1
Disallowing object overlapping when adding new objects.
oryxel1 Jul 5, 2026
3d45fe5
Fixes crashes on minimize, update Rivet.
oryxel1 Jul 5, 2026
a8496b8
Downgrade Rivet.
oryxel1 Jul 5, 2026
7e9e643
Fix jitter object dragging.
oryxel1 Jul 5, 2026
cab78d1
Added extra initial scrolling.
oryxel1 Jul 5, 2026
1870bb4
Nicer looking scroll.
oryxel1 Jul 5, 2026
61dcff6
More fixes, still broken.
oryxel1 Jul 5, 2026
9ee636d
Fix stuff.
oryxel1 Jul 5, 2026
9e08fae
Fixes initial mouse drag.
oryxel1 Jul 7, 2026
339b4b7
Added a play button.
oryxel1 Jul 7, 2026
83a3a88
Fix: scroll bar not showing up for tab.
oryxel1 Jul 10, 2026
57cc444
Fix edge case behaviour for adding element.
oryxel1 Jul 10, 2026
d4250e3
more work and broken stuff.
oryxel1 Jul 12, 2026
9876e8a
stuff.
oryxel1 Jul 12, 2026
6ad34db
start on reworking the ui.
oryxel1 Jul 12, 2026
d08e689
Fix dragging object in.
oryxel1 Jul 12, 2026
245d483
oops.
oryxel1 Jul 12, 2026
bc1fa6a
Added proper object dragging.
oryxel1 Jul 12, 2026
d9f87d5
Fix selection manager.
oryxel1 Jul 12, 2026
688913f
Minor code cleanup.
oryxel1 Jul 12, 2026
47a813c
Minor improvements.
oryxel1 Jul 13, 2026
f156a54
Fixed dragging, minor improvements.
oryxel1 Jul 13, 2026
44c0f05
Move text object into Objects tab.
oryxel1 Jul 13, 2026
f6f720d
Added circle and rectangle.
oryxel1 Jul 13, 2026
40ef013
Move track tab container into timeline container.
oryxel1 Jul 14, 2026
d54494f
Delete everything, rework the UI from scratch.
oryxel1 Jul 15, 2026
d8b9a2e
More stuff.
oryxel1 Jul 15, 2026
449d4fb
More stuff.
oryxel1 Jul 15, 2026
3ba0789
stuff.
oryxel1 Jul 16, 2026
a102ec3
Update Rivet.
oryxel1 Jul 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ If you want to download the jar file to run this, just download in [releases](ht
or alternatively in [actions](https://github.com/oryxel1/Base/actions) sections.

## Usage and examples
Download **Java 21** or above, and then run `java -jar Base.jar` (or whatever the jar file is called).
Download **Java 25** or above, and then run `java -jar Base.jar` (or whatever the jar file is called).
<br><br> For example of how to use the program, you can look at the [wiki](https://github.com/oryxel1/Base/wiki).

## Contact
Expand Down
13 changes: 1 addition & 12 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,4 @@ subprojects {
implementation(rootProject.libs.google.gson)
implementation(rootProject.libs.configurate.yaml)
}
}
//
//dependencies {
// implementation(project(":editor"))
// implementation(project(":core"))
// implementation(project(":api"))
//
// implementation(libs.gdx.base)
// implementation(libs.commons.core)
//
// implementation(libs.imgui.binding)
//}
}
21 changes: 13 additions & 8 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,18 @@ var lwjgl = "3.3.6"
var lwjglStd = "3.4.0"
var libGdx = "1.13.1"

repositories {
maven("https://jitpack.io")
}

dependencies {
api(project(":api"))
api(project(":serializer"))

api(variantOf(libs.raphimc.thingl) { classifier("java17") })
api(libs.raphimc.thingl)
api(libs.commons.animations)
api(libs.unnamed.mocha)

api(libs.imgui.lwjgl3)
api(libs.imgui.binding)
api(libs.imgui.natives.windows)
api(libs.imgui.natives.linux)
api(libs.imgui.natives.macos)

api(libs.lwjgl.base)
api(libs.lwjgl.opengl)
api(libs.lwjgl.stb)
Expand All @@ -42,6 +40,8 @@ dependencies {
api(libs.jcraft.jorbis)
api(libs.javazoom.jlayer)

api(libs.weisj.jsvg)

listOf("natives-windows", "natives-windows-arm64", "natives-linux", "natives-linux-arm64").forEach {
api("org.lwjgl:lwjgl:$lwjgl:$it")
api("org.lwjgl:lwjgl-glfw:$lwjgl:$it")
Expand All @@ -57,4 +57,9 @@ dependencies {
}

api("com.badlogicgames.gdx:gdx-platform:$libGdx:natives-desktop")
}

api(libs.rivet.core)
api(libs.rivet.thingl.backend) {
exclude("org.lwjgl")
}
}
206 changes: 135 additions & 71 deletions core/src/main/java/oxy/bascenario/EngineRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,51 @@
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Graphics;
import com.badlogic.gdx.utils.ScreenUtils;
import imgui.ImGui;
import imgui.ImGuiIO;
import imgui.extension.implot.ImPlot;
import imgui.flag.ImGuiConfigFlags;
import imgui.flag.ImGuiKey;
import imgui.gl3.ImGuiImplGl3;
import imgui.glfw.ImGuiImplGlfw;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import net.lenni0451.commons.collections.Maps;
import net.lenni0451.rivet.Rivet;
import net.lenni0451.rivet.backend.render.deferred.DeferredRenderer;
import net.lenni0451.rivet.backend.render.deferred.RenderListExecutor;
import net.lenni0451.rivet.backend.thingl.ThinGLBackend;
import net.lenni0451.rivet.backend.thingl.render.ThinGLRenderer;
import net.lenni0451.rivet.backend.thingl.text.ThinGLFont;
import net.lenni0451.rivet.backend.thingl.util.GLFWMapper;
import net.lenni0451.rivet.input.keyboard.CharEvent;
import net.lenni0451.rivet.input.keyboard.KeyEvent;
import net.lenni0451.rivet.input.mouse.MouseButton;
import net.lenni0451.rivet.input.mouse.MouseButtonEvent;
import net.lenni0451.rivet.input.mouse.MouseMoveEvent;
import net.lenni0451.rivet.input.mouse.MouseScrollEvent;
import net.lenni0451.rivet.layout.fullsize.FullSizeLayout;
import net.lenni0451.rivet.math.Size;
import net.raphimc.thingl.ThinGL;
import net.raphimc.thingl.resource.font.instance.FontInstance;
import net.raphimc.thingl.resource.font.instance.FontInstanceSet;
import net.raphimc.thingl.text.util.GlyphPredicate;
import org.joml.Matrix4fStack;
import org.lwjgl.glfw.GLFW;
import org.lwjgl.glfw.GLFWFramebufferSizeCallback;
import oxy.bascenario.managers.AudioManager;
import oxy.bascenario.screens.ScenarioScreen;
import oxy.bascenario.utils.*;
import oxy.bascenario.utils.font.FontUtils;
import oxy.bascenario.utils.thingl.ThinGLExtended;
import oxy.bascenario.utils.thingl.ThinGLUtils;

import java.io.File;
import java.io.IOException;
import java.util.EnumSet;
import java.util.Set;

@RequiredArgsConstructor
public final class EngineRenderer extends Game {
private final ImGuiImplGlfw imGuiGlfw = new ImGuiImplGlfw();
private final ImGuiImplGl3 imGuiGl3 = new ImGuiImplGl3();
private ThinGLBackend backend;
private Rivet rivet;

private final Screen initialScreen;
private final boolean initialFullScreen;

public double mouseX, mouseY;

@SneakyThrows
@Override
public void create() {
long windowHandle = ((Lwjgl3Graphics) Gdx.graphics).getWindow().getWindowHandle();
Expand All @@ -49,14 +63,29 @@ public void create() {
// GLFW.glfwSetWindowAspectRatio(windowHandle, 16, 9);

GLFW.glfwSetCursorPosCallback(windowHandle, (window, x, y) -> {
if (window != windowHandle) {
return;
}

this.mouseX = x;
this.mouseY = y;

float[] mouseScale = this.getMouseScale();
this.rivet.onMouseMove(new MouseMoveEvent((float) x * mouseScale[0], (float) y * mouseScale[1], this.heldMouseButtons));
});
GLFW.glfwSetMouseButtonCallback(windowHandle, (window, button, action, mode) -> {
float[] mouseScale = this.getMouseScale();
final double[] xpos = new double[1];
final double[] ypos = new double[1];
GLFW.glfwGetCursorPos(window, xpos, ypos);

MouseButtonEvent event = GLFWMapper.mapMouseButton((float) xpos[0] * mouseScale[0], (float) ypos[0] * mouseScale[1], button, mode);
if (event != null) {
if (action == GLFW.GLFW_PRESS) {
this.heldMouseButtons.add(event.button());
this.rivet.onMouseDown(event);
} else if (action == GLFW.GLFW_RELEASE) {
this.rivet.onMouseUp(event);
this.heldMouseButtons.remove(event.button());
}
}

if (window != windowHandle || !(this.screen instanceof ExtendableScreen extendableScreen)) {
return;
}
Expand All @@ -71,25 +100,14 @@ public void create() {
}
});

ImGui.createContext();
ImPlot.createContext();
final ImGuiIO data = ImGui.getIO();
data.setIniFilename("base.imgui");
data.setFontGlobalScale(1F);
data.setConfigFlags(ImGuiConfigFlags.DockingEnable);
imGuiGlfw.init(windowHandle, true);
imGuiGl3.init();

if (!new File("base.imgui").exists()) {
try {
ImGui.loadIniSettingsFromMemory(new String(EngineRenderer.class.getResourceAsStream("/assets/base/base.imgui").readAllBytes()));
} catch (IOException ignored) {
}
}
FontUtils.loadFonts();

ImGuiUtils.setupTheme();
final FontInstance rivetFont = FontUtils.font("SFUIRegular");
this.backend = new ThinGLBackend(windowHandle, new ThinGLFont(new FontInstanceSet(Maps.linkedHashMap(rivetFont, GlyphPredicate.all()))));
this.rivet = new Rivet(this.backend, FullSizeLayout.INSTANCE, new Size(ThinGL.windowInterface().getFramebufferWidth(), ThinGL.windowInterface().getFramebufferHeight()));

FontUtils.loadFonts();
setupRivetCallbacks();
RivetUtil.setupTheme(rivet);

this.setScreen(this.initialScreen);

Expand All @@ -100,55 +118,47 @@ public void create() {

@Override
public void setScreen(Screen screen) {
ScenarioScreen.RENDER_WITHIN_IMGUI = !(screen instanceof ScenarioScreen);
TimeUtils.fakeTimeMillis = null;
super.setScreen(screen);

this.rivet.root().clearChildren();
if (screen instanceof ExtendableScreen extendableScreen) {
extendableScreen.init(this.rivet);
}
}

private boolean someTempHackyBool;

private boolean fullScreen;

private final ThinGLRenderer renderer = new ThinGLRenderer();
@Override
public void render() {
ScreenUtils.clear(0, 0, 0, 1, true);

AudioManager.getInstance().tick();

ThinGLUtils.GLOBAL_RENDER_STACK = new Matrix4fStack(8);
float x = ThinGL.windowInterface().getFramebufferWidth() / 1920F;
ThinGLUtils.GLOBAL_RENDER_STACK.scale(x, ThinGL.windowInterface().getFramebufferHeight() / 1080F, x);

ImGuiUtils.COUNTER = 0;
imGuiGl3.newFrame();
imGuiGlfw.newFrame();
ImGui.newFrame();

if (ImGui.getStyle().getFontScaleDpi() != 1) {
ImGui.pushFont(FontUtils.IM_FONT_REGULAR, 17);
ThinGLUtils.start();
if (screen != null && screen instanceof ExtendableScreen extendableScreen) {
extendableScreen.renderBehindRivet();
}
super.render();

if (ImGui.getStyle().getFontScaleDpi() != 1) {
ImGui.popFont();
}

ImGui.render();
ThinGL.programs().getMsaa().bindInput();
RenderListExecutor.INSTANCE.renderList(this.renderer, this.rivet.render(new DeferredRenderer()).complete());
ThinGL.programs().getMsaa().unbindInput();
ThinGL.programs().getMsaa().renderFullscreen();
ThinGL.programs().getMsaa().clearInput();
ThinGLUtils.end();

imGuiGl3.renderDrawData(ImGui.getDrawData());
ThinGLUtils.GLOBAL_RENDER_STACK = new Matrix4fStack(8);
float x = ThinGL.windowInterface().getFramebufferWidth() / 1920F;
ThinGLUtils.GLOBAL_RENDER_STACK.scale(x, ThinGL.windowInterface().getFramebufferHeight() / 1080F, x);

// if (GLFW.glfwGetWindowAttrib(((Lwjgl3Graphics) Gdx.graphics).getWindow().getWindowHandle(), GLFW.GLFW_MAXIMIZED) == 1) {
// int width = ThinGL.windowInterface().getFramebufferWidth(), height = ThinGL.windowInterface().getFramebufferHeight();
//// System.out.println(width/(float)height);
// if (width/(float)height != 16/9f) {
// boolean widthLargerHeight = ThinGL.windowInterface().getFramebufferWidth() > ThinGL.windowInterface().getFramebufferHeight();
// int fixedWidth = !widthLargerHeight ? width : (int) (height * 16/9f);
// int fixedHeight = !widthLargerHeight ? (int) (width * (9/16f)) : height;
//
// Gdx.graphics.setWindowedMode(fixedWidth, fixedHeight);
// }
// }
super.render();

if (ImGui.isKeyReleased(ImGuiKey.F11) || someTempHackyBool) {
if (/*ImGui.isKeyReleased(ImGuiKey.F11) || */ someTempHackyBool) {
if (this.fullScreen) {
Gdx.graphics.setUndecorated(false);
Gdx.graphics.setWindowedMode(1280, 720);
Expand All @@ -162,17 +172,71 @@ public void render() {
}
}

@Override
public void resize(int width, int height) {
super.resize(width, height);
private final Set<MouseButton> heldMouseButtons = EnumSet.noneOf(MouseButton.class);
private void setupRivetCallbacks() {
long windowHandle = ((Lwjgl3Graphics) Gdx.graphics).getWindow().getWindowHandle();

GLFW.glfwSetScrollCallback(windowHandle, (window, xoffset, yoffset) -> {
float[] mouseScale = this.getMouseScale();
final double[] xpos = new double[1];
final double[] ypos = new double[1];
GLFW.glfwGetCursorPos(window, xpos, ypos);
this.rivet.onMouseScroll(new MouseScrollEvent((float) xpos[0] * mouseScale[0], (float) ypos[0] * mouseScale[1], (float) xoffset, (float) yoffset));
});
GLFW.glfwSetKeyCallback(windowHandle, (_, key, _, action, mods) -> {
KeyEvent event = GLFWMapper.mapKey(key, mods);
if (event != null) {
if (action == GLFW.GLFW_PRESS) {
this.rivet.onKeyDown(event);
} else if (action == GLFW.GLFW_RELEASE) {
this.rivet.onKeyUp(event);
} else if (action == GLFW.GLFW_REPEAT) {
this.rivet.onKeyDown(event);
}
}
});
GLFW.glfwSetCharCallback(windowHandle, (_, codepoint) -> {
if (Character.isBmpCodePoint(codepoint)) {
this.rivet.onCharTyped(new CharEvent((char) codepoint));
} else if (Character.isValidCodePoint(codepoint)) {
this.rivet.onCharTyped(new CharEvent(Character.highSurrogate(codepoint)));
this.rivet.onCharTyped(new CharEvent(Character.lowSurrogate(codepoint)));
}
});
GLFWFramebufferSizeCallback[] oldCallback = new GLFWFramebufferSizeCallback[1];
oldCallback[0] = GLFW.glfwSetFramebufferSizeCallback(windowHandle, (window, width, height) -> {
if (oldCallback[0] != null) oldCallback[0].invoke(window, width, height);
this.rivet.size(new Size(width, height));
});
GLFW.glfwSetWindowFocusCallback(windowHandle, (window, focused) -> {
if (!focused) {
this.heldMouseButtons.clear();
this.rivet.unfocus();
}
});
}

private float[] getMouseScale() {
long windowHandle = ((Lwjgl3Graphics) Gdx.graphics).getWindow().getWindowHandle();

int[] windowSizeX = new int[1];
int[] windowSizeY = new int[1];
GLFW.glfwGetWindowSize(windowHandle, windowSizeX, windowSizeY);
int[] framebufferSizeX = new int[1];
int[] framebufferSizeY = new int[1];
GLFW.glfwGetFramebufferSize(windowHandle, framebufferSizeX, framebufferSizeY);
return new float[]{(float) framebufferSizeX[0] / windowSizeX[0], (float) framebufferSizeY[0] / windowSizeY[0]};
}

@Override
public void dispose() {
super.dispose();
imGuiGlfw.shutdown();
imGuiGl3.shutdown();
ImPlot.destroyContext();
ImGui.destroyContext();
public void resize(int width, int height) {
if (width <= 1920 && height <= 1080) {
this.rivet.scale(1);
} else {
float scale = (width + height) / (1920 + 1080f);
this.rivet.scale(scale);
}

super.resize(width, height);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public Texture2D texture(String scenario, FileInfo info) {

public Texture2D texture(String scenario, FileInfo info, boolean filter) {
try {
return ((TextureAsset)assets(scenario, info, AssetType.TEXTURE).asset()).get(filter);
return ((TextureAsset)assets(scenario, info, AssetType.TEXTURE).asset()).get(info.path().endsWith(".svg"), filter);
} catch (Exception ignored) {
if (INVALID_TEXTURE_KEY == Integer.MIN_VALUE) {
FileInfo invalidTexture = new FileInfo("assets/base/invalid.png", false, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import net.raphimc.thingl.gl.texture.animated.SequencedTexture;
import net.raphimc.thingl.image.animated.impl.AwtGifImage;
import net.raphimc.thingl.resource.image.animated.impl.AwtGifImage;

@RequiredArgsConstructor
public class GifAsset {
Expand Down
Loading