[FIX] ???

This commit is contained in:
Edouard DUPIN 2025-05-18 19:10:04 +02:00
parent e0693e0bf8
commit 3dd42d77ca
4 changed files with 23 additions and 43 deletions

21
pom.xml
View File

@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.atriasoft</groupId>
@ -5,12 +6,12 @@
<version>0.1.0</version>
<properties>
<maven.compiler.version>3.13.0</maven.compiler.version>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<maven.compiler.source>24</maven.compiler.source>
<maven.compiler.target>24</maven.compiler.target>
<maven.dependency.version>3.1.1</maven.dependency.version>
<lwjgl.version>3.3.3</lwjgl.version>
<lwjgl3-awt.version>0.1.8</lwjgl3-awt.version>
<lwjgl.natives>natives-linux</lwjgl.natives>
<lwjgl.natives>natives-linux</lwjgl.natives>
</properties>
<repositories>
@ -251,7 +252,7 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.11.0-M2</version>
<version>5.11.0</version>
<scope>test</scope>
</dependency>
<dependency>
@ -263,13 +264,13 @@
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<sourceDirectory>src/main</sourceDirectory>
<resources>
<resource>
<directory>${basedir}/src/resources</directory>
</resource>
</resources>
<testSourceDirectory>test/src</testSourceDirectory>
<testSourceDirectory>src/test</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@ -285,7 +286,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.1</version>
<version>4.0.0-beta-1</version>
<executions>
<execution>
<id>attach-sources</id>
@ -299,7 +300,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<version>3.2.5</version>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
@ -318,7 +319,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.2.0</version>
<version>3.3.0</version>
<configuration>
<show>private</show>
<nohelp>true</nohelp>
@ -332,7 +333,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.2.0</version>
<version>3.3.0</version>
<configuration>
<show>public</show>
</configuration>

View File

@ -55,7 +55,14 @@ public class ResourceTexture extends Resource {
return null;
}
resource = new ResourceTexture(uriTexture, textureUnit);
final ImageRawData decodedData = ImageLoader.decodePngFile(uriTexture);
ImageRawData decodedData;
try {
decodedData = ImageLoader.decodePngFile(uriTexture);
} catch (final Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
final ImageByteRGBA img = new ImageByteRGBA(decodedData.getWidth(), decodedData.getHeight());
final ByteBuffer mlklmklm = decodedData.getBuffer();
final byte[] elemData = new byte[mlklmklm.remaining()];

View File

@ -1,30 +0,0 @@
package org.atriasoft.gale.test.sample1;
public class Log {
private Log() {}
private static final String LIBNAME = "Sample1";
public static void print(String data) {
System.out.println(data);
}
public static void critical(String data) {
System.out.println("[C] " + LIBNAME + " | " + data);
}
public static void error(String data) {
System.out.println("[E] " + LIBNAME + " | " + data);
}
public static void warning(String data) {
System.out.println("[W] " + LIBNAME + " | " + data);
}
public static void info(String data) {
System.out.println("[I] " + LIBNAME + " | " + data);
}
public static void debug(String data) {
System.out.println("[D] " + LIBNAME + " | " + data);
}
public static void verbose(String data) {
System.out.println("[V] " + LIBNAME + " | " + data);
}
public static void todo(String data) {
System.out.println("[TODO] " + LIBNAME + " | " + data);
}
}

View File

@ -5,12 +5,11 @@ import java.io.InputStream;
import java.nio.ByteBuffer;
import org.atriasoft.etk.Uri;
import org.atriasoft.pngdecoder.PNGDecoder;
import org.atriasoft.pngdecoder.PNGDecoder.Format;
public class ImageLoader {
public static ImageRawData decodePngFile(final Uri filename) {
public static ImageRawData decodePngFile(final Uri filename) throws Exception {
ByteBuffer buf = null;
int tWidth = 0;
int tHeight = 0;
@ -18,6 +17,9 @@ public class ImageLoader {
try {
// Open the PNG file as an InputStream
final InputStream in = Uri.getStream(filename);
if (in == null) {
throw new Exception("fail to get th estream ...");
}
// Link the PNG decoder to this stream
final PNGDecoder decoder = new PNGDecoder(in);
// Get the width and height of the texture