Skip to content

Commit

Permalink
Renamed MeshGenerator & include the fixed version of formic.
Browse files Browse the repository at this point in the history
  • Loading branch information
crykn committed Jun 3, 2020
1 parent 57aa68e commit 473cd4f
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 29 deletions.
27 changes: 14 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@

[![Release](https://jitpack.io/v/crykn/guacamole.svg)](https://jitpack.io/#crykn/guacamole)

A small library of some common and **very basic utils for [libGDX](https://github.com/libgdx/libgdx) games**, which is used in [libgdx-screenmanager](https://github.com/crykn/libgdx-screenmanager) and [eskalon-commons](https://github.com/eskalon/eskalon-commons).
A small collection of some common and **very basic utilities for [libGDX](https://github.com/libgdx/libgdx) games**, which is used in [libgdx-screenmanager](https://github.com/crykn/libgdx-screenmanager) and [eskalon-commons](https://github.com/eskalon/eskalon-commons).

## Core

```
dependencies {
implementation 'com.github.crykn.guacamole:core:X.Y.Z'
implementation 'com.github.crykn.guacamole:core:$guacamoleVersion'
}
```

* [`Preconditions`](https://github.com/crykn/guacamole/blob/master/core/src/main/java/de/damios/guacamole/Preconditions.java): has methods like `#checkArgument(boolean, String)`, `#checkState(boolean, String)` & `checkNotNull(Object, String)`; is slimmer than the commonly known class from [guava](https://github.com/google/guava/wiki/PreconditionsExplained)
* [`Exceptions`](https://github.com/crykn/guacamole/blob/master/core/src/main/java/de/damios/guacamole/Exceptions.java): `#throwAsRuntimeException(Exception)`
* [Preconditions](https://github.com/crykn/guacamole/blob/master/core/src/main/java/de/damios/guacamole/Preconditions.java): has methods like `#checkArgument(boolean, String)`, `#checkState(boolean, String)` & `#checkNotNull(Object, String)`; is slimmer than the commonly known class from [guava](https://github.com/google/guava/wiki/PreconditionsExplained)
* [Exceptions](https://github.com/crykn/guacamole/blob/master/core/src/main/java/de/damios/guacamole/Exceptions.java): `#throwAsRuntimeException(Exception)`
* [Pair](https://github.com/crykn/guacamole/blob/master/core/src/main/java/de/damios/guacamole/tuple/Pair.java) & [Triple](https://github.com/crykn/guacamole/blob/master/core/src/main/java/de/damios/guacamole/tuple/Triple.java) implementations (immutable)
* [`@Beta`](https://github.com/crykn/guacamole/blob/master/core/src/main/java/de/damios/guacamole/annotations/Beta.java): an annotation to denote APIs that may be subject to changes in future releases
* [`@GwtIncompatible`](https://github.com/crykn/guacamole/blob/master/core/src/main/java/de/damios/guacamole/annotations/GwtIncompatible.java): indicates that an API is not compatible with GWT and thus shouldn't be compiled for it
* Simple callback & listener interfaces: [`ISimpleCallback`](https://github.com/crykn/guacamole/blob/master/core/src/main/java/de/damios/guacamole/ISimpleCallback.java), [`ISimpleListener`](https://github.com/crykn/guacamole/blob/master/core/src/main/java/de/damios/guacamole/ISimpleListener.java), [`ISuccessCallback`](https://github.com/crykn/guacamole/blob/master/core/src/main/java/de/damios/guacamole/ISuccessCallback.java)
* [@Beta](https://github.com/crykn/guacamole/blob/master/core/src/main/java/de/damios/guacamole/annotations/Beta.java): an annotation to denote APIs that may be subject to changes in future releases
* [@GwtIncompatible](https://github.com/crykn/guacamole/blob/master/core/src/main/java/de/damios/guacamole/annotations/GwtIncompatible.java): indicates that an API is not compatible with GWT and thus shouldn't be compiled for it
* Simple callback & listener interfaces: [ISimpleCallback](https://github.com/crykn/guacamole/blob/master/core/src/main/java/de/damios/guacamole/ISimpleCallback.java), [ISimpleListener](https://github.com/crykn/guacamole/blob/master/core/src/main/java/de/damios/guacamole/ISimpleListener.java), [ISuccessCallback](https://github.com/crykn/guacamole/blob/master/core/src/main/java/de/damios/guacamole/ISuccessCallback.java)

## gdx & gdx-desktop & gdx-gwt

Expand Down Expand Up @@ -59,10 +59,11 @@ Module file (_GdxDefinition.gwt.xml_):

### What is added:

* [`NestableFrameBuffer`](https://github.com/crykn/guacamole/blob/master/gdx/src/main/java/de/damios/guacamole/gdx/NestableFrameBuffer.java): a nestable frame buffer implementation, see [here](https://github.com/crykn/libgdx-screenmanager/wiki/Custom-FrameBuffer-implementation) for details
* `GLUtils` (super-sourced in guacamole-gdx-gwt): adds a `#getBoundFboHandle()` method
* [`Sync`](https://github.com/crykn/guacamole/blob/master/gdx-desktop/src/main/java/de/damios/guacamole/gdx/Sync.java) (in guacamole-gdx-desktop): Adds the commonly used [sync class](http://forum.lwjgl.org/index.php?topic=6582.msg34846#msg34846) from LWJGL2; see [here](https://github.com/crykn/guacamole/wiki/Sync-usage) for how to use it
* [`ShaderProgramFactory`](https://github.com/crykn/guacamole/blob/master/gdx/src/main/java/de/damios/guacamole/gdx/ShaderProgramFactory.java) & [`ShaderPreconditions`](https://github.com/crykn/guacamole/blob/master/gdx/src/main/java/de/damios/guacamole/gdx/ShaderProgramFactory.java#L107): Adds methods to easily create & compile a shader; exceptions can be automatically thrown when the compilation fails; prepends can be ignored
* [`Log`](https://github.com/crykn/guacamole/blob/master/gdx/src/main/java/de/damios/guacamole/gdx/Log.java): Adds a static helper class to log stuff using the libGDX logger; adds support for `String#format(String, Object...)`; does also work on GWT via [formic](https://github.com/tommyettinger/formic)
* [`MeshGenerator`](https://github.com/crykn/guacamole/blob/master/gdx/src/main/java/de/damios/guacamole/gdx/MeshGenerator.java): allows easily creating different quads
* **gdx & gdx-gwt**
* [NestableFrameBuffer](https://github.com/crykn/guacamole/blob/master/gdx/src/main/java/de/damios/guacamole/gdx/NestableFrameBuffer.java): a nestable framebuffer implementation, see [here](https://github.com/crykn/libgdx-screenmanager/wiki/Custom-FrameBuffer-implementation) for details
* [ShaderProgramFactory](https://github.com/crykn/guacamole/blob/master/gdx/src/main/java/de/damios/guacamole/gdx/ShaderProgramFactory.java) & [ShaderPreconditions](https://github.com/crykn/guacamole/blob/master/gdx/src/main/java/de/damios/guacamole/gdx/ShaderProgramFactory.java#L107): Adds methods to easily create & compile a shader (`#fromString(String, String)`); automatically throws exceptions when the compilation fails; prepends can be ignored
* [Log](https://github.com/crykn/guacamole/blob/master/gdx/src/main/java/de/damios/guacamole/gdx/Log.java): Adds a static helper class to log stuff using the libGDX logger; adds support for `String#format(String, Object...)`; is super-sourced on GWT via [formic](https://github.com/tommyettinger/formic)
* [QuadMeshGenerator](https://github.com/crykn/guacamole/blob/master/gdx/src/main/java/de/damios/guacamole/gdx/QuadMeshGenerator.java): allows easily creating different quads; is useful when applying shaders
* **gdx-desktop**
* [Sync](https://github.com/crykn/guacamole/blob/master/gdx-desktop/src/main/java/de/damios/guacamole/gdx/Sync.java): Adds the commonly used [sync class](http://forum.lwjgl.org/index.php?topic=6582.msg34846#msg34846) (originally from LWJGL2), which helps mitigate the fps issues in LWJGL3; see [here](https://github.com/crykn/guacamole/wiki/Sync-usage) for how to use it

5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ allprojects {
version = "0.1.0"
ext {
appName = "guacamole"
formicVersion = "0.1.4"
gdxVersion = "1.9.10"
jsrVersion = "3.0.2"
junitVersion = "5.6.0"
Expand Down Expand Up @@ -75,8 +76,8 @@ project(":gdx-gwt") {

dependencies {
implementation "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion"
api "com.github.tommyettinger:formic:0.1.3"
api "com.github.tommyettinger:formic:0.1.3:sources"
api "com.github.tommyettinger:formic:$formicVersion"
api "com.github.tommyettinger:formic:$formicVersion:sources"
}
}

Expand Down
2 changes: 1 addition & 1 deletion gdx-gwt/src/main/java/guacamole_gdx_gwt.gwt.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit trunk//EN" "http://www.gwtproject.org/doctype/2.8.0/gwt-module.dtd">
<module>
<inherits name="text.formic" />
<inherits name="formic" />
<inherits name="guacamole_gdx" />

<super-source path="gwt/emu" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* limitations under the License.
*/

package de.damios.guacamole.gdx;
package de.damios.guacamole.gdx.graphics;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* limitations under the License.
*/

package de.damios.guacamole.gdx;
package de.damios.guacamole.gdx.graphics;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* limitations under the License.
*/

package de.damios.guacamole.gdx;
package de.damios.guacamole.gdx.graphics;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* limitations under the License.
*/

package de.damios.guacamole.gdx;
package de.damios.guacamole.gdx.graphics;

import com.badlogic.gdx.graphics.Mesh;
import com.badlogic.gdx.graphics.VertexAttribute;
Expand All @@ -23,9 +23,9 @@
*
* @author damios
*/
public final class MeshGenerator {
public final class QuadMeshGenerator {

private MeshGenerator() {
private QuadMeshGenerator() {
throw new UnsupportedOperationException();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.damios.guacamole.gdx;
package de.damios.guacamole.gdx.graphics;

import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.glutils.ShaderProgram;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
package de.damios.guacamole.gdx;
package de.damios.guacamole.gdx.graphics;

import static org.junit.jupiter.api.Assertions.assertArrayEquals;

import org.junit.jupiter.api.Test;

public class MeshGeneratorTest extends LibgdxUnitTest {
import de.damios.guacamole.gdx.LibgdxUnitTest;
import de.damios.guacamole.gdx.graphics.QuadMeshGenerator;

public class QuadMeshGeneratorTest extends LibgdxUnitTest {

@Test
public void testFullScreenQuad() {
float[] expectedVertices = { 0F, 0F, 0F, 0F, 0F, 0F, 100F, 0F, 0F, 1F,
200F, 0F, 0F, 1F, 0F, 200F, 100F, 0F, 1F, 1F };
assertArrayEquals(expectedVertices,
MeshGenerator.createFullScreenQuad(200, 100, true)
QuadMeshGenerator.createFullScreenQuad(200, 100, true)
.getVertices(new float[20]));
}

Expand All @@ -20,7 +23,7 @@ public void testFlippedFullScreenQuad() {
float[] expectedVertices = { 0F, 0F, 0F, 0F, 1F, 0F, 100F, 0F, 0F, 0F,
200F, 0F, 0F, 1F, 1F, 200F, 100F, 0F, 1F, 0F };
assertArrayEquals(expectedVertices,
MeshGenerator.createFullScreenQuad(200, 100, false)
QuadMeshGenerator.createFullScreenQuad(200, 100, false)
.getVertices(new float[20]));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.damios.guacamole.gdx;
package de.damios.guacamole.gdx.graphics;

import static org.junit.jupiter.api.Assertions.assertThrows;

Expand All @@ -8,7 +8,7 @@
import com.badlogic.gdx.graphics.glutils.ShaderProgram;
import com.badlogic.gdx.utils.GdxRuntimeException;

import de.damios.guacamole.gdx.ShaderProgramFactory.ShaderPreconditions;
import de.damios.guacamole.gdx.graphics.ShaderProgramFactory.ShaderPreconditions;

public class ShaderPreconditionsTest {

Expand Down

0 comments on commit 473cd4f

Please sign in to comment.