I have a JavaFX card game currently running for single player. I want to enable multiple players playing over TCP socket connections, for which I have a simple client/server skeleton program written in java.
My problem is: the server/client code is in java. How do I launch the javafx app from the client java code, and then update it based on the gamestate returned from the server?
Simple server-client loop will be: client sends action, server updates gamestate, and echoes it back out to client.
client pseudo-code if(!clientGUI.isInitialised()) initJavaFXapp(); // I am struggling to do this //keep reading from server if(obj instanceOf gameState) javaFXGUI.update(obj)
I am beginner to using javaFX, and I utilised the graphics aspect as my app is based on it.
Any help would be much appreciated.
MyApplication class extends
javafx.application.Application you can launch it next way: