Moved USS2, reimplemented RAID as GameObjectManager

This commit is contained in:
Natty 2022-04-06 18:43:16 +02:00
parent 0e5c5370b3
commit 7f1cc3a7a3
No known key found for this signature in database
GPG Key ID: 40AB22FA416C7019
14 changed files with 221 additions and 33 deletions

View File

@ -1,8 +1,14 @@
## 22.2.0.0-alpha.1 ## 22.0.0.0-alpha.2
* `[SDK]` **Created a new extension project category**
* `[PlutoUSS2]` **Now an extension**
* `PlutoLib` no longer depends on `PlutoUSS2`
* `[PlutoGameObject]` **Reimplemented `RAID` as a Pluto extension**
## 22.0.0.0-alpha.1
* `[SDK]` Jar sources and JavaDoc are now published * `[SDK]` Jar sources and JavaDoc are now published
* `[PlutoRuntime]` `Mod` objects now properly contain the version number * `[PlutoRuntime]` `Mod` objects now properly contain the version number
## 22.2.0.0-alpha.0 ## 22.0.0.0-alpha.0
* Version bumped to 2022 * Version bumped to 2022
* `[SDK]` Maven version is now properly set again * `[SDK]` Maven version is now properly set again

View File

@ -22,7 +22,7 @@ object Versions {
const val isPrerelease = true const val isPrerelease = true
const val prereleaseName = "alpha" const val prereleaseName = "alpha"
const val prerealeaseUpdate = 1 const val prerealeaseUpdate = 2
val versionFull = val versionFull =
if (isPrerelease) if (isPrerelease)

View File

@ -1,21 +1,13 @@
import org.plutoengine.Versions import org.plutoengine.Versions
task("publish") { task("publish") {
dependsOn(":plutoengine:plutouss2:publish") file(".").listFiles().forEach {
dependsOn(":plutoengine:plutolib:publish") if (!it.isDirectory)
dependsOn(":plutoengine:plutocomponent:publish") return@forEach
dependsOn(":plutoengine:plutoruntime:publish")
dependsOn(":plutoengine:plutodisplay:publish")
dependsOn(":plutoengine:plutotexture:publish")
dependsOn(":plutoengine:plutomesher:publish")
dependsOn(":plutoengine:plutoshader:publish")
dependsOn(":plutoengine:plutoframebuffer:publish")
dependsOn(":plutoengine:plutospritesheet:publish")
dependsOn(":plutoengine:plutogui:publish")
dependsOn(":plutoengine:plutoaudio:publish")
dependsOn(":plutoengine:plutocore:publish")
}
dependsOn(":plutoengine:${it.name}:publish")
}
}
subprojects { subprojects {
apply(plugin = "java") apply(plugin = "java")

View File

@ -8,8 +8,6 @@ plugins {
description = "Multi-purpose utility library that can be used in basically any project." description = "Multi-purpose utility library that can be used in basically any project."
dependencies { dependencies {
api(project(":plutoengine:plutouss2"))
api("org.jetbrains", "annotations", "23.0.0") api("org.jetbrains", "annotations", "23.0.0")
api("org.yaml", "snakeyaml", "1.28") api("org.yaml", "snakeyaml", "1.28")

28
engine-ext/.gitignore vendored Executable file
View File

@ -0,0 +1,28 @@
/*/.settings
/.vscode
# Ignore Eclipse project files
/*/.project
/*/.classpath
/.project
/.settings
# Ignore IDEA project files
/.idea
/*/.idea
.idea
*.log
/.gradle/
# Ignore Gradle project-specific cache directory
.gradle
# Ignore Gradle build output directory
/build
/*/build
/bin
/*/bin

71
engine-ext/build.gradle.kts Executable file
View File

@ -0,0 +1,71 @@
import org.plutoengine.Versions
task("publish") {
file(".").listFiles().forEach {
if (!it.isDirectory)
return@forEach
dependsOn(":plutoengine-ext:${it.name}:publish")
}
}
subprojects {
apply(plugin = "java")
apply(plugin = "java-library")
apply(plugin = "maven-publish")
apply(plugin = "signing")
repositories {
mavenCentral()
}
configure<JavaPluginExtension> {
sourceCompatibility = Versions.javaTargetVersion
targetCompatibility = Versions.javaTargetVersion
withJavadocJar()
withSourcesJar()
}
configure<SourceSetContainer> {
named("main") {
tasks.withType<Jar> {
from(allJava)
}
}
}
configure<PublishingExtension> {
publications {
create<MavenPublication>("maven") {
from(components["java"])
}
}
repositories {
maven {
name = "Vega"
url = uri("https://vega.botdiril.com/")
credentials {
val vegaUsername: String? by project
val vegaPassword: String? by project
username = vegaUsername
password = vegaPassword
}
}
}
}
tasks.withType<Jar> {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
configure<SigningExtension> {
val signingKey: String? by project
val signingPassword: String? by project
useInMemoryPgpKeys(signingKey, signingPassword)
sign(the<PublishingExtension>().publications["maven"])
}
}

View File

@ -0,0 +1,10 @@
plugins {
java
`java-library`
}
description = "A small library for assigning objects easy to store numerical identifiers."
dependencies {
implementation(project(":plutoengine:plutoruntime"))
}

View File

@ -0,0 +1,66 @@
package org.plutoengine.gameobject;
import org.jetbrains.annotations.NotNull;
import java.util.*;
public class GameObjectRegistry<H, E extends IGameObject<H>> implements Iterable<E>
{
private static final int INITIAL_SIZE = 512;
private final List<E> lookup;
private final Map<H, E> reverseLookup;
public GameObjectRegistry()
{
this.lookup = new ArrayList<>(INITIAL_SIZE);
this.reverseLookup = new HashMap<>(INITIAL_SIZE);
}
public void register(E item)
{
var key = item.objectKey();
if (this.reverseLookup.containsKey(key))
throw new IllegalArgumentException("Cannot register two items with the same key!");
var position = this.lookup.size();
this.lookup.add(item);
this.reverseLookup.put(key, item);
item.onRegister(position);
}
public Optional<E> getByID(int id)
{
try
{
return Optional.of(this.lookup.get(id));
}
catch (IndexOutOfBoundsException e)
{
return Optional.empty();
}
}
public Optional<E> getByKey(H key)
{
return Optional.of(this.reverseLookup.get(key));
}
public Optional<Integer> getIDOf(H key)
{
return this.getByKey(key).map(IGameObject::objectID);
}
public Optional<H> getKeyOf(int id)
{
return this.getByID(id).map(IGameObject::objectKey);
}
@NotNull
@Override
public Iterator<E> iterator()
{
return this.lookup.iterator();
}
}

View File

@ -0,0 +1,10 @@
package org.plutoengine.gameobject;
public interface IGameObject<H>
{
H objectKey();
void onRegister(int objectID);
int objectID();
}

View File

@ -1,23 +1,30 @@
rootProject.name = "plutoengine-sdk" rootProject.name = "plutoengine-sdk"
include("plutoengine", include("plutoengine",
"plutoengine-ext",
"plutoengine-demos") "plutoengine-demos")
project(":plutoengine").projectDir = file("./engine-core") project(":plutoengine").projectDir = file("./engine-core")
project(":plutoengine-ext").projectDir = file("./engine-ext")
project(":plutoengine-demos").projectDir = file("./engine-demo") project(":plutoengine-demos").projectDir = file("./engine-demo")
include ("plutoengine:plutouss2", file("engine-core").listFiles().forEach {
"plutoengine:plutolib", if (!it.isDirectory)
"plutoengine:plutocomponent", return@forEach
"plutoengine:plutoruntime",
"plutoengine:plutodisplay",
"plutoengine:plutotexture",
"plutoengine:plutomesher",
"plutoengine:plutoshader",
"plutoengine:plutoframebuffer",
"plutoengine:plutospritesheet",
"plutoengine:plutogui",
"plutoengine:plutoaudio",
"plutoengine:plutocore")
include("plutoengine-demos:basic-application") include("plutoengine:${it.name}")
}
file("engine-ext").listFiles().forEach {
if (!it.isDirectory)
return@forEach
include("plutoengine-ext:${it.name}")
}
file("engine-demo").listFiles().forEach {
if (!it.isDirectory)
return@forEach
include("plutoengine-demos:${it.name}")
}