Init method for PlutoApplication

This commit is contained in:
Natty 2022-04-17 04:21:13 +02:00
parent 128577cdfa
commit 304cb1f756
No known key found for this signature in database
GPG Key ID: 40AB22FA416C7019
5 changed files with 35 additions and 19 deletions

View File

@ -1,5 +1,5 @@
## Features targeted for 22.2.0.0-alpha.0
* The layer subsystem
## Features targeted for 22.3.0.0-alpha.0
* `[PlutoRuntime,PlutoCore]` **Initial implementation of the layer system (formerly known as "stage")**
* A "layer", in this context, is a set of assets bound together
by programming logic.
Layer switching and asset management are handled by the engine.

View File

@ -1,5 +1,4 @@
## 22.2.0.0-alpha.0
* `[PlutoRuntime,PlutoCore]` **Initial implementation of the layer system (formerly known as "stage")**
* `[PlutoComponent]` **Added support for dependencies and strengtened type checks**
* `[PlutoComponent]` *Removed* `IComponent` as it was redundant to `AbstractComponent`
* `[Pluto*]` *Removed* JSR 305 annotations in favor of JetBrains annotations
@ -7,8 +6,9 @@
* `[PlutoRuntime]` *Moved* `ThreadSensitive` to `org.plutoengine.address`
* `[PlutoAudio]` Transformed into a PlutoLocalComponent
* `[PlutoAudio]` `IAudioStream` is now `AutoCloseable`
* `[PlutoCore]` `InputBus` now tied to a specific `Display` instead of searching for one in the Local
* `[PlutoCore]` `InputBus` is now tied to a specific `Display` instead of searching for one in the Local
* `[PlutoCore]` Separated `Mouse` and `Keyboard` from `InputBus` into child components
* `[PlutoCore]` Added an `init()` method that gets called before entering the main loop
## 22.1.0.0-alpha.1
* `plutoengine-demos/basic-application` Made the gradient in the fragment font shader rotatable

View File

@ -13,6 +13,8 @@ import org.plutoengine.l10n.PlutoL10n;
import org.plutoengine.logger.Logger;
import org.plutoengine.logger.SmartSeverity;
import org.plutoengine.mod.ModLoader;
import org.plutoengine.util.color.IRGBA;
import org.plutoengine.util.color.RGBA;
import java.nio.file.Path;
import java.util.Locale;
@ -30,6 +32,11 @@ public abstract class PlutoApplication
protected abstract Class<?> getMainModule();
protected void init()
{
}
protected abstract void loop();
protected PlutoApplication()
@ -98,6 +105,11 @@ public abstract class PlutoApplication
* <td><code>true</code></td>
* <td>Whether the window should be resizable</td>
* </tr>
* <tr>
* <td><code>clearColor</code></td>
* <td><code>RGBA(0f, 0.7f, 1f, 0f)</code></td>
* <td>What color to fill the screen buffer with when beginning a new frame.</td>
* </tr>
* </table>
*
* @author 493msi
@ -118,6 +130,7 @@ public abstract class PlutoApplication
private int vsync = 0;
private boolean windowResizable = true;
private Path[] icons = null;
private IRGBA clearColor = new RGBA(0f, 0.7f, 1f, 0f);
public StartupConfig icons(Path... paths)
{
@ -176,6 +189,12 @@ public abstract class PlutoApplication
return this;
}
public StartupConfig clearColor(IRGBA color)
{
this.clearColor = new RGBA(color.red(), color.green(), color.blue(), color.alpha());
return this;
}
public StartupConfig()
{
@ -258,10 +277,12 @@ public abstract class PlutoApplication
this.display.setIcons(icons);
}
this.init();
while (!this.display.isClosing())
{
GL33.glViewport(0, 0, this.display.getWidth(), this.display.getHeight());
GL33.glClearColor(0f, 0.7f, 1f, 0f);
GL33.glClearColor(config.clearColor.red(), config.clearColor.green(), config.clearColor.blue(), config.clearColor.alpha());
GL33.glClear(GL33.GL_COLOR_BUFFER_BIT | GL33.GL_DEPTH_BUFFER_BIT);
this.loop();

View File

@ -1,14 +0,0 @@
package org.plutoengine.graphics.gui;
import org.plutoengine.component.PlutoLocalComponent;
public class PlutoGUI extends PlutoLocalComponent
{
@Override
public boolean isUnique()
{
return true;
}
}

View File

@ -27,4 +27,13 @@ public class CollisionClass
{
return this.id;
}
@Override
public boolean equals(Object o)
{
if (this == o) return true;
if (o == null || this.getClass() != o.getClass()) return false;
CollisionClass that = (CollisionClass) o;
return this.id == that.id;
}
}