Skip to content
This repository has been archived by the owner on Oct 24, 2024. It is now read-only.

Commit

Permalink
OpenCraft HAECATOMBE
Browse files Browse the repository at this point in the history
  • Loading branch information
CiroZDP committed Sep 11, 2024
1 parent 24217d5 commit 23e3be6
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 32 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<java.version>8</java.version>
<maven.compiler.release>8</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<!-- Dependency versions -->
<lombok.version>1.18.20</lombok.version>
<joml.version>1.10.8</joml.version>
Expand All @@ -30,7 +30,7 @@
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</dependency>

<dependency>
<groupId>org.joml</groupId>
<artifactId>joml</artifactId>
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/net/opencraft/OpenCraft.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,6 @@ public void run() {

renderTimer.start();
tickTimer.start();

// Finally stops the game
//stop();4
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/net/opencraft/renderer/screens/Loadscreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ private void staticLS(Graphics2D g2d) {

BufferedImage loadingLogo = oc.assets.getLoadingLogo();
{
int logoW = (int) (loadingLogo.getWidth() * 1.5f);
int logoH = (int) (loadingLogo.getHeight() * 1.5f);
int logoW = 840;
int logoH = 445;

int logoX = (854 - logoW) / 2;
int logoY = (480 - logoH) / 2 - 27;
int logoX = 0;
int logoY = 0;

g2d.drawImage(loadingLogo, logoX, logoY, logoW, logoH, null);
}
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/net/opencraft/renderer/screens/Menuscreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ public void render(Graphics2D g2d) {
final int width = oc.width;
final int height = oc.height;

super.drawDirtBackground(g2d);
g2d.setColor(Color.BLACK);
g2d.setPaint(new TexturePaint(oc.assets.getBackground(), new Rectangle(0, 0, 64, 64)));
g2d.fillRect(0, 0, width, height);

g2d.drawImage(logo.get(), (width - 500) / 2, (480 > height) ? 10 : 30, 500, 87, null);

Expand Down
34 changes: 33 additions & 1 deletion src/main/java/net/opencraft/renderer/screens/Screen.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package net.opencraft.renderer.screens;

import java.awt.Graphics2D;
import static net.opencraft.OpenCraft.*;

import java.awt.*;
import java.awt.image.BufferedImage;

public abstract class Screen {

Expand Down Expand Up @@ -31,6 +34,35 @@ public static void renderCurrent(Graphics2D g2d) {

current.render(g2d);
}

protected void clearScreen(Graphics2D g2d) {
g2d.setColor(Color.BLACK);
g2d.fillRect(0, 0, oc.width, oc.height);
}

protected void drawOptionsBackground(Graphics2D g2d) {
//clearScreen(g2d);
BufferedImage dirtTexture = drawDirtBackground(g2d);

Rectangle area = new Rectangle(0, 60, oc.width, oc.height - 160);

Composite saveCMP = g2d.getComposite();
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f));
g2d.setColor(Color.BLACK);
g2d.fill(area);
g2d.setPaint(new TexturePaint(dirtTexture, new Rectangle(0, 0, 64, 64)));
g2d.fill(area);
g2d.setComposite(saveCMP);
}

protected BufferedImage drawDirtBackground(Graphics2D g2d) {
BufferedImage dirtTexture = oc.assets.getBackground();
{
g2d.setPaint(new TexturePaint(dirtTexture, new Rectangle(0, 0, 64, 64)));
g2d.fillRect(0, 0, oc.width, oc.height);
}
return dirtTexture;
}

@Override
public String toString() {
Expand Down
25 changes: 5 additions & 20 deletions src/main/java/net/opencraft/renderer/screens/SettingsScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,26 +44,11 @@ private SettingsScreen() {

@Override
public void render(Graphics2D g2d) {
int width = Display.getWidth();
int height = Display.getHeight();

g2d.setPaintMode();
g2d.setColor(Color.WHITE);

Composite defcomposite = g2d.getComposite();
for (int x = 0; x < width; x += 64) {
for (int y = 0; y < height; y += 64) {
if (y <= 60 || y >= (height - 100))
g2d.setComposite(defcomposite);
else
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f));

g2d.setColor(Color.BLACK);
g2d.fillRect(x, y, 64, 64);
g2d.drawImage(oc.assets.getBackground(), x, y, 64, 64, null);
}
}
g2d.setComposite(defcomposite);
super.clearScreen(g2d);
int width = oc.width;
int height = oc.height;

drawOptionsBackground(g2d);

if (currentTab.equalsIgnoreCase("options.generalTab")) {
drawGeneralTab(g2d, oc.assets);
Expand Down
Binary file modified src/main/resources/loading_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 23e3be6

Please sign in to comment.