Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to Render Animations Made with Effekseer v1.62e #3

Open
SevenDayCandle opened this issue Feb 20, 2022 · 6 comments
Open

Unable to Render Animations Made with Effekseer v1.62e #3

SevenDayCandle opened this issue Feb 20, 2022 · 6 comments

Comments

@SevenDayCandle
Copy link

SevenDayCandle commented Feb 20, 2022

While I've been able to load and play animation files, I have been having trouble actually having the effects show up on my screen.

I had been testing out the library with a fresh libgdx project (version 1.10.0, desktop build, no other extensions/libraries added besides this project's libraries). I have tried tweaking around various parameters (i.e. using both an OrthographicCamera and a PerspectiveCamera, changing the TypeOpenGL core type, and applying transformations to the ParticleEffekseer). However, my program always only shows a black screen.

The effect files I have been using to test this were efk files built from the sample effects included with Effekseer 1.62.

I had tried logging the IsPlaing function on my Manager and I saw that the effect was indeed supposed to be playing, however.

If it helps, this is the code I am using for my helper class:

`

package com.mygdx.game;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.PerspectiveCamera;
import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.glutils.FrameBuffer;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.math.Vector3;
import io.github.srjohnathan.gdx.effekseer.core.EffekseerGdx;
import io.github.srjohnathan.gdx.effekseer.core.EffekseerManager;
import io.github.srjohnathan.gdx.effekseer.core.ParticleEffekseer;

import java.util.HashMap;

import static io.github.srjohnathan.gdx.effekseer.core.EffekseerCore.TypeOpenGL.OPEN_GL2;
import static io.github.srjohnathan.gdx.effekseer.core.EffekseerCore.TypeOpenGL.OPEN_GL3;

public class EffekseerHelper {
public static OrthographicCamera Camera;
protected static EffekseerManager Manager;
protected static final HashMap<String, ParticleEffekseer> ParticleEffects = new HashMap<>();
protected static ParticleEffekseer Current;
protected static FrameBuffer Buffer;
protected static Vector2 DrawPos;

public static void Initialize() {
    EffekseerGdx.init();
    Camera = new OrthographicCamera(1280, 720);
    Manager = new EffekseerManager(Camera, OPEN_GL2);
    Buffer = new FrameBuffer(Pixmap.Format.RGBA8888, Gdx.graphics.getWidth() / 4, Gdx.graphics.getHeight() / 4, false, false);
}

public static boolean Play(String key, Vector2 position) {
    return Play(key, position, null, null, null);
}

public static boolean Play(String key, Vector2 position, Vector3 rotationAxis, Float rotationAngle, Float scale) {
    ParticleEffekseer e = Start(key);
    if (e != null) {
        e.setMagnification(20f);
        DrawPos = position;
        Current = e;
        return true;
    }
    return false;
}

public static void Render(SpriteBatch sb) {
    Manager.draw(Gdx.graphics.getDeltaTime());
}

public static void Reset() {
    Manager.dispose();
    Initialize();
}

protected static ParticleEffekseer Start(String key) {
    try {
        if (Manager == null) {
            Initialize();
        }
        ParticleEffekseer e = ParticleEffects.get(key);
        if (e == null) {
            e = new ParticleEffekseer(Manager);
            e.load(key,true);
            ParticleEffects.put(key, e);
        }
        e.play();
        return e;
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}

public static class EFK {
    public static final String SWORD1 = "effects/Sword01.efk";
    public static final String TEST = "effects/Test.efk";
    public static final String TEST2 = "effects/test.efkpkg";
}

}

`

And this is my main application file:
`
public class MyGdxGame extends ApplicationAdapter {
SpriteBatch batch;
Texture img;

@Override
public void create () {
	batch = new SpriteBatch();
	img = new Texture("badlogic.jpg");
	EffekseerHelper.Play(EffekseerHelper.EFK.TEST, new Vector2(0,0));
}

@Override
public void render () {
	EffekseerHelper.Render(batch);
}

@Override
public void dispose () {
	batch.dispose();
	img.dispose();
}

}
`

@SevenDayCandle
Copy link
Author

For what it's worth, I also tried using efk files created from version 1.61e of Effekseeker, as well as using Libgdx 1.9.5, and I wasn't able to render images in those cases either.

@SrJohnathan
Copy link
Owner

forgot it
public static void Render(SpriteBatch sb) {
Gdx.gl.glClearColor(0.0f, 0f, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT|GL20.GL_DEPTH_BUFFER_BIT);
Manager.draw(Gdx.graphics.getDeltaTime());

}

@SevenDayCandle
Copy link
Author

This worked! Thank you!

@SrJohnathan
Copy link
Owner

today I will release a version of lib 2.2, with new features and fixes

@SevenDayCandle
Copy link
Author

Does this library work when run with older versions of Libgdx (e.g. 1.9.5)?

@SrJohnathan
Copy link
Owner

SrJohnathan commented Feb 20, 2022

no, later 1.10 as it was compiled with this version of libgdx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants