Compare commits

...

9 Commits

Author SHA1 Message Date
Natty 0ece56a871
Updated Libra 2023-03-27 19:57:06 +02:00
Natty 88c966974c
Rocket flames and fixed Maven repo URL 2023-03-27 19:55:46 +02:00
Natty 29e9f42bde
Removed pointless class hierarchy 2022-08-19 02:35:09 +02:00
Natty 54ade78b1d
Updated .gitignore to exclude out/ directories 2022-07-21 01:16:32 +02:00
Natty 6ba1dfa2cb
PlutoComponent cleanup 2022-06-22 01:37:27 +02:00
Natty 27f4882fcc
Used the integrated color buffer clear method 2022-05-10 01:13:16 +02:00
Natty d178a303bd
Code cleanup 2022-05-07 21:51:54 +02:00
Natty c1c248be87
Extra licensing info 2022-05-04 04:34:26 +02:00
Natty cbab0a8153
Extra licensing info 2022-05-04 04:23:52 +02:00
24 changed files with 170 additions and 116 deletions

35
LICENSING_INFO.txt Normal file
View File

@ -0,0 +1,35 @@
SOFTWARE LICENSING
==================
While PlutoEngine is licensed under the MIT license, see
individual libraries and their license requirements.
MEDIA LICENSING
===============
This repository contains some first-party media files, such as audio,
fonts and images. See "Third party media within this repository" for
exceptions.
Unless specified otherwise:
This content may be freely used under the https://creativecommons.org/publicdomain/zero/1.0/ license
as long as it is used within an application based on PlutoEngine and does not misrepresent
PlutoEngine or any of the PlutoEngine authors and does not remove this restriction.
OR
This content may be freely used under the https://creativecommons.org/licenses/by-nd/4.0/ license
with no further restrictions.
OR
This content may be freely used under the https://creativecommons.org/licenses/by-sa/4.0/ license
with no further restrictions.
Third party media within this repository
========================================
file "engine-demo/jsr-clone/mods/tefek.srclone/default/sound/game_st.ogg":
"Safehouse" by Selulance
https://www.youtube.com/watch?v=-kNx6sqReFk
Licensed under https://creativecommons.org/licenses/by/3.0/

View File

@ -19,7 +19,7 @@ repositories {
maven {
name = "Vega"
url = uri("https://vega.botdiril.com/")
url = uri("https://vega.botdiril.com/releases")
}
}
@ -36,7 +36,7 @@ repositories {
maven {
name = "Vega"
url = uri("https://vega.botdiril.com/")
url = uri("https://vega.botdiril.com/releases")
}
}
@ -47,10 +47,9 @@ dependencies {
### Licensing
While all code of PlutoEngine is licensed under MIT, some media in this repository
is licensed under different terms:
The code of PlutoEngine is licensed under the MIT license.
* Music in the **jsr-clone** demo is made by Selulance, licensed under **CC - BY 3.0**
See [LICENSING_INFO](https://github.com/493msi/plutoengine/blob/master/LICENSING_INFO.txt) for further information.
### Versioning

View File

@ -1,3 +1,7 @@
## 22.3.0.0-alpha.1
* `[PlutoComponent]` Removing components using a token should have the same semantics as removing individual components
* `[PlutoComponent]` Made the addition and removal of components hookable before mount events are fired
## 22.3.0.0-alpha.0
* `[SDK]` **Combined `PlutoFramebuffer`, `PlutoMesher`, `PlutoShader` and `PlutoTexture`
into `PlutoRender`**

View File

@ -1,6 +1,5 @@
package org.plutoengine
import org.gradle.internal.os.OperatingSystem
import org.gradle.api.JavaVersion
object Versions {
@ -28,7 +27,7 @@ object Versions {
const val isPrerelease = true
const val prereleaseName = "alpha"
const val prerealeaseUpdate = 0
const val prerealeaseUpdate = 1
val versionFull =
if (isPrerelease)

View File

@ -26,3 +26,6 @@
/bin
/*/bin
/out
/*/out

View File

@ -45,7 +45,7 @@ subprojects {
repositories {
maven {
name = "Vega"
url = uri("https://vega.botdiril.com/")
url = uri("https://vega.botdiril.com/releases")
credentials {
val vegaUsername: String? by project
val vegaPassword: String? by project

View File

@ -87,7 +87,7 @@ abstract class AudioDoubleBufferedSource extends AudioSource
if (this.closed)
return false;
var state = AL10.alGetSourcei(this.id, AL10.AL_SOURCE_STATE);
var state = this.getState();
return switch (state)
{
@ -147,7 +147,11 @@ abstract class AudioDoubleBufferedSource extends AudioSource
}
return unqueued;
}
private int getState()
{
return AL10.alGetSourcei(this.id, AL10.AL_SOURCE_STATE);
}
public boolean update()
@ -158,7 +162,9 @@ abstract class AudioDoubleBufferedSource extends AudioSource
var unqueued = this.unqueueBuffers();
unqueued.forEach(this::stream);
if (AL10.alGetSourcei(this.id, AL10.AL_SOURCE_STATE) == AL10.AL_STOPPED)
var sourceState = this.getState();
if (sourceState == AL10.AL_STOPPED)
{
if (this.audioBufferDepleted)
return false;

View File

@ -28,6 +28,7 @@ import org.apache.commons.collections4.MultiValuedMap;
import org.apache.commons.collections4.multimap.ArrayListValuedHashMap;
import org.apache.commons.collections4.multimap.HashSetValuedHashMap;
import org.apache.commons.lang3.ClassUtils;
import org.jetbrains.annotations.MustBeInvokedByOverriders;
import org.jetbrains.annotations.NotNull;
import java.util.*;
@ -74,6 +75,14 @@ public class ComponentManager<R extends AbstractComponent<R>>
this.components.put(token, component);
this.tokens.put(component, token);
this.onComponentAdded(component);
return component;
}
@MustBeInvokedByOverriders
protected void onComponentAdded(R component)
{
try
{
component.initialize(this);
@ -82,8 +91,6 @@ public class ComponentManager<R extends AbstractComponent<R>>
{
throw new RuntimeException("An exception has occured while mounting the component", e);
}
return component;
}
public Class<R> getComponentBase()
@ -130,6 +137,12 @@ public class ComponentManager<R extends AbstractComponent<R>>
classes.forEach(clazz -> this.implementationProviders.removeMapping(clazz, component));
this.onComponentRemoved(component);
}
@MustBeInvokedByOverriders
protected void onComponentRemoved(R component)
{
try
{
component.destroy(this);
@ -151,14 +164,7 @@ public class ComponentManager<R extends AbstractComponent<R>>
classes.forEach(clazz -> this.implementationProviders.removeMapping(clazz, component));
try
{
component.onUnmount();
}
catch (Exception e)
{
throw new RuntimeException("An exception has occured whiile unmounting the component", e);
}
this.onComponentRemoved(component);
});
}
}

View File

@ -25,13 +25,12 @@
package org.plutoengine.graphics.fbo;
import org.lwjgl.opengl.GL33;
import org.plutoengine.logger.Logger;
import org.plutoengine.logger.SmartSeverity;
import java.util.ArrayList;
import java.util.List;
import org.plutoengine.logger.Logger;
import org.plutoengine.logger.SmartSeverity;
public class Framebuffer
{
private int id;

View File

@ -28,3 +28,6 @@
/*/bin
/*/logs
/out
/*/out

View File

@ -4,5 +4,3 @@ Selulance - Safehouse
https://www.youtube.com/watch?v=-kNx6sqReFk
Licensed under https://creativecommons.org/licenses/by/3.0/
Thank you

View File

@ -186,7 +186,7 @@ public class Game
var scoreFont = new TextStyleOptions(24)
.setPaint(LiPaint.solidColor(Color.WHITE));
ImmediateFontRenderer.drawString(5.0f, 5.0f, ("S %010.0f").formatted(this.entityPlayer.getScore()), SRCloneMod.srCloneFont, scoreFont);
ImmediateFontRenderer.drawString(5.0f, 5.0f, "S %010.0f".formatted(this.entityPlayer.getScore()), SRCloneMod.srCloneFont, scoreFont);
if (this.deathScreenAnimation > 1.0f)
{

View File

@ -36,6 +36,7 @@ import org.plutoengine.libra.text.shaping.TextStyleOptions;
import org.plutoengine.math.ProjectionMatrix;
import org.plutoengine.graphics.shader.uniform.auto.AutomaticUniforms;
import org.plutoengine.util.color.Color;
import org.plutoengine.util.color.RGBA;
import java.util.concurrent.TimeUnit;
@ -47,6 +48,7 @@ public class Main extends PlutoApplication
var cfg = new PlutoApplication.StartupConfig();
cfg.windowInitialDimensions(1280, 720);
cfg.windowName("jsr-clone");
cfg.clearColor(new RGBA(0.0f, 0.0f, 0.0f, 1.0f));
// cfg.vsync(1);
app.run(args, cfg);
}
@ -71,9 +73,6 @@ public class Main extends PlutoApplication
GL33.glEnable(GL33.GL_BLEND);
GL33.glBlendFunc(GL33.GL_SRC_ALPHA, GL33.GL_ONE_MINUS_SRC_ALPHA);
GL33.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
GL33.glClear(GL33.GL_COLOR_BUFFER_BIT);
var projection = ProjectionMatrix.createOrtho2D(this.display.getWidth(), this.display.getHeight());
AutomaticUniforms.VIEWPORT_PROJECTION.fire(projection);

View File

@ -30,6 +30,7 @@ import cz.tefek.srclone.Game;
import cz.tefek.srclone.SRCloneMod;
import cz.tefek.srclone.ammo.EnumAmmo;
import cz.tefek.srclone.entity.pickup.EntityBox;
import cz.tefek.srclone.util.AngleUtil;
public class EntityEnemyScout extends EntityEnemy
{
@ -128,11 +129,43 @@ public class EntityEnemyScout extends EntityEnemy
{
float w = 128, h = 128;
float engineOffset = 20;
float engineX = this.getRenderX() - (float) (Math.sin(this.rotation) * engineOffset);
float engineY = this.getRenderY() - (float) (Math.cos(this.rotation) * engineOffset);
float nozzleRot = (float) (-this.rotation + Math.PI / 4.0f * 3.0f);
if (Math.cos(this.rotation) > 0.3f)
{
RectangleRenderer2D.draw(SRCloneMod.centeredQuad)
.at(engineX, engineY, w, h)
.rotate(AngleUtil.snapToDirections(nozzleRot, SRCloneMod.enemyScout.getSideCount()))
.recolor(1.0f, 0.0f, 1.0f, 0.3f)
.texture(SRCloneMod.rocketNozzle)
.flush();
RectangleRenderer2D.draw(SRCloneMod.centeredQuad)
.at(this.getRenderX(), this.getRenderY(), w, h)
.sprite(SRCloneMod.enemyScout.getSideFromAngle(this.rotation))
.flush();
}
else
{
RectangleRenderer2D.draw(SRCloneMod.centeredQuad)
.at(this.getRenderX(), this.getRenderY(), w, h)
.sprite(SRCloneMod.enemyScout.getSideFromAngle(this.rotation))
.flush();
RectangleRenderer2D.draw(SRCloneMod.centeredQuad)
.at(engineX, engineY, w, h)
.rotate(AngleUtil.snapToDirections(nozzleRot, SRCloneMod.enemyScout.getSideCount()))
.recolor(1.0f, 0.0f, 1.0f, 0.3f)
.texture(SRCloneMod.rocketNozzle)
.flush();
}
}
@Override
public void onDie()

View File

@ -124,11 +124,43 @@ public class EntityEnemySmallBomber extends EntityEnemy
{
float w = 128, h = 128;
float engineOffset = 15;
float engineX = this.getRenderX() - (float) (Math.sin(this.rotation) * engineOffset);
float engineY = this.getRenderY() - (float) (Math.cos(this.rotation) * engineOffset);
float nozzleRot = (float) (-this.rotation + Math.PI / 4.0f * 3.0f);
if (Math.cos(this.rotation) > 0.3f)
{
RectangleRenderer2D.draw(SRCloneMod.centeredQuad)
.at(engineX, engineY, w, h)
.rotate(AngleUtil.snapToDirections(nozzleRot, SRCloneMod.enemySmallBomber.getSideCount()))
.recolor(1.0f, 0.0f, 1.0f, 0.3f)
.texture(SRCloneMod.rocketNozzle)
.flush();
RectangleRenderer2D.draw(SRCloneMod.centeredQuad)
.at(this.getRenderX(), this.getRenderY(), w, h)
.sprite(SRCloneMod.enemySmallBomber.getSideFromAngle(this.rotation))
.flush();
}
else
{
RectangleRenderer2D.draw(SRCloneMod.centeredQuad)
.at(this.getRenderX(), this.getRenderY(), w, h)
.sprite(SRCloneMod.enemySmallBomber.getSideFromAngle(this.rotation))
.flush();
RectangleRenderer2D.draw(SRCloneMod.centeredQuad)
.at(engineX, engineY, w, h)
.rotate(AngleUtil.snapToDirections(nozzleRot, SRCloneMod.enemySmallBomber.getSideCount()))
.recolor(1.0f, 0.0f, 1.0f, 0.3f)
.texture(SRCloneMod.rocketNozzle)
.flush();
}
}
@Override
public void onDie()

View File

@ -30,7 +30,7 @@ import cz.tefek.srclone.EnumTeam;
import cz.tefek.srclone.SRCloneMod;
import cz.tefek.srclone.ammo.EnumAmmo;
public class EntityProjectileEnemyHeatStar extends EntityProjectileHeatStar
public class EntityProjectileEnemyHeatStar extends EntityProjectileAmmo
{
public EntityProjectileEnemyHeatStar()
{

View File

@ -30,7 +30,7 @@ import cz.tefek.srclone.EnumTeam;
import cz.tefek.srclone.SRCloneMod;
import cz.tefek.srclone.ammo.EnumAmmo;
public class EntityProjectileEnemyLaserBeam extends EntityProjectileLaserBeam
public class EntityProjectileEnemyLaserBeam extends EntityProjectileAmmo
{
public EntityProjectileEnemyLaserBeam()
{

View File

@ -1,36 +0,0 @@
/*
* MIT License
*
* Copyright (c) 2022 493msi
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package cz.tefek.srclone.entity.projectile;
import cz.tefek.srclone.ammo.EnumAmmo;
public class EntityProjectileHeatStar extends EntityProjectileAmmo
{
protected EntityProjectileHeatStar(EnumAmmo ammo)
{
super(ammo);
}
}

View File

@ -1,35 +0,0 @@
/*
* MIT License
*
* Copyright (c) 2022 493msi
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package cz.tefek.srclone.entity.projectile;
import cz.tefek.srclone.ammo.EnumAmmo;
public class EntityProjectileLaserBeam extends EntityProjectileAmmo
{
protected EntityProjectileLaserBeam(EnumAmmo ammo)
{
super(ammo);
}
}

View File

@ -30,7 +30,7 @@ import cz.tefek.srclone.EnumTeam;
import cz.tefek.srclone.SRCloneMod;
import cz.tefek.srclone.ammo.EnumAmmo;
public class EntityProjectilePlayerLaserBeam extends EntityProjectileLaserBeam
public class EntityProjectilePlayerLaserBeam extends EntityProjectileAmmo
{
public EntityProjectilePlayerLaserBeam()
{

View File

@ -38,4 +38,9 @@ public class AngleUtil
return angle;
}
public static float snapToDirections(float angle, int directions)
{
return (float) (2.0f * Math.PI * Math.round(angle / 2.0f / Math.PI * directions) / directions);
}
}

View File

@ -26,3 +26,7 @@
/bin
/*/bin
/out
/*/out

View File

@ -46,7 +46,7 @@ subprojects {
repositories {
maven {
name = "Vega"
url = uri("https://vega.botdiril.com/")
url = uri("https://vega.botdiril.com/releases")
credentials {
val vegaUsername: String? by project
val vegaPassword: String? by project

2
libra

@ -1 +1 @@
Subproject commit 96217baf8fc9510444c20dbe1872339f798096e7
Subproject commit 12bfe6a1eb4c92f7ec12da42c12014d63922655d