Compare commits

..

15 Commits

Author SHA1 Message Date
Renovate ad0ebe3fe4 Merge pull request 'Update dependency tools.jackson.dataformat:jackson-dataformat-toml to v3.2.0' (#16) from renovate/all-minor-patch into master
Build and Test / build (push) Successful in 48s
2026-06-09 10:01:05 +02:00
Renovate 22670c2468 Update dependency tools.jackson.dataformat:jackson-dataformat-toml to v3.2.0
Build and Test / build (pull_request) Successful in 47s
2026-06-09 08:00:10 +00:00
Renovate a9abe3c640 Merge pull request 'Update all minor and patch updates to v1.14.2' (#15) from renovate/all-minor-patch into master
Build and Test / build (push) Successful in 45s
2026-06-05 18:01:02 +02:00
Renovate 6416a55904 Update all minor and patch updates to v1.14.2
Build and Test / build (pull_request) Successful in 47s
2026-06-05 16:00:10 +00:00
Renovate 65cfff172d Merge pull request 'Update all minor and patch updates to v12.6-javax' (#14) from renovate/all-minor-patch into master
Build and Test / build (push) Successful in 47s
2026-06-05 10:01:06 +02:00
Renovate 16e171a55e Update all minor and patch updates to v12.6-javax
Build and Test / build (pull_request) Successful in 49s
2026-06-05 08:00:10 +00:00
Renovate eada8b87c3 Merge pull request 'Update actions/checkout digest to df4cb1c' (#13) from renovate/all-minor-patch into master
Build and Test / build (push) Successful in 57s
2026-06-03 18:01:29 +02:00
Renovate 2b6787143a Update actions/checkout digest to df4cb1c
Build and Test / build (pull_request) Successful in 1m15s
2026-06-03 16:00:10 +00:00
Renovate d9794cce22 Merge pull request 'Update dependency tools.jackson.dataformat:jackson-dataformat-toml to v3.1.4' (#12) from renovate/all-minor-patch into master
Build and Test / build (push) Successful in 43s
2026-05-30 02:01:04 +02:00
Renovate 3b8df5824f Update dependency tools.jackson.dataformat:jackson-dataformat-toml to v3.1.4
Build and Test / build (pull_request) Successful in 49s
2026-05-30 00:00:10 +00:00
Renovate 0e6a327c08 Merge pull request 'Update dependency org.junit:junit-bom to v6.1.0' (#11) from renovate/all-minor-patch into master
Build and Test / build (push) Successful in 37s
2026-05-20 02:01:00 +02:00
Renovate 933ff6006f Update dependency org.junit:junit-bom to v6.1.0
Build and Test / build (pull_request) Successful in 44s
2026-05-20 00:00:10 +00:00
Renovate fbcfad2346 Merge pull request 'Update all minor and patch updates to v1.14.1' (#10) from renovate/all-minor-patch into master
Build and Test / build (push) Successful in 36s
2026-05-19 10:14:19 +02:00
Renovate bc24b5dc09 Update all minor and patch updates to v1.14.1
Build and Test / build (pull_request) Successful in 1m39s
2026-05-19 00:00:11 +00:00
seeseemelk 8f9aeb2608 Enhance GraphicsContext: add RGB color setting method, adjust clipping logic, and update Menu to return Window
Build and Test / build (push) Has been cancelled
2026-05-15 21:44:23 +02:00
7 changed files with 32 additions and 31 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
- name: Set up JDK - name: Set up JDK
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
+4 -4
View File
@@ -7,10 +7,10 @@ plugins {
group = "be.seeseemelk" group = "be.seeseemelk"
version = "1.0-SNAPSHOT" version = "1.0-SNAPSHOT"
val gdxVersion = "1.14.0" val gdxVersion = "1.14.2"
val slf4j = "2.0.18" val slf4j = "2.0.18"
val lombokVersion = "1.18.46" val lombokVersion = "1.18.46"
val avajeInjectVersion = "12.5" val avajeInjectVersion = "12.6-javax"
application { application {
mainClass = "be.seeseemelk.diceos.Bootloader" mainClass = "be.seeseemelk.diceos.Bootloader"
@@ -39,14 +39,14 @@ dependencies {
testAnnotationProcessor("io.avaje:avaje-inject-generator:${avajeInjectVersion}") testAnnotationProcessor("io.avaje:avaje-inject-generator:${avajeInjectVersion}")
// Parsing TOML files // Parsing TOML files
implementation("tools.jackson.dataformat:jackson-dataformat-toml:3.1.3") implementation("tools.jackson.dataformat:jackson-dataformat-toml:3.2.0")
// LibGDX // LibGDX
api("com.badlogicgames.gdx:gdx:$gdxVersion") api("com.badlogicgames.gdx:gdx:$gdxVersion")
api("com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion") api("com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion")
api("com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop") api("com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop")
testImplementation(platform("org.junit:junit-bom:6.0.3")) testImplementation(platform("org.junit:junit-bom:6.1.0"))
testImplementation("org.junit.jupiter:junit-jupiter") testImplementation("org.junit.jupiter:junit-jupiter")
testRuntimeOnly("org.junit.platform:junit-platform-launcher") testRuntimeOnly("org.junit.platform:junit-platform-launcher")
} }
@@ -69,13 +69,13 @@ public class WindowService implements OnStartup {
// Render menubar items // Render menubar items
gc.save(); gc.save();
gc.translate(5, 0); gc.translate(8, 0);
for (var submenu : menu.getItems()) { for (var submenu : menu.getItems()) {
gc.save(); gc.save();
gc.clip(0, 0, submenu.getWidth(), submenu.getHeight()); gc.clip(0, 0, submenu.getWidth(), submenu.getHeight());
submenu.paint(gc); submenu.paint(gc);
gc.restore(); gc.restore();
gc.translate(submenu.getWidth() + 4, 0); gc.translate(submenu.getWidth(), 0);
} }
gc.restore(); gc.restore();
} }
@@ -110,6 +110,14 @@ public class GraphicsContext {
batch.setColor(r / 255f, g / 255f, b / 255f, 1f); batch.setColor(r / 255f, g / 255f, b / 255f, 1f);
} }
/**
* Sets the color for subsequent drawing operations using an RGB integer.
* @param rgb The RGB color integer.
*/
public void setColour(int rgb) {
setColour((rgb >> 16) & 0xFF, (rgb >> 8) & 0xFF, rgb & 0xFF);
}
/** /**
* Shifts the context to the right and down by some amount. * Shifts the context to the right and down by some amount.
* Negative values move towards the opposite direction. * Negative values move towards the opposite direction.
@@ -154,7 +162,7 @@ public class GraphicsContext {
* @param height The height of the clipping area. * @param height The height of the clipping area.
*/ */
public void clip(int x, int y, int width, int height) { public void clip(int x, int y, int width, int height) {
var scissors = new Rectangle(x, getHeight() - y - height, width - getXTranslation(), height - getYTranslation()); var scissors = new Rectangle(x + getXTranslation(), getHeight() - (y + getYTranslation()) - height, width, height);
ScissorStack.calculateScissors(camera, batch.getTransformMatrix(), scissors, scissors); ScissorStack.calculateScissors(camera, batch.getTransformMatrix(), scissors, scissors);
batch.flush(); batch.flush();
if (ScissorStack.pushScissors(scissors)) { if (ScissorStack.pushScissors(scissors)) {
@@ -3,6 +3,7 @@ package be.seeseemelk.diceos.system.toolkit.menu;
import be.seeseemelk.diceos.system.DiceOS; import be.seeseemelk.diceos.system.DiceOS;
import be.seeseemelk.diceos.system.font.Font; import be.seeseemelk.diceos.system.font.Font;
import be.seeseemelk.diceos.system.gfx.GraphicsContext; import be.seeseemelk.diceos.system.gfx.GraphicsContext;
import be.seeseemelk.diceos.system.toolkit.Window;
import lombok.Getter; import lombok.Getter;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@@ -14,6 +15,8 @@ import java.util.List;
@Getter @Getter
@Slf4j @Slf4j
public class Menu implements MenuItem { public class Menu implements MenuItem {
private final static int HORIZONTAL_PADDING = 2;
private final String title; private final String title;
private final List<MenuItem> items = new ArrayList<>(); private final List<MenuItem> items = new ArrayList<>();
private final Font font = DiceOS.getResourceLoader().getDefaultFont(); private final Font font = DiceOS.getResourceLoader().getDefaultFont();
@@ -30,7 +33,7 @@ public class Menu implements MenuItem {
@Override @Override
public int getWidth() { public int getWidth() {
return font.getTextWidth(title); return font.getTextWidth(title) + HORIZONTAL_PADDING * 2;
} }
@Override @Override
@@ -43,23 +46,23 @@ public class Menu implements MenuItem {
* *
* @param x The x-coordinate. * @param x The x-coordinate.
* @param y The y-coordinate. * @param y The y-coordinate.
* @return The created MenuPopup. * @return The created Window for the menu.
*/ */
public MenuPopup show(int x, int y) { public Window show(int x, int y) {
return new MenuPopup(this, x, y); return new Window(x, y, getWidth(), getHeight(), Window.Style.NONE);
} }
@Override @Override
public void paint(GraphicsContext gc) { public void paint(GraphicsContext gc) {
if (DiceOS.getInputService().mouseInBounds(gc.getXTranslation(), gc.getYTranslation(), getWidth(), getHeight())) { if (DiceOS.getInputService().mouseInBounds(gc.getXTranslation(), gc.getYTranslation(), getWidth(), getHeight())) {
log.info("Mouse in bounds"); log.info("Mouse in bounds");
gc.setColour(0, 0, 255); gc.setColour(0x9f7445);
gc.fillRect(-100, -100, 500, 500);
} }
gc.fillRect(-100, -100, 500, 500);
gc.setColour(255, 255, 255); gc.setColour(255, 255, 255);
// Renders the menu as a simple menu button // Renders the menu as a simple menu button
gc.draw(title, 2, 5); gc.draw(title, HORIZONTAL_PADDING, 5);
} }
} }
@@ -1,16 +0,0 @@
package be.seeseemelk.diceos.system.toolkit.menu;
import be.seeseemelk.diceos.system.toolkit.Window;
/**
* A visisble menu popup.
*/
public class MenuPopup {
private final Menu menu;
private final Window window;
public MenuPopup(Menu menu, int x, int y) {
this.menu = menu;
this.window = new Window(x, y, menu.getWidth(), menu.getHeight(), Window.Style.NONE);
}
}
@@ -57,6 +57,12 @@ class GraphicsContextTest {
verify(batch).setColor(1f, 0f, 0f, 1f); verify(batch).setColor(1f, 0f, 0f, 1f);
} }
@Test
void testSetColourRGB() {
gc.setColour(0xFF00FF);
verify(batch).setColor(1f, 0f, 1f, 1f);
}
@Test @Test
void testTranslate() { void testTranslate() {
gc.translate(10, 20); gc.translate(10, 20);