Problem is, I really don’t underhand how am supposed to connect that to my game xD. Am using eclipse and I have downloaded the project using git. I saw somewhere that I could not create a jar out of it, and that I should use maven, but anyway the project is not considered as a Java project but a simple project keeping me from making a jar whit it
So I installed maven, but when I convert the project into a maven project, it show me a lot of errors everywhere. I guess my eclipse version is not totally up to date, but would it really help or I am doing something wrong?
Plus it doesn’t seem like any real tutorial is out there. Some part here and there, but nothing clear, and as this it kinda the only way to get video in (and do some really cool stuff to x) I was wondering why. I do underhand it’s not finish, but when it will, is it expect to be one for it.
Be sure your java is at 1.8, dowload and install the lates version if not. It can get tricky, i warn you x)
If not already done go check and add javaFx jar from your java librairie. It should be in something like that : C:\Program Files\Java\jre1.8.0_51\lib\ext\jfxrt.jar
If you want to add it in a 2D enviroment use this while having somewhere in your code this line called befaure : new JFXPanel() (take note this code is using toneGod GUI ;
public class MovieLabel extends Label
{
private MovieMaterial movieMaterial;
private MediaPlayer mp;
private MovieLabel link ;
public MovieLabel(
ElementManager screen,
Vector2f position,
Vector2f dimensions,
String videoPath,
boolean looping)
{
super(screen, position, dimensions);
link = this ;
final Media media = new Media(new File(videoPath).toURI().toASCIIString()) ;
media.errorProperty().addListener(new ChangeListener<MediaException>()
{
@Override
public void changed(final ObservableValue<? extends MediaException> observable, final MediaException oldValue, final MediaException newValue)
{newValue.printStackTrace();}
});
mp = new MediaPlayer(media);
if(looping)
{mp.setCycleCount(javafx.scene.media.MediaPlayer.INDEFINITE) ;}
movieMaterial = new MovieMaterial(app, this.mp, false);
movieMaterial.setLetterboxColor(ColorRGBA.Black);
this.setMaterial(movieMaterial.getMaterial());
}
public void playIt()
{
mp.play();
new animateIt() ;
}
private class animateIt extends AbstractControl
{
animateIt()
{link.addControl(this);}
@Override
protected void controlRender(RenderManager arg0, ViewPort arg1)
{}
@Override
protected void controlUpdate(float arg)
{link.movieMaterial.update(arg);}
}
Of fork it and replace zzuegg with your github username.
Somehow the resources folder is not included in the build, so you have to copy the cursors to your project. Did not yet have time to solve that issue.
Well git is install, i have a feelling it have something to do whit my enviroment variables, but it seem like am not doing the right thing. I put it in path, i put it in it own space but nothing work xD
Il restard my computer and see if it help in any ways
If you need video playback only then just grab all files that you need and add them into your project. I did it this way.
As far as I remember you need only Movie.j3md (with shaders), TextureMovie and ImageExchanger. The code is written so well that it is easy to use it even as GUI object.
Edit : My bad, the jar do work, i think am just not using the right class.
So… what next? I saw an exemple by abies
But it don’t seem to work at all :/. I can’t creat the class media and mediaPlayer don’t want to be imported. For the texture il guess its a texture il apply the surface i want to video on?
i am also using eclipse and work whit java 1.7, but i don’t seem to be able to doawload the javaFX jar anywhere.
But i also see everywhere that javaFx need to be install on the computer. Does that mean it will need to be package whit my installer if i want people to be able to use it in game?
I’m afraid but in that classes I mentioned before, there is some code that needs Java 8. That code can be replaced, but probably you’ll need to add those files into your project instead of using precompiled jar.
JavaFX is included into JRE/JDK from 1.7.0 update 45 (or something like that). Check if you have jfxrt.jar somewhere inside your installation.
And it work! Marvellous! All is left is to make sure it take the whole screen no matter the size and then some integration, but i can do that on my own
Thanks again I’ll soon post the results and try to put every anwser at the begening of the topic if anyone was in need to do the same x).
Okay everything is working great in the testing class but as soon as i get it out of there, i get a green screen. Am applying the texture on a Label build in tonegod, and as i said it work when every part of the code are in the same area. The green screen also play the music. Il get back after a few test
Okay found it. It was actully the @Override
public void simpleUpdate(float tpf) {
super.simpleUpdate(tpf);
lab.movieMaterial.update(tpf);
}
But i kinda wonder, won,t that slow in any way my whole program having this command looping all the time? I could probably put it in a AbstractControl to avoid that? o well any way il have to test that later, il come back whit a complet class