Porting an Android Game Framework for Java Desktop usage

UPDATE: It is complete. It is a very basic framework for 2d games that don’t use OpenGL or so.

Here is a video where I show you how to start both versions, the android and the desktop one.

There is a snake Game implemented to show you the differences needed in the version,
as well as have something to test :stuck_out_tongue:

Please give me some feedback

hello everyone,
I am totally new to this forum, but already messing around with Android and Java for a good year now.

I started my journey with the Book “Beginning Android 4 Games Development” by Mario Zechner. Coded some stuff, tried out even more and now finally got to a point where I want to implement the Interfaces of that Framework for Java Desktop usage- meaning:

when I code a new Game using the Methods of that Frameworks’ interfaces, i want to be able to copy those classes
to an other version of the same Framework, where the only difference is that those Interfaces are implemented by Java Standart api methods, so i can have a Jframe Desktop Version of my game.

This repository holds both modules, take a look into the readme to see how it works.
For those only developing for Java, use the javalib directory as the running module. The app directory is the Android Module.

I am currently struggling on implementing the Input Interface, since there are 3 Classes sticking to it:
TouchHandler ( interface)
KeyboardHandler(class)
singleTouchHandler(class)
multiTouchHandler(class)

the input interface declares 2 classes, the key event class and the touch event class.

I think of using the touch event class as return type for mouse clicks in java.
My problem is of finding out a method like Mario Zachner did with the pool class which stores the events triggered and gives them back in a list upon request ( input interface -> getTouchEvents) this list I want to fill - for the java version - with touch events (of the input interface declaration) which correspond to triggered mouse events, meaning :

  • I’d need to have a mouselistener and analyze the triggered mouse events
  • Generate TouchEvents corresponding to the mouse events’ analyzation
  • store them in a list
  • return them in the interface method.

is my approach correct?
I thank everybody already who is willing to take a look at it :wink: