Moved to package prefixes and added src split for resouces

This commit is contained in:
Willem 2022-02-04 18:35:05 +01:00
parent 58264ebe4c
commit 45caf26987
45 changed files with 22 additions and 24 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 373 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,9 @@
#ifdef GL_ES
precision mediump float;
#endif
uniform vec4 u_color;
void main() {
gl_FragColor = vec4(u_color);
}

View file

@ -0,0 +1,10 @@
attribute vec3 a_position;
attribute vec3 a_normal;
attribute vec2 a_texCoord0;
uniform mat4 u_worldTrans;
uniform mat4 u_projTrans;
void main() {
gl_Position = u_projTrans * u_worldTrans * vec4(a_position, 1.0);
}

View file

@ -0,0 +1,7 @@
sourceCompatibility = appJvmCode
[compileJava, compileTestJava]*.options*.encoding = appEncoding
sourceSets.main.java.srcDirs = [ "src/main/"]
sourceSets.main.resources.srcDirs = [ "src/resources/" ]
sourceSets.test.java.srcDirs = [ "src/test/"]
sourceSets.test.resources.srcDirs = [ "src/test-resources/" ]

View file

@ -0,0 +1,248 @@
package love.distributedrebirth.demo4d;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.utils.ScreenUtils;
import imgui.ImGui;
import imgui.type.ImBoolean;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
import love.distributedrebirth.demo4d.matrix4d.ScreenMatrix4D;
import love.distributedrebirth.demo4d.music.MusicManager;
import love.distributedrebirth.demo4d.music.MusicPlayerRenderer;
import love.distributedrebirth.demo4d.music.MusicSongType;
import love.distributedrebirth.demo4d.screen.BasePartRenderer;
import love.distributedrebirth.demo4d.screen.BasicConsoleRenderer;
import love.distributedrebirth.demo4d.screen.HebrewWalletRenderer;
import love.distributedrebirth.demo4d.screen.ScreenCredits;
import love.distributedrebirth.demo4d.screen.ScreenDefault;
import love.distributedrebirth.demo4d.screen.ScreenHelp;
import love.distributedrebirth.demo4d.screen.ScreenIntro;
import love.distributedrebirth.demo4d.screen.ScreenIntroMission;
import love.distributedrebirth.demo4d.screen.ScreenUnicode4D;
import love.distributedrebirth.numberxd.base2t.part.warp.TOSWarpCore;
import net.spookygames.gdx.nativefilechooser.NativeFileChooser;
/**
* Main loop render dispatcher and event handling.
*/
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class Demo4DMain extends Game {
private List<String> args;
public NativeFileChooser fileChooser;
public SpriteBatch batch;
public BitmapFont font;
public OrthographicCamera camera;
public final int viewWidth;
public final int viewHeight;
public MusicManager music;
private Map<Class<? extends Screen>,Screen> screens;
private Map<Class<? extends ImGuiRenderer>,ImGuiRenderer> widgets;
private ImBoolean showImGuiDemo = new ImBoolean(false);
private ImBoolean showMusicPlayer = new ImBoolean(false);
private ImBoolean showHebrewWallet = new ImBoolean(false);
private ImBoolean showBasePart = new ImBoolean(false);
private ImBoolean showBasicConsole = new ImBoolean(false);
public Demo4DMain(List<String> args, int viewWidth, int viewHeight, NativeFileChooser fileChooser) {
this.args = args;
this.viewWidth = viewWidth;
this.viewHeight = viewHeight;
this.fileChooser = fileChooser;
}
public void create() {
batch = new SpriteBatch();
font = new BitmapFont();
camera = new OrthographicCamera();
camera.setToOrtho(false, viewWidth, viewHeight);
camera.update();
batch.setProjectionMatrix(camera.combined);
music = new MusicManager();
music.init(args.contains("no-music"));
ImGuiSetup.init();
widgets = new HashMap<>();
putWidget(new MusicPlayerRenderer(this));
putWidget(new HebrewWalletRenderer(this));
putWidget(new BasePartRenderer(this));
putWidget(new BasicConsoleRenderer(this));
screens = new HashMap<>();
putScreen(new ScreenIntro(this));
putScreen(new ScreenIntroMission(this));
putScreen(new ScreenDefault(this));
putScreen(new ScreenCredits(this));
putScreen(new ScreenHelp(this));
putScreen(new ScreenMatrix4D(this));
putScreen(new ScreenUnicode4D(this));
if (args.contains("no-intro")) {
selectScreen(ScreenDefault.class);
music.play(MusicSongType.BACKGROUND);
} else {
selectScreen(ScreenIntro.class);
}
if (args.contains("full-screen")) {
Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode());
}
int fileArgu = args.indexOf("warpcore-load");
if (fileArgu != -1) {
// TODO: load warpcore
}
if (!args.contains("warpcore-nolock")) {
TOSWarpCore.INSTANCE.BãßLockWarpCipher();
}
}
@Override
public void dispose() {
ImGuiSetup.dispose();
for (Screen screen:screens.values()) {
screen.dispose();
}
music.dispose();
batch.dispose();
font.dispose();
}
private void putScreen(Screen screen) {
screens.put(screen.getClass(), screen);
}
private void putWidget(ImGuiRenderer widget) {
widgets.put(widget.getClass(), widget);
}
public void selectScreen(Class<? extends Screen> screenClass) {
Screen screen = screens.get(screenClass);
if (screen == null) {
throw new NullPointerException("Unknow screen: "+screenClass);
}
setScreen(screen);
}
@Override
public void render() {
ScreenUtils.clear(0f, 0f, 0f, 1f, true);
ImGuiSetup.imGuiImp.newFrame();
ImGui.newFrame();
if (hasMainMenu()) {
renderMenu();
}
if (showImGuiDemo.get()) {
ImGui.showDemoWindow(showImGuiDemo);
}
if (showMusicPlayer.get()) {
widgets.get(MusicPlayerRenderer.class).render(showMusicPlayer);
}
if (showHebrewWallet.get()) {
widgets.get(HebrewWalletRenderer.class).render(showHebrewWallet);
}
if (showBasePart.get()) {
widgets.get(BasePartRenderer.class).render(showBasePart);
}
if (showBasicConsole.get()) {
widgets.get(BasicConsoleRenderer.class).render(showBasicConsole);
}
if (screen != null) {
screen.render(Gdx.graphics.getDeltaTime());
}
if (Gdx.input.isKeyPressed(Keys.ESCAPE)) {
selectScreen(ScreenDefault.class);
}
ImGui.render();
ImGuiSetup.imGuiGlImp.renderDrawData(ImGui.getDrawData());
}
private void renderMenu() {
ImGui.beginMainMenuBar();
if (ImGui.beginMenu("Demo")) {
if (Gdx.graphics.isFullscreen()) {
if (ImGui.menuItem("Window Mode")) {
Gdx.graphics.setWindowedMode(viewWidth, viewHeight);
}
} else {
if (ImGui.menuItem("Full Screen")) {
Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode());
}
}
ImGui.separator();
if (ImGui.menuItem("Matrix4D")) {
selectScreen(ScreenMatrix4D.class);
}
if (ImGui.menuItem("Unicode4D")) {
selectScreen(ScreenUnicode4D.class);
}
ImGui.separator();
if (ImGui.menuItem("Exit")) {
dispose();
System.exit(0);
}
ImGui.endMenu();
}
if (ImGui.beginMenu("Widgets")) {
if (ImGui.menuItem("ImGui Demo")) {
showImGuiDemo.set(true);
}
ImGui.separator();
if (ImGui.menuItem("Hebrew Wallet")) {
showHebrewWallet.set(true);
}
if (ImGui.menuItem("Base Part")) {
showBasePart.set(true);
}
if (ImGui.menuItem("Basic Console")) {
showBasicConsole.set(true);
}
ImGui.separator();
if (ImGui.menuItem("Music Player")) {
showMusicPlayer.set(true);
}
ImGui.endMenu();
}
if (ImGui.beginMenu("Help")) {
if (ImGui.menuItem("Credits")) {
selectScreen(ScreenCredits.class);
}
ImGui.separator();
if (ImGui.menuItem("Help")) {
selectScreen(ScreenHelp.class);
}
ImGui.endMenu();
}
ImGui.endMainMenuBar();
}
private boolean hasMainMenu() {
Screen screen = getScreen();
if (screen == null) {
return false;
}
if (ScreenIntro.class.equals(screen.getClass())) {
return false;
}
if (ScreenIntroMission.class.equals(screen.getClass())) {
return false;
}
if (ScreenCredits.class.equals(screen.getClass())) {
return false;
}
if (ScreenHelp.class.equals(screen.getClass())) {
return false;
}
return true;
}
}

View file

@ -0,0 +1,14 @@
package love.distributedrebirth.demo4d;
import com.badlogic.gdx.ScreenAdapter;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class Demo4DMainAdapter extends ScreenAdapter {
protected final Demo4DMain main;
public Demo4DMainAdapter(Demo4DMain main) {
this.main = main;
}
}

View file

@ -0,0 +1,10 @@
package love.distributedrebirth.demo4d;
import imgui.type.ImBoolean;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public interface ImGuiRenderer {
void render(ImBoolean widgetOpen);
}

View file

@ -0,0 +1,13 @@
package love.distributedrebirth.demo4d;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
abstract public class ImGuiRendererMain implements ImGuiRenderer {
protected final Demo4DMain main;
public ImGuiRendererMain(Demo4DMain main) {
this.main = main;
}
}

View file

@ -0,0 +1,65 @@
package love.distributedrebirth.demo4d;
import com.badlogic.gdx.Gdx;
import imgui.ImFontConfig;
import imgui.ImFontGlyphRangesBuilder;
import imgui.ImGui;
import imgui.ImGuiIO;
import imgui.gl3.ImGuiImplGl3;
import imgui.glfw.ImGuiImplGlfw;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
/**
* Create and shutdown of ImGui and font activations.
*/
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class ImGuiSetup {
public static final ImGuiImplGlfw imGuiImp = new ImGuiImplGlfw();
public static final ImGuiImplGl3 imGuiGlImp = new ImGuiImplGl3();
public static void init() {
long windowHandle = -1;
try {
Object window = Gdx.graphics.getClass().getMethod("getWindow").invoke(Gdx.graphics);
windowHandle = (Long)window.getClass().getMethod("getWindowHandle").invoke(window);
} catch (Exception e) {
throw new RuntimeException(e);
}
ImGui.createContext();
initFonts(ImGui.getIO());
imGuiImp.init(windowHandle, true);
imGuiGlImp.init("#version 140");
ImGui.init();
ImGui.styleColorsLight();
}
private static void initFonts(final ImGuiIO io) {
io.getFonts().addFontDefault();
ImFontConfig fontConfig = new ImFontConfig();
fontConfig.setMergeMode(true);
ImFontGlyphRangesBuilder fontBuilder = new ImFontGlyphRangesBuilder();
addRangeUnicodePlane0(fontBuilder);
final short[] glyphRanges = fontBuilder.buildRanges();
io.getFonts().addFontFromMemoryTTF(Gdx.files.internal("font/NotoSansCJKjp-Medium.otf").readBytes(), 14, fontConfig, glyphRanges);
io.getFonts().addFontFromMemoryTTF(Gdx.files.internal("font/FreeSans.ttf").readBytes(), 14, fontConfig, glyphRanges);
fontConfig.destroy();
}
private static void addRangeUnicodePlane0(ImFontGlyphRangesBuilder fontBuilder) {
for (int c=0x0100;c<=0xFFEF;c++) {
StringBuilder buf = new StringBuilder();
buf.append(""+(char)c);
fontBuilder.addText(buf.toString());
}
}
public static void dispose() {
imGuiImp.dispose();
imGuiGlImp.dispose();
ImGui.destroyContext();
}
}

View file

@ -0,0 +1,257 @@
package love.distributedrebirth.demo4d.matrix4d;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.PerspectiveCamera;
import com.badlogic.gdx.graphics.VertexAttributes.Usage;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.BitmapFontCache;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g3d.Attribute;
import com.badlogic.gdx.graphics.g3d.Environment;
import com.badlogic.gdx.graphics.g3d.Material;
import com.badlogic.gdx.graphics.g3d.Model;
import com.badlogic.gdx.graphics.g3d.ModelBatch;
import com.badlogic.gdx.graphics.g3d.ModelInstance;
import com.badlogic.gdx.graphics.g3d.Shader;
import com.badlogic.gdx.graphics.g3d.attributes.BlendingAttribute;
import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute;
import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight;
import com.badlogic.gdx.graphics.g3d.utils.CameraInputController;
import com.badlogic.gdx.graphics.g3d.utils.ModelBuilder;
import com.badlogic.gdx.math.Matrix4;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.viewport.ScreenViewport;
import imgui.ImGui;
import imgui.flag.ImGuiCond;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
import love.distributedrebirth.demo4d.Demo4DMain;
import love.distributedrebirth.demo4d.Demo4DMainAdapter;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class ScreenMatrix4D extends Demo4DMainAdapter {
public Environment environment;
public PerspectiveCamera cam;
public CameraInputController camController;
public Shader shader;
public ModelBatch modelBatch;
private Model grid;
private Model model;
public Array<ModelInstance> modelInstances = new Array<ModelInstance>();
//endregion
//region Text rendering
public BitmapFont font;
public BitmapFontCache fontCache;
public final ScreenViewport uiViewport = new ScreenViewport();
public SpriteBatch spriteBatch;
/** World-space position of the text. (Corner of the cube.) */
public Vector3 textPosition = new Vector3(2.5f, 2.5f, 2.5f);
//endregion
private float colorDeltaTime = 0f;
private float colorFade = 0f;
private boolean colorPositive = true;
public ScreenMatrix4D(final Demo4DMain main) {
super(main);
this.create();
}
private void create() {
//region 3D Objects
environment = new Environment();
environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.4f, 0.4f, 0.4f, 1f));
environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -1f, -0.8f, -0.2f));
modelBatch = new ModelBatch();
cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
cam.position.set(10f, 10f, 10f);
cam.lookAt(0, 0, 0);
cam.near = 1f;
cam.far = 300f;
cam.update();
ModelBuilder modelBuilder = new ModelBuilder();
Material mat = new Material(ColorAttribute.createDiffuse(1f,1f,1f,.1f));
grid = modelBuilder.createLineGrid(33, 33, 1f, 1f, mat, Usage.Position | Usage.Normal);
model = modelBuilder.createBox(.3f, .3f, .3f,
new Material(ColorAttribute.createDiffuse(.1f,.1f,.1f,.1f),
new BlendingAttribute(.1f)
//new BlendingAttribute(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA)
),
Usage.Position | Usage.Normal);
//Matrix4 model1Offset = new Matrix4(new Vector3(5f,0f,0f), new Quaternion(0f,0f,0f,0f),new Vector3(1f,1f,1f));
Attribute bend = new BlendingAttribute(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
for (int x = -4; x < 6; x++) {
for (int y = 1; y < 11; y++) {
for (int z = -4; z < 7; z++) {
ModelInstance instance = new ModelInstance(model, x, y, z);
instance.materials.get(0).set(bend);
modelInstances.add(instance);
}
}
}
ModelInstance instance = new ModelInstance(grid, 0, 0, 0);
//instance.materials.get(0).set(bend);
modelInstances.add(instance);
shader = new UserColorShader();
shader.init();
camController = new CameraInputController(cam);
Gdx.input.setInputProcessor(camController);
//endregion
//region Text rendering
font = new BitmapFont();
fontCache = new BitmapFontCache(font, false);
spriteBatch = new SpriteBatch();
//endregion
}
/**
* Multiply 4x4 matrix {@code m} and 4D vector {$code (v, vW)} together.
* Store result {@code (x/w, y/w, z/w)} back in {@code v} and return {@code w}.
*/
private static float multiplyProjective(Matrix4 m, Vector3 v, float vW) {
final float[] mat = m.val;
final float x = v.x * mat[Matrix4.M00] + v.y * mat[Matrix4.M01] + v.z * mat[Matrix4.M02] + vW * mat[Matrix4.M03];
final float y = v.x * mat[Matrix4.M10] + v.y * mat[Matrix4.M11] + v.z * mat[Matrix4.M12] + vW * mat[Matrix4.M13];
final float z = v.x * mat[Matrix4.M20] + v.y * mat[Matrix4.M21] + v.z * mat[Matrix4.M22] + vW * mat[Matrix4.M23];
final float w = v.x * mat[Matrix4.M30] + v.y * mat[Matrix4.M31] + v.z * mat[Matrix4.M32] + vW * mat[Matrix4.M33];
final float iw = 1f / w;
v.set(x * iw, y * iw, z * iw);
return w;
}
@Override
public void render(float delta) {
colorDeltaTime += delta;
if (colorDeltaTime > 0.04f) {
colorDeltaTime = 0f;
if (colorPositive) {
colorFade += delta;
} else {
colorFade -= delta;
}
if (colorFade > 1f) {
colorPositive = false;
} else if (colorFade < .5f) {
colorPositive = true;
}
}
int i=0;
for (int x = -4; x < 6; x++) {
for (int y = 1; y < 11; y++) {
for (int z = -4; z < 7; z++) {
float red = .1f;
float green = (y+2f)/10f*colorFade;
float blue = .1f;
if (x == 3 || y == 1 || z == -1) {
red = (y+2f)/10f*colorFade;
green = 0f;
}
if (x == -1 || y == 10 || z == 5) {
green = 0f;
blue = (y+2f)/10f*colorFade;
}
ModelInstance instance = modelInstances.get(i++);
ColorAttribute attr = ColorAttribute.createDiffuse(red, green, blue, .2f);
instance.materials.get(0).set(attr);
}
}
}
//region 3D Objects
camController.update();
Gdx.gl.glViewport(0, 0, Gdx.graphics.getBackBufferWidth(), Gdx.graphics.getBackBufferHeight());
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
modelBatch.begin(cam);
for (ModelInstance instance : modelInstances) {
modelBatch.render(instance, shader);
}
modelBatch.end();
//endregion
//region Text rendering
// Multiply vector with world-space position with 3D projection-view matrix
final Vector3 clipSpacePos = new Vector3(textPosition);
final float w = multiplyProjective(cam.combined, clipSpacePos, 1f);
// Do not render the text if it is behind the camera or too far away
if (clipSpacePos.z >= -1f && clipSpacePos.z <= 1f) {
// Calculate the position on screen (clip space is [-1,1], we need [-size/2, size/2], but this depends on your viewport)
final float textPosX = clipSpacePos.x * Gdx.graphics.getWidth() * 0.5f;
final float textPosY = clipSpacePos.y * Gdx.graphics.getHeight() * 0.5f;
// Set the text normally. The position must be 0, otherwise the scaling won't work.
// If you don't want perspective scaling, you can set x,y to textPosX,textPosY directly and skip the next part.
fontCache.setText("Now in 3D", 0f, 0, 0f, Align.center, false);
// Size of the text in the world
final float fontSize = 5f;
// Scaling factor
final float fontScale = fontSize / w;
// Go through prepared vertices of the font cache and do necessary transformation
final int regionCount = font.getRegions().size;
for (int page = 0; page < regionCount; page++) {
final int vertexCount = fontCache.getVertexCount(page);
final float[] vertices = fontCache.getVertices(page);
for (int v = 0; v < vertexCount; v += 5) {
// This is why the text position must be 0 - otherwise the scaling would move the text
vertices[v] = vertices[v] * fontScale + textPosX;
vertices[v + 1] = vertices[v + 1] * fontScale + textPosY;
}
}
// Standard viewport update
uiViewport.update(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), true);
spriteBatch.setProjectionMatrix(uiViewport.getCamera().projection);
// Draw the text normally
spriteBatch.begin();
fontCache.draw(spriteBatch);
spriteBatch.end();
}
//endregion
ImGui.setNextWindowPos(300, 300, ImGuiCond.FirstUseEver);
ImGui.setNextWindowSize(320, 240, ImGuiCond.FirstUseEver);
ImGui.begin("Legends");
ImGui.text("ComputerNode: XCV 330");
ImGui.text("ComputerMatrix: 100 crew and 850 passengers");
ImGui.separator();
ImGui.textColored(255, 1, 1, 255, "Red is absolute line.");
ImGui.textColored(10, 1, 255, 255, "Blue is absolute line.");
ImGui.textColored(255, 1, 255, 255, "Pink is absolute node.");
ImGui.textColored(1, 255, 1, 255, "Green is relative node.");
ImGui.textColored(200, 200, 5, 255, "Yellow is I/O node.");
ImGui.textColored(1, 1, 1, 255, "White is dipavali route.");
ImGui.end();
}
@Override
public void dispose() {
shader.dispose();
modelBatch.dispose();
model.dispose();
}
}

View file

@ -0,0 +1,74 @@
package love.distributedrebirth.demo4d.matrix4d;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Camera;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.g3d.Renderable;
import com.badlogic.gdx.graphics.g3d.Shader;
import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute;
import com.badlogic.gdx.graphics.g3d.utils.RenderContext;
import com.badlogic.gdx.graphics.glutils.ShaderProgram;
import com.badlogic.gdx.utils.GdxRuntimeException;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class UserColorShader implements Shader {
ShaderProgram program;
Camera camera;
RenderContext context;
int u_projTrans;
int u_worldTrans;
int u_color;
@Override
public void init () {
String vert = Gdx.files.internal("shader/color.vertex.glsl").readString();
String frag = Gdx.files.internal("shader/color.fragment.glsl").readString();
program = new ShaderProgram(vert, frag);
if (!program.isCompiled()) {
throw new GdxRuntimeException(program.getLog());
}
u_projTrans = program.getUniformLocation("u_projTrans");
u_worldTrans = program.getUniformLocation("u_worldTrans");
u_color = program.getUniformLocation("u_color");
}
@Override
public void dispose () {
program.dispose();
}
@Override
public void begin (Camera camera, RenderContext context) {
this.camera = camera;
this.context = context;
program.bind();
program.setUniformMatrix(u_projTrans, camera.combined);
context.setDepthTest(GL20.GL_LEQUAL);
context.setCullFace(GL20.GL_BACK);
}
@Override
public void render (Renderable renderable) {
program.setUniformMatrix(u_worldTrans, renderable.worldTransform);
Color color = ((ColorAttribute)renderable.material.get(ColorAttribute.Diffuse)).color;
program.setUniformf(u_color, color.r, color.g, color.b, color.a);
renderable.meshPart.render(program);
}
@Override
public void end () {
}
@Override
public int compareTo (Shader other) {
return 0;
}
@Override
public boolean canRender(Renderable renderable) {
return renderable.material.has(ColorAttribute.Diffuse);
}
}

View file

@ -0,0 +1,139 @@
package love.distributedrebirth.demo4d.music;
import java.util.ArrayList;
import java.util.List;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.audio.Music.OnCompletionListener;
import com.badlogic.gdx.files.FileHandle;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
/**
* Manages the background and others songs.
*/
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class MusicManager {
private final MusicSong introSong;
private final MusicSong creditsSong;
private final List<MusicSong> backgroundSongs;
private final NextSongListener nextSongListener;
private MusicSong currentSong = null;
private boolean noMusic = false;
public MusicManager() {
backgroundSongs = new ArrayList<>();
introSong = new MusicSong(Gdx.audio.newMusic(Gdx.files.internal("music/panoramacircle-waterfowl.mp3")),"panoramacircle-waterfowl");
creditsSong = new MusicSong(Gdx.audio.newMusic(Gdx.files.internal("music/idtech-doom-sigil.mp3")), "idtech-doom-sigil");
nextSongListener = new NextSongListener();
}
public void addBackgroundMusic(FileHandle file) {
Music music = Gdx.audio.newMusic(file);
music.setOnCompletionListener(nextSongListener);
backgroundSongs.add(new MusicSong(music, file.name()));
}
public void init(boolean noMusic) {
this.noMusic = noMusic;
addBackgroundMusic(Gdx.files.internal("music/sanctumwave-risen.mp3"));
addBackgroundMusic(Gdx.files.internal("music/sanctumwave-devine-intellect.mp3"));
addBackgroundMusic(Gdx.files.internal("music/theselfhelpgroup-temple-os.mp3"));
addBackgroundMusic(Gdx.files.internal("music/sanctumwave-nightwalk.mp3"));
}
public void dispose() {
introSong.music.dispose();
creditsSong.music.dispose();
for (MusicSong song:backgroundSongs) {
song.music.dispose();
}
}
public List<MusicSong> getBackgroundSongs() {
return backgroundSongs;
}
public MusicSong getCurrentSong() {
return currentSong;
}
public void stop() {
if (currentSong != null) {
currentSong.music.stop();
}
}
public void play(MusicSongType type) {
MusicSong nextSong = null;
if (MusicSongType.INTRO.equals(type)) {
nextSong = introSong;
play(nextSong);
} else if (MusicSongType.CREDITS.equals(type)) {
nextSong = creditsSong;
play(nextSong);
} else {
int currentBackground = backgroundSongs.indexOf(currentSong);
if (currentBackground == -1) {
nextSong = backgroundSongs.get(0);
} else {
nextSong = currentSong;
}
if (!noMusic) {
play(nextSong);
}
}
}
public void play(MusicSong song) {
if (song == null) {
return;
}
stop();
currentSong = song;
currentSong.music.play();
}
class NextSongListener implements OnCompletionListener {
@Override
public void onCompletion(Music music) {
next();
play(currentSong);
}
}
public void next() {
int currentBackground = backgroundSongs.indexOf(currentSong);
if (currentBackground == -1) {
return; // some other
}
if (currentBackground == backgroundSongs.size()-1) {
currentBackground = -1; // loop to start
}
boolean play = currentSong.music.isPlaying();
currentSong.music.stop();
currentSong = backgroundSongs.get(currentBackground+1);
if (play) {
currentSong.music.play();
}
}
public void prev() {
int currentBackground = backgroundSongs.indexOf(currentSong);
if (currentBackground == -1) {
return; // some other
}
if (currentBackground == 0) {
currentBackground = backgroundSongs.size(); // loop to end
}
boolean play = currentSong.music.isPlaying();
currentSong.music.stop();
currentSong = backgroundSongs.get(currentBackground-1);
if (play) {
currentSong.music.play();
}
}
}

View file

@ -0,0 +1,121 @@
package love.distributedrebirth.demo4d.music;
import java.util.function.Consumer;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.files.FileHandle;
import imgui.ImGui;
import imgui.flag.ImGuiCond;
import imgui.flag.ImGuiSelectableFlags;
import imgui.flag.ImGuiTableColumnFlags;
import imgui.flag.ImGuiTableFlags;
import imgui.type.ImBoolean;
import love.distributedrebirth.demo4d.ImGuiRendererMain;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
import love.distributedrebirth.demo4d.Demo4DMain;
import net.spookygames.gdx.nativefilechooser.NativeFileChooserCallback;
import net.spookygames.gdx.nativefilechooser.NativeFileChooserConfiguration;
/**
* The music player ui.
*/
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class MusicPlayerRenderer extends ImGuiRendererMain {
private final NativeFileChooserConfiguration fileChooserConfig;
public MusicPlayerRenderer(Demo4DMain main) {
super(main);
fileChooserConfig = new NativeFileChooserConfiguration();
fileChooserConfig.directory = Gdx.files.absolute(System.getProperty("user.home"));
fileChooserConfig.mimeFilter = "audio/*";
fileChooserConfig.title = "Choose audio file";
}
@Override
public void render(ImBoolean widgetOpen) {
ImGui.setNextWindowPos(100, 100, ImGuiCond.FirstUseEver);
ImGui.setNextWindowSize(320, 240, ImGuiCond.FirstUseEver);
ImGui.begin("Music Player", widgetOpen);
ImGui.text("Current Song:");
MusicSong currentSong = main.music.getCurrentSong();
if (currentSong != null) {
ImGui.sameLine();
ImGui.text(currentSong.getName());
}
ImGui.separator();
if (currentSong != null) {
if (ImGui.button("Play")) {
main.music.play(currentSong);
}
} else {
ImGui.text("Play");
}
ImGui.sameLine();
if (ImGui.button("<")) {
main.music.prev();
}
ImGui.sameLine();
if (ImGui.button(">")) {
main.music.next();
}
ImGui.sameLine();
if (ImGui.button("Stop")) {
main.music.stop();
}
ImGui.sameLine();
if (ImGui.button("Add")) {
main.fileChooser.chooseFile(fileChooserConfig, NativeFileChooserCallbackAdapter.onFileChosen(v -> main.music.addBackgroundMusic(v)));
}
int flags = ImGuiTableFlags.ScrollX | ImGuiTableFlags.RowBg | ImGuiTableFlags.BordersOuter | ImGuiTableFlags.BordersV;
ImGui.beginTable("playlist", 3, flags);
ImGui.tableSetupColumn("#", ImGuiTableColumnFlags.NoHide);
ImGui.tableSetupColumn("Play");
ImGui.tableSetupColumn("Name");
ImGui.tableHeadersRow();
int i=1;
for (MusicSong song:main.music.getBackgroundSongs()) {
ImGui.pushID(i);
ImGui.tableNextRow();
ImGui.tableNextColumn();
ImGui.selectable(""+i, song.isPlaying(), ImGuiSelectableFlags.None);
ImGui.tableNextColumn();
if (ImGui.smallButton(">")) {
main.music.play(song);
}
ImGui.tableNextColumn();
ImGui.selectable(song.getName(), song.isPlaying(), ImGuiSelectableFlags.None);
ImGui.popID();
i++;
}
ImGui.endTable();
ImGui.end();
}
static class NativeFileChooserCallbackAdapter implements NativeFileChooserCallback {
@Override
public void onFileChosen(FileHandle file) {
}
@Override
public void onCancellation() {
}
@Override
public void onError(Exception exception) {
}
static NativeFileChooserCallbackAdapter onFileChosen(Consumer<FileHandle> eater) {
return new NativeFileChooserCallbackAdapter() {
@Override
public void onFileChosen(FileHandle file) {
eater.accept(file);
}
};
}
}
}

View file

@ -0,0 +1,27 @@
package love.distributedrebirth.demo4d.music;
import com.badlogic.gdx.audio.Music;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
/**
* The music with the (file) name.
*/
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class MusicSong {
protected final Music music;
private final String name;
public MusicSong(Music music, String name) {
this.music = music;
this.name = name;
}
public String getName() {
return name;
}
public boolean isPlaying() {
return music.isPlaying();
}
}

View file

@ -0,0 +1,13 @@
package love.distributedrebirth.demo4d.music;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
/**
* The song types.
*/
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public enum MusicSongType {
INTRO,
CREDITS,
BACKGROUND
}

View file

@ -0,0 +1,151 @@
package love.distributedrebirth.demo4d.screen;
import java.util.ArrayList;
import java.util.List;
import imgui.ImGui;
import imgui.flag.ImGuiCond;
import imgui.flag.ImGuiTableFlags;
import imgui.type.ImBoolean;
import imgui.type.ImInt;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
import love.distributedrebirth.demo4d.Demo4DMain;
import love.distributedrebirth.demo4d.ImGuiRendererMain;
import love.distributedrebirth.numberxd.base2t.BasePartFactory;
import love.distributedrebirth.numberxd.base2t.glyph.BaseGlyphSet;
import love.distributedrebirth.numberxd.base2t.part.BãßBȍőnPartAlt1ʸᴰ;
import love.distributedrebirth.numberxd.base2t.part.BãßBȍőnPartAlt2ʸᴰ;
import love.distributedrebirth.numberxd.base2t.part.BãßBȍőnPartAlt3ʸᴰ;
import love.distributedrebirth.numberxd.base2t.part.BãßBȍőnPartAlt4ʸᴰ;
import love.distributedrebirth.numberxd.base2t.part.BãßBȍőnPartʸᴰ;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class BasePartRenderer extends ImGuiRendererMain {
private ImInt selectedBasePart = new ImInt();
public BasePartRenderer(Demo4DMain main) {
super(main);
}
@Override
public void render(ImBoolean widgetOpen) {
ImGui.setNextWindowPos(200, 200, ImGuiCond.FirstUseEver);
ImGui.setNextWindowSize(640, 480, ImGuiCond.FirstUseEver);
ImGui.begin("Base part", widgetOpen);
List<String> bases = new ArrayList<>();
for (int base:BasePartFactory.INSTANCE.BãßBases()) {
bases.add(Integer.toString(base));
}
String[] items = new String[bases.size()];
items = bases.toArray(items);
String selectedItem = items[selectedBasePart.get()];
Integer baseNumber = Integer.valueOf(selectedItem);
BãßBȍőnPartʸᴰ<?>[] baseParts = BasePartFactory.INSTANCE.BãßBuildPartsByBase(baseNumber);
ImGui.text("Base:");
ImGui.sameLine();
ImGui.text(baseParts[0].BãßClassNaam());
ImGui.sameLine();
ImGui.combo("Type", selectedBasePart, items);
int flags = ImGuiTableFlags.ScrollX | ImGuiTableFlags.RowBg | ImGuiTableFlags.BordersOuter | ImGuiTableFlags.BordersV;
ImGui.beginTable("base-part", 23, flags);
ImGui.tableSetupColumn("BȍőnNaam");
ImGui.tableSetupColumn("TelNul");
ImGui.tableSetupColumn("TelEen");
ImGui.tableSetupColumn("Tone");
ImGui.tableSetupColumn("10Tone");
ImGui.tableSetupColumn("10Kor");
ImGui.tableSetupColumn("10DTMF");
ImGui.tableSetupColumn("10Ben");
ImGui.tableSetupColumn("16Tone");
ImGui.tableSetupColumn("16Kor");
ImGui.tableSetupColumn("16LatB");
ImGui.tableSetupColumn("16Gre");
ImGui.tableSetupColumn("36Tone");
ImGui.tableSetupColumn("36Kor");
ImGui.tableSetupColumn("36LatB");
ImGui.tableSetupColumn("36Gre");
ImGui.tableSetupColumn("36Heb");
ImGui.tableSetupColumn("prcK");
ImGui.tableSetupColumn("prcV");
ImGui.tableSetupColumn("Alt1");
ImGui.tableSetupColumn("Alt2");
ImGui.tableSetupColumn("Alt3");
ImGui.tableSetupColumn("Alt4");
ImGui.tableHeadersRow();
for (BãßBȍőnPartʸᴰ<?> part:baseParts) {
ImGui.tableNextRow();
ImGui.tableNextColumn();
ImGui.text(part.BȍőnNaam());
ImGui.tableNextColumn();
ImGui.text(Integer.toString(part.BȍőnRangTelNul()));
ImGui.tableNextColumn();
ImGui.text(Integer.toString(part.BȍőnRangTelEen()));
ImGui.tableNextColumn();
ImGui.text(part.BȍőnIdentifierTone());
ImGui.tableNextColumn();
ImGui.text(part.BȍőnGlyphSetNumber10(BaseGlyphSet.TONE_LETTER));
ImGui.tableNextColumn();
ImGui.text(part.BȍőnGlyphSetNumber10(BaseGlyphSet.KOREAN));
ImGui.tableNextColumn();
ImGui.text(part.BȍőnGlyphSetNumber10(BaseGlyphSet.LATIN_DTMF));
ImGui.tableNextColumn();
ImGui.text(part.BȍőnGlyphSetNumber10(BaseGlyphSet.BENGALI));
ImGui.tableNextColumn();
ImGui.text(part.BȍőnGlyphSetNumber16(BaseGlyphSet.TONE_LETTER));
ImGui.tableNextColumn();
ImGui.text(part.BȍőnGlyphSetNumber16(BaseGlyphSet.KOREAN));
ImGui.tableNextColumn();
ImGui.text(part.BȍőnGlyphSetNumber16(BaseGlyphSet.LATIN_BASIC));
ImGui.tableNextColumn();
ImGui.text(part.BȍőnGlyphSetNumber16(BaseGlyphSet.GREEK));
ImGui.tableNextColumn();
ImGui.text(part.BȍőnGlyphSetNumber36(BaseGlyphSet.TONE_LETTER));
ImGui.tableNextColumn();
ImGui.text(part.BȍőnGlyphSetNumber36(BaseGlyphSet.KOREAN));
ImGui.tableNextColumn();
ImGui.text(part.BȍőnGlyphSetNumber36(BaseGlyphSet.LATIN_BASIC));
ImGui.tableNextColumn();
ImGui.text(part.BȍőnGlyphSetNumber36(BaseGlyphSet.GREEK));
ImGui.tableNextColumn();
ImGui.text(part.BȍőnGlyphSetNumber36(BaseGlyphSet.HEBREW));
ImGui.tableNextColumn();
ImGui.text(part.BȍőnChinaKey());
ImGui.tableNextColumn();
ImGui.text(part.BȍőnChinaValue());
ImGui.tableNextColumn();
if (part instanceof BãßBȍőnPartAlt1ʸᴰ) {
ImGui.text(BãßBȍőnPartAlt1ʸᴰ.class.cast(part).BȍőnAlt1Value());
} else {
ImGui.text("");
}
ImGui.tableNextColumn();
if (part instanceof BãßBȍőnPartAlt2ʸᴰ) {
ImGui.text(BãßBȍőnPartAlt2ʸᴰ.class.cast(part).BȍőnAlt2Value());
} else {
ImGui.text("");
}
ImGui.tableNextColumn();
if (part instanceof BãßBȍőnPartAlt3ʸᴰ) {
ImGui.text(BãßBȍőnPartAlt3ʸᴰ.class.cast(part).BȍőnAlt3Value());
} else {
ImGui.text("");
}
ImGui.tableNextColumn();
if (part instanceof BãßBȍőnPartAlt4ʸᴰ) {
ImGui.text(BãßBȍőnPartAlt4ʸᴰ.class.cast(part).BȍőnAlt4Value());
} else {
ImGui.text("");
}
}
ImGui.endTable();
ImGui.end();
}
}

View file

@ -0,0 +1,31 @@
package love.distributedrebirth.demo4d.screen;
import imgui.ImGui;
import imgui.flag.ImGuiCond;
import imgui.type.ImBoolean;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
import love.distributedrebirth.demo4d.Demo4DMain;
import love.distributedrebirth.demo4d.ImGuiRendererMain;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class BasicConsoleRenderer extends ImGuiRendererMain {
public BasicConsoleRenderer(Demo4DMain main) {
super(main);
}
@Override
public void render(ImBoolean widgetOpen) {
ImGui.setNextWindowPos(300, 300, ImGuiCond.FirstUseEver);
ImGui.setNextWindowSize(320, 240, ImGuiCond.FirstUseEver);
ImGui.begin("The BASIC Shahada of DUNE", widgetOpen);
ImGui.text("10 PRINT \"THERE IS NO GOD BUT @Ω仙⁴\"");
ImGui.text("20 PRINT \"THERE IS NO RULE BUT CONSENT\"");
ImGui.text("30 PRINT \"THERE IS NO FAILURE BUT DEATH\"");
ImGui.text("40 PRINT \"TERRY A. DAVIS WAS THE PROPHET OF @Ω仙9⁴\"");
ImGui.text("50 PRINT \"TERRY A. DAVIS WAS THE FIRST TRUE MENTAT\"");
ImGui.text("60 PRINT \"TERRY A. DAVIS WAS THE BEST CODER ALIVE\"");
ImGui.text("RUN");
ImGui.end();
}
}

View file

@ -0,0 +1,61 @@
package love.distributedrebirth.demo4d.screen;
import imgui.ImGui;
import imgui.flag.ImGuiCond;
import imgui.flag.ImGuiTableFlags;
import imgui.type.ImBoolean;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
import love.distributedrebirth.demo4d.Demo4DMain;
import love.distributedrebirth.demo4d.ImGuiRendererMain;
import love.distributedrebirth.numberxd.Gê̄ldGetậl;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class HebrewWalletRenderer extends ImGuiRendererMain {
public HebrewWalletRenderer(Demo4DMain main) {
super(main);
}
@Override
public void render(ImBoolean widgetOpen) {
ImGui.setNextWindowPos(200, 200, ImGuiCond.FirstUseEver);
ImGui.setNextWindowSize(640, 480, ImGuiCond.FirstUseEver);
ImGui.begin("Hebrew Wallet", widgetOpen);
ImGui.text("Current amount:");
ImGui.sameLine();
ImGui.text("0000");
ImGui.separator();
if (ImGui.button("Pay")) {
}
int flags = ImGuiTableFlags.ScrollX | ImGuiTableFlags.RowBg | ImGuiTableFlags.BordersOuter | ImGuiTableFlags.BordersV;
ImGui.beginTable("wallet", 5, flags);
ImGui.tableSetupColumn("In/Out");
ImGui.tableSetupColumn("AmountRaw");
ImGui.tableSetupColumn("AmountFix");
ImGui.tableSetupColumn("Decimal");
ImGui.tableHeadersRow();
String[] walletData = {
"ה","מ","מָ","ח","חֱ","חֱ‎מָא",
"א","בד","ב","ד","ץףן",
"הזפץ","מספר","צצצצ","ץאאא","דואר"
};
for (String data:walletData) {
Gê̄ldGetậl geld = new Gê̄ldGetậl(data);
Gê̄ldGetậl geld2 = geld.toClone(); // unit test
ImGui.tableNextRow();
ImGui.tableNextColumn();
ImGui.text(data.length()==2||data.length()==3?"OUT":"IN");
ImGui.tableNextColumn();
ImGui.text(data);
ImGui.tableNextColumn();
ImGui.text(geld2.toHebrewString(true)); // true=reverse for ImGui
ImGui.tableNextColumn();
ImGui.text(Double.toString(geld.getTotalDecimalValue()));
}
ImGui.endTable();
ImGui.end();
}
}

View file

@ -0,0 +1,89 @@
package love.distributedrebirth.demo4d.screen;
import com.badlogic.gdx.Screen;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
import love.distributedrebirth.demo4d.Demo4DMain;
import love.distributedrebirth.demo4d.music.MusicSongType;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class ScreenCredits extends ScrollScreenAdapter {
private final String creditsText = String.join("\n",
"Credits;",
"At-Ohm-Allah-to-the-power-of-Four",
"The King of kings",
"Thy Lord of Lords",
"Thee God of Gods",
"Abstract superset over all religions.",
" ",
"There is no god but AtohmAllah^4",
"There is no rule but consent",
"There is no failure but death",
" ",
"One long long day,",
"In a far far, fat-oddly-rounded galaxy,",
"Thy father is near.",
" ",
"Terry A. Davis;",
"- TempleOS",
"- HolyC",
"- Poems",
"- Abba music",
"- Baby fat",
" ",
"ID Tech;",
"- Ultimate DOOM",
"- SIGIL Beast Box",
"- DOOM Eternal",
" ",
"Sanctumwave Music;",
"- (music) TempleOS Hymn Risen",
"- (music) DIVINE INTELLECT",
"- (music) TERRY DAVIS NIGHTWALK",
" ",
"The Self Help Group;",
"- (music) The Self Help-Group Temple OS",
" ",
"PanoramaCircle;",
"- (music) TempleOS 'Waterfowl' poem on real hardware",
" ",
"Willem Abraham Cazander;",
"- http://distributedrebith.love",
" ",
"=============================================",
" ",
"The BASIC Shahada",
"10 PRINT \"THERE IS NO GOD BUT AT_OHM_ALLAH^4\"",
"20 PRINT \"THERE IS NO RULE BUT CONSENT\"",
"30 PRINT \"THERE IS THERE IS NO FAILURE BUT DEATH\"",
"40 PRINT \"TERRY A. DAVIS WAS THE PROPHET OF GOD\"",
"50 PRINT \"TERRY A. DAVIS WAS THE FIRST TRUE MENTAT\"",
"60 PRINT \"TERRY A. DAVIS WAS THE BEST CODER ALIVE\"",
"RUN",
" "
);
public ScreenCredits(final Demo4DMain main) {
super(main, "background/doom-credits.png");
}
@Override
protected String getScrollText() {
return creditsText;
}
@Override
protected Class<? extends Screen> getNextScreen(Demo4DMain main) {
return ScreenDefault.class;
}
@Override
public void show () {
main.music.play(MusicSongType.CREDITS);
}
@Override
public void hide () {
main.music.play(MusicSongType.BACKGROUND);
}
}

View file

@ -0,0 +1,33 @@
package love.distributedrebirth.demo4d.screen;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.ScreenAdapter;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.utils.ScreenUtils;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
import love.distributedrebirth.demo4d.Demo4DMain;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class ScreenDefault extends ScreenAdapter {
private final Demo4DMain main;
private Texture backgroundImage;
public ScreenDefault(final Demo4DMain main) {
this.main = main;
backgroundImage = new Texture(Gdx.files.internal("background/terrydavis-front.png"));
}
@Override
public void render(float delta) {
ScreenUtils.clear(0f, 0f, 0f, 1f);
main.batch.begin();
main.batch.draw(backgroundImage, 0, 0, main.viewWidth, main.viewHeight);
main.batch.end();
}
@Override
public void dispose() {
backgroundImage.dispose();
}
}

View file

@ -0,0 +1,72 @@
package love.distributedrebirth.demo4d.screen;
import com.badlogic.gdx.Screen;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
import love.distributedrebirth.demo4d.Demo4DMain;
import love.distributedrebirth.demo4d.music.MusicSongType;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class ScreenHelp extends ScrollScreenAdapter {
private final String creditsText = String.join("\n",
"Genesis 11",
" ",
"1 And the whole earth was of one language, and of one speech.",
" ",
"2 And it came to pass, as they journeyed from the east,",
" that they found a plain in the land of Shinar;",
" and they dwelt there.",
" ",
"3 And they said one to another, Go to, let us make brick,",
" and burn them thoroughly. And they had brick for stone,",
" and slime had they for mortar.",
" ",
"4 And they said, Go to, let us build us a city, and a tower,",
" whose top may reach unto heaven; and let us make us a name,",
" lest we be scattered abroad upon the face of the whole earth.",
" ",
"5 And the LORD came down to see the city and the tower,",
" which the children of men builded.",
" ",
"6 And the LORD said, Behold, the people is one,",
" and they have all one language; and this they begin to do:",
" and now nothing will be restrained from them,",
" which they have imagined to do.",
" ",
"7 Go to, let us go down, and there confound their language,",
" that they may not understand one another's speech.",
" ",
"8 So the LORD scattered them abroad from thence upon the face",
" of all the earth: and they left off to build the city.",
" ",
"9 Therefore is the name of it called Babel; because the LORD",
" did there confound the language of all the earth: and from",
" thence did the LORD scatter them abroad upon",
" the face of all the earth.",
" "
);
public ScreenHelp(final Demo4DMain main) {
super(main, "background/terrydavis-nose.png");
}
@Override
protected String getScrollText() {
return creditsText;
}
@Override
protected Class<? extends Screen> getNextScreen(Demo4DMain main) {
return ScreenDefault.class;
}
@Override
public void show () {
main.music.play(MusicSongType.INTRO);
}
@Override
public void hide () {
main.music.play(MusicSongType.BACKGROUND);
}
}

View file

@ -0,0 +1,59 @@
package love.distributedrebirth.demo4d.screen;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.ScreenAdapter;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.utils.ScreenUtils;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
import love.distributedrebirth.demo4d.Demo4DMain;
import love.distributedrebirth.demo4d.music.MusicSongType;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class ScreenIntro extends ScreenAdapter {
private final Demo4DMain main;
private Texture backgroundImage;
private float colorDeltaTime = 0f;
private boolean colorPositive = true;
public ScreenIntro(final Demo4DMain main) {
this.main = main;
backgroundImage = new Texture(Gdx.files.internal("background/temple-os.png"));
}
@Override
public void render(float delta) {
if (colorPositive) {
colorDeltaTime += Gdx.graphics.getDeltaTime()/2;
} else {
colorDeltaTime -= Gdx.graphics.getDeltaTime()/2;
}
if (colorDeltaTime > 1f) {
colorPositive = false;
} else if (colorDeltaTime < 0f) {
colorPositive = true;
}
ScreenUtils.clear(0.333f, colorDeltaTime, colorDeltaTime, 1);
main.batch.begin();
main.batch.draw(backgroundImage, 0, 0, main.viewWidth, main.viewHeight);
main.font.draw(main.batch, "Tap anywhere to begin!", main.viewWidth/2 - 73, 33);
main.batch.end();
if (Gdx.input.isTouched() || Gdx.input.isKeyPressed(Keys.ENTER) || Gdx.input.isKeyPressed(Keys.SPACE)) {
main.setScreen(new ScreenIntroMission(main));
dispose();
}
}
@Override
public void show() {
main.music.play(MusicSongType.INTRO);
}
@Override
public void dispose() {
backgroundImage.dispose();
}
}

View file

@ -0,0 +1,77 @@
package love.distributedrebirth.demo4d.screen;
import com.badlogic.gdx.Screen;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
import love.distributedrebirth.demo4d.Demo4DMain;
import love.distributedrebirth.demo4d.music.MusicSongType;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class ScreenIntroMission extends ScrollScreenAdapter {
private final String missionText = String.join("\n",
"To a Waterfowl",
" -- by William Cullen Bryant --",
" ",
"Whither, 'midst falling dew,",
"While glow the heavens with the last steps of day,",
"Far, through their rosy depths, dost thou pursue",
"Thy solitary way?",
" ",
"Vainly the fowler's eye",
"Might mark thy distant flight to do thee wrong,",
"As, darkly painted on the crimson sky,",
"Thy figure floats along.",
" ",
"Seek'st thou the plashy brink",
"Of weedy lake, or marge of river wide,",
"Or where the rocking billows rise and sink",
"On the chafed ocean side?",
" ",
"There is a Power whose care",
"Teaches thy way along that pathless coast,--",
"The desert and illimitable air,--",
"Lone wandering, but not lost.",
" ",
"All day thy wings have fann'd",
"At that far height, the cold thin atmosphere:",
"Yet stoop not, weary, to the welcome land,",
"Though the dark night is near.",
" ",
"And soon that toil shall end,",
"Soon shalt thou find a summer home, and rest,",
"And scream among thy fellows; reed shall bend",
"Soon o'er thy sheltered nest.",
" ",
"Thou'rt gone, the abyss of heaven",
"Hath swallowed up thy form; yet, on my heart",
"Deeply hath sunk the lesson thou hast given,",
"And shall not soon depart.",
" ",
"He, who, from zone to zone,",
"Guides through the boundless sky thy certain flight,",
"In the long way that I must tread alone,",
"Will lead my steps aright.",
" "
);
public ScreenIntroMission(final Demo4DMain main) {
super(main, "background/terrydavis-nose.png");
}
@Override
protected String getScrollText() {
return missionText;
}
@Override
protected Class<? extends Screen> getNextScreen(Demo4DMain main) {
return ScreenDefault.class;
}
@Override
public void hide () {
main.music.play(MusicSongType.BACKGROUND);
}
}

View file

@ -0,0 +1,55 @@
package love.distributedrebirth.demo4d.screen;
import imgui.ImColor;
import imgui.ImDrawList;
import imgui.ImGui;
import imgui.ImVec2;
import imgui.flag.ImGuiCond;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
import love.distributedrebirth.demo4d.Demo4DMain;
import love.distributedrebirth.demo4d.Demo4DMainAdapter;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class ScreenUnicode4D extends Demo4DMainAdapter {
public ScreenUnicode4D(final Demo4DMain main) {
super(main);
}
@Override
public void render(float delta) {
main.batch.begin();
main.font.draw(main.batch, "Tap anywhere to begin!", main.viewWidth/2 - 73, 33);
main.batch.end();
ImGui.setNextWindowPos(400, 200, ImGuiCond.FirstUseEver);
ImGui.setNextWindowSize(320, 240, ImGuiCond.FirstUseEver);
ImGui.begin("Unicode4D test");
ImGui.text("There is unicode and unicode4D");
ImVec2 size = new ImVec2(144f, 48f);
ImGui.invisibleButton("canvas", size.x, size.y);
ImVec2 p0 = ImGui.getItemRectMin();
ImVec2 p1 = ImGui.getItemRectMax(); // p1 = p0 + size
ImDrawList drawList = ImGui.getWindowDrawList();
drawList.pushClipRect(p0.x, p0.y, p1.x, p1.y);
// draw unicode4D
drawList.addQuad(p0.x, p0.y, p0.x+size.x, p0.y, p1.x, p1.y, p0.x, p0.y+size.y,
ImColor.intToColor(127, 127, 255, 255), 5f);
drawList.addLine(p0.x+10, p0.y+40, p0.x+20, p0.y+10, ImColor.intToColor(255, 127, 63, 255));
drawList.addLine(p0.x+30, p0.y+40, p0.x+20, p0.y+10, ImColor.intToColor(255, 127, 63, 255));
drawList.addLine(p0.x+13, p0.y+30, p0.x+27, p0.y+30, ImColor.intToColor(255, 127, 63, 255));
drawList.popClipRect();
ImGui.end();
//System.out.println("p0.x="+p0.x+" p0.y="+p0.y);
//System.out.println("p1.x="+p1.x+" p1.y="+p1.y);
// for (int n = 0; n < (1.0f + Math.sin(ImGui.getTime() * 5.7f)) * 40.0f; n++) {
// drawList.addCircle(p0.x + size.x * 0.5f, p0.y + size.y * 0.5f, size.y * (0.01f + n * 0.03f),
// ImColor.intToColor(255, 140 - n * 4, n * 3, 255)
// );
// }
}
}

View file

@ -0,0 +1,82 @@
package love.distributedrebirth.demo4d.screen;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.utils.ScreenUtils;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
import love.distributedrebirth.demo4d.Demo4DMain;
import love.distributedrebirth.demo4d.Demo4DMainAdapter;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
abstract public class ScrollScreenAdapter extends Demo4DMainAdapter {
private static final int LINE_HEIGHT = 16;
private float scrollDeltaTime = 0f;
private String scrollText = "";
private int scrollIndex = 0;
private int scrollLine = LINE_HEIGHT;
private final Texture backgroundImage;
public ScrollScreenAdapter(final Demo4DMain main, String background) {
super(main);
backgroundImage = new Texture(Gdx.files.internal(background));
}
abstract protected String getScrollText();
abstract protected Class<? extends Screen> getNextScreen(Demo4DMain main);
@Override
public final void render(float delta) {
ScreenUtils.clear(0f, 0f, 0f, 1f);
main.batch.begin();
main.batch.draw(backgroundImage, 0, 0, main.viewWidth, main.viewHeight);
scrollDeltaTime += delta;
if (scrollDeltaTime > 0.04f) {
scrollDeltaTime = 0f;
scrollLine++;
if (scrollLine > LINE_HEIGHT && scrollIndex != -1) {
scrollIndex = getScrollText().indexOf("\n", scrollIndex+1);
if (scrollIndex > 0) {
scrollText = getScrollText().substring(0, scrollIndex);
scrollLine = 0;
}
}
}
int drawLine = 0;
String[] lines = scrollText.split("\n");
for (int i=lines.length;i>0;i--) {
String line = lines[i-1];
main.font.draw(main.batch, line, 100, scrollLine + (drawLine*LINE_HEIGHT));
drawLine++;
}
main.batch.end();
if (scrollText.length() >= 33) {
if (scrollLine >= main.viewHeight || Gdx.input.isTouched() || Gdx.input.isKeyPressed(Keys.ENTER) || Gdx.input.isKeyPressed(Keys.SPACE)) {
main.selectScreen(getNextScreen(main));
}
}
}
@Override
public void hide() {
scrollText = "";
scrollIndex = 0;
scrollLine = LINE_HEIGHT;
}
@Override
public final void dispose() {
backgroundImage.dispose();
disposeScreen(main);
}
protected void disposeScreen(Demo4DMain main) {
// override if needed
}
}