Compare commits

..

1 Commits

Author SHA1 Message Date
Renovate 7602b4c55e Update dependency io.avaje:avaje-config to v5 2026-05-13 10:55:23 +00:00
11 changed files with 28 additions and 124 deletions
-23
View File
@@ -1,23 +0,0 @@
name: Build and Test
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Build and Test
run: ./gradlew build
-1
View File
@@ -16,7 +16,6 @@ The project uses Gradle.
* **Dependency Injection:** Uses `avaje-inject`. Components are marked with `@Component` and injected via constructor.
* **Boilerplate:** Uses `lombok` for boilerplate reduction.
* **Rendering:** Built on LibGDX. Main entry point is `DiceOS.java` which extends `ApplicationAdapter`.
* **Asset Loading:** All assets, including textures, fonts, and NinePatches, must be loaded via the `ResourceLoader` service to ensure proper lifecycle management and caching.
* **Project Structure:**
* `src/main/java/be/seeseemelk/diceos/system`: Core OS services (Display, Window, Input, etc.).
* `src/main/resources`: Assets (backgrounds, system textures, fonts).
Binary file not shown.
+1 -3
View File
@@ -1,9 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.5-bin.zip
networkTimeout=10000
retries=0
retryBackOffMs=500
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Vendored
+5 -2
View File
@@ -1,7 +1,7 @@
#!/bin/sh
#
# Copyright © 2015 the original authors.
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -57,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -114,6 +114,7 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH="\\\"\\\""
# Determine the Java command to use to start the JVM.
@@ -171,6 +172,7 @@ fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
@@ -210,6 +212,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
Vendored
+22 -10
View File
@@ -23,8 +23,8 @@
@rem
@rem ##########################################################################
@rem Set local scope for the variables, and ensure extensions are enabled
setlocal EnableExtensions
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@@ -51,7 +51,7 @@ echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
"%COMSPEC%" /c exit 1
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
@@ -65,18 +65,30 @@ echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
"%COMSPEC%" /c exit 1
goto fail
:execute
@rem Setup the command line
set CLASSPATH=
@rem Execute Gradle
@rem endlocal doesn't take effect until after the line is parsed and variables are expanded
@rem which allows us to clear the local environment before executing the java command
endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:exitWithErrorLevel
@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts
"%COMSPEC%" /c exit %ERRORLEVEL%
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
@@ -2,7 +2,6 @@ package be.seeseemelk.diceos.system;
import be.seeseemelk.diceos.system.gfx.GraphicsContext;
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
@@ -72,10 +71,6 @@ public class DiceOS extends ApplicationAdapter {
@Override
public void render() {
int mouseX = Gdx.input.getX();
int mouseY = display.getHeight() - Gdx.input.getY();
windowService.update(mouseX, mouseY, Gdx.input.isTouched());
cursorService.updateCursor();
ScreenUtils.clear(Color.BLACK);
@@ -89,9 +84,6 @@ public class DiceOS extends ApplicationAdapter {
// Render background
gc.draw(clouds, 0, 0);
// Render windows
windowService.render(gc);
gc.scissor(0, 0, gc.getWidth(), gc.getHeight(), windowService::paint);
// Render borders
@@ -2,49 +2,26 @@ package be.seeseemelk.diceos.system;
import be.seeseemelk.diceos.system.gfx.GraphicsContext;
import be.seeseemelk.diceos.system.toolkit.Menubar;
import be.seeseemelk.diceos.system.toolkit.Window;
import com.badlogic.gdx.graphics.g2d.NinePatch;
import io.avaje.inject.Component;
import lombok.RequiredArgsConstructor;
import java.util.ArrayList;
import java.util.List;
@RequiredArgsConstructor
@Component
public class WindowService implements OnStartup {
private final ResourceLoader resourceLoader;
private final List<Window> windows = new ArrayList<>();
private NinePatch menubar;
private NinePatch windowDecoration;
private Menubar systemMenubar;
@Override
public void onStartup() {
menubar = resourceLoader.loadNinePatch("system/menubar.png");
windowDecoration = resourceLoader.loadNinePatch("system/window.png");
systemMenubar = new Menubar()
.addItem("Dice")
.addItem("System");
}
public void spawnWindow(int x, int y, int width, int height) {
windows.add(new Window(x, y, width, height, windowDecoration));
}
public void update(int mouseX, int mouseY, boolean isTouched) {
for (Window window : windows) {
window.handleInput(mouseX, mouseY, isTouched);
}
}
public void render(GraphicsContext gc) {
for (Window window : windows) {
window.paint(gc);
}
}
void paint(GraphicsContext gc) {
// Render menubar
gc.draw(menubar, 0, 0, gc.getWidth(), 14);
@@ -1,15 +0,0 @@
package be.seeseemelk.diceos.system;
import io.avaje.inject.Component;
import lombok.RequiredArgsConstructor;
@Component
@RequiredArgsConstructor
public class WindowSpawnTask implements OnStartup {
private final WindowService windowService;
@Override
public void onStartup() {
windowService.spawnWindow(50, 50, 200, 150);
}
}
@@ -1,7 +1,6 @@
package be.seeseemelk.diceos.system.toolkit;
import be.seeseemelk.diceos.system.gfx.GraphicsContext;
import com.badlogic.gdx.graphics.g2d.NinePatch;
import lombok.Getter;
import lombok.Setter;
@@ -9,47 +8,9 @@ import lombok.Setter;
@Getter
public class Window extends Container {
private String title;
private int x, y, width, height;
private boolean active;
private NinePatch decoration;
public Window(int x, int y, int width, int height, NinePatch decoration) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
this.decoration = decoration;
}
public boolean isHovered(int mouseX, int mouseY) {
return mouseX >= x && mouseX <= x + width && mouseY >= y && mouseY <= y + height;
}
private int dragOffsetX, dragOffsetY;
private boolean isDragging;
public void handleInput(int mouseX, int mouseY, boolean isTouched) {
if (isTouched) {
if (!isDragging && isHovered(mouseX, mouseY)) {
isDragging = true;
dragOffsetX = mouseX - x;
dragOffsetY = mouseY - y;
}
} else {
isDragging = false;
}
if (isDragging) {
x = mouseX - dragOffsetX;
y = mouseY - dragOffsetY;
}
}
@Override
public void paint(GraphicsContext gc) {
if (decoration != null) {
decoration.draw(gc.getBatch(), x, y, width, height);
}
super.paint(gc);
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 B