Cursor Effects & 2D Framework Emitter

Cursor Effects is getting a major overhaul. Here is the back story, for anyone interested in why this is being changed.

When cursor effects were added, the 2D framework did not exist, so it was implemented in a semi-hack way, using the OSRViewPort (Off screen renderer control) and a JME emitter. The JME emitter wasn’t really made for use in the GUI viewport (search the forum for related posts), so this is being changed.

Cursor Effects now use the 2D framework emitter and is completely customizable for:

Default Effect
Left-click Effect
Wheel-click Effect
Right-click Effect

You can also just choose from a few default configurations:

Sparks
Flames
Ooze

EDIT: Also note, blending issues with the old cursor effects no longer exist with this update. Prior to this, the particle blend was against the OSRViewPort background color (whether or not this was set)… just due to how offscreen rendering and semi-transparent objects works.

Anyways… it should be in tonight’s update, if you are interested in making use of it.

EDIT: And in case you don’t know what cursor effects do:

It makes little sparklies that trail behind the cursor as you move it around.

To enable this, just call:

[java]
screen.setUseCursorEffects(true);
[/java]

set it back to false to disable/remove it.

Eh… guess an explanation of how to set up custom cursor effects is warranted.

[java]
ElementEmitter ce = screen.getCursorEffects().getEmitter();

// make changes to the emitter

screen.getCursorEffects().storeSettings(EmitterConfig.DEFAULT);

// make changes to emitter

screen.getCursorEffects().storeSettings(EmitterConfig.LEFT_CLICK);

// etc, etc
[/java]

if you want to reset this to one of the provided themes:

[java]
screen.getCursorEffects().setTheme(EmitterTheme.SPARKS);
[/java]

By default, it uses the SPARKS theme.

Where is this functionality located I just updated to the latest build. Couldn’t find the screen.getCursorEffects() method.

@squizzle said: Where is this functionality located I just updated to the latest build. Couldn't find the screen.getCursorEffects() method.

Let me check to see if this made it into the latest release… one sec.

Oh! This will be in tonight’s update. I failed to push this out as I thought I had.

To see a preview of it, just call:

[java]
screen.setUseCursorEffects(true);
[/java]

Tomrrow, you’ll have the get call :wink:

@t0neg0d said: Cursor Effects is getting a major overhaul. Here is the back story, for anyone interested in why this is being changed.

When cursor effects were added, the 2D framework did not exist, so it was implemented in a semi-hack way, using the OSRViewPort (Off screen renderer control) and a JME emitter. The JME emitter wasn’t really made for use in the GUI viewport (search the forum for related posts), so this is being changed.

Cursor Effects now use the 2D framework emitter and is completely customizable for:

Default Effect
Left-click Effect
Wheel-click Effect
Right-click Effect

You can also just choose from a few default configurations:

Sparks
Flames
Ooze

EDIT: Also note, blending issues with the old cursor effects no longer exist with this update. Prior to this, the particle blend was against the OSRViewPort background color (whether or not this was set)… just due to how offscreen rendering and semi-transparent objects works.

Anyways… it should be in tonight’s update, if you are interested in making use of it.

EDIT: And in case you don’t know what cursor effects do:

It makes little sparklies that trail behind the cursor as you move it around.

To enable this, just call:

[java]
screen.setUseCursorEffects(true);
[/java]

set it back to false to disable/remove it.

hi =),
i tryed using

    screen.setUseCursorEffects(true);

and got 2 different errors

[java] Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.NoSuchMethodError: com.jme3.math.Vector2f.interpolate(Lcom/jme3/math/Vector2f;Lcom/jme3/math/Vector2f;F)Lcom/jme3/math/Vector2f;
at tonegod.gui.controls.extras.emitter.DirectionInfluencer.initialize(DirectionInfluencer.java:35)
at tonegod.gui.controls.extras.emitter.ElementEmitter$ElementParticle.initialize(ElementEmitter.java:784)
at tonegod.gui.controls.extras.emitter.ElementEmitter.setMaxParticles(ElementEmitter.java:271)
at tonegod.gui.effects.cursor.CursorEffects.<init>(CursorEffects.java:55)
at tonegod.gui.core.Screen.setUseCursorEffects(Screen.java:1691)[/java]

and which was fixable with adding an image to this path…
[java]Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
com.jme3.asset.AssetNotFoundException: Textures/bullet_02.png (Flipped) (Mipmapped)[/java]

did i do something wrong, or what could be the problem ?

@b00n
If you are using nightly, there are quite a few things that won’t work. interpolate is being renamed to interpolateLocal. But, seeing as this isn’t in the current release, I’m holding off on the update until it IS released.

You have 2 choices for now, grab the sources and replace interpolate… then merge changes that I commit, etc. Or don’t use nightly.

I wish I was able to keep up with both, but I just don’t have the resources to do this and continue to improve the library.

I’ll update the path on the other… sorry about that =)

1 Like

@b00n
Ok, I fixed the texture path, forgot some of the test files I use for working on the library point at custom themes. Apparently, I was using one of those while working on this :wink:

The fix is committed and the plugin has been updated as well.

1 Like
@t0neg0d said: @b00n If you are using nightly, there are quite a few things that won't work. interpolate is being renamed to interpolateLocal. But, seeing as this isn't in the current release, I'm holding off on the update until it IS released.

You have 2 choices for now, grab the sources and replace interpolate… then merge changes that I commit, etc. Or don’t use nightly.

I wish I was able to keep up with both, but I just don’t have the resources to do this and continue to improve the library.

I’ll update the path on the other… sorry about that =)

thank you for your fast response. Ok, now i know the problem :wink:

1 Like
@b00n said: thank you for your fast response. Ok, now i know the problem ;)

It looks like I missed the update for plugins. It should be there tonight if it didn’t make it.