
libGDX Penguin3D
http://fivedots.coe.psu.ac.th/~ad/libgdx/

Andrew Davison, Feb. 2023
ad@fivedots.coe.psu.ac.th


Download gdx-setup.jar from 
https://libgdx.com/wiki/start/project-generation

When you run it, create code for the 'Desktop' *and* 'HTML' platforms.
In what follows, I'll assume that the Project Name and Game Class
were changed to 'Penguin3D', the Output Folder was set to
'penguin3D', and the package name left unchanged as 'com.mygdx.game'.

In this zip file there are 3 folders:

  code/   
  assets/  
  launchers/

-----------------------------
In code/:

* Penguin3D.java
* Sprite3D.java

Copy all of these to penguin3D\core\src\com\mygdx\game
overwriting the Penguin3D.java file that's there already.

-----------------------------
In assets/:

* checkerboard.png
* crate.jpg
* penguin/
* sky-sphere.jpg
* thump.wav
* uiskin/

Copy all of these to penguin3D\assets
The badlogic.jpg file that's there already can be deleted.

-----------------------------
In launchers/:

* DesktopLauncher.java
* HtmlLauncher.java

Use these files to overwrite the existing files: 
  penguin3D\desktop\src\com\mygdx\game\DesktopLauncher.java
and
  penguin3D\html\src\com\mygdx\game\client\HtmlLauncher.java


------------------------------------
Compilation, Execution, Installation

Open a command line prompt in penguin3D/, where
you will find a Windows batch script (gradlew.bat)
and a Bash script (gradlew).

There are three commands you need:

gradlew desktop:run

gradlew html:superdev

gradlew html:dist


Stage 1
-------
Use "gradlew desktop:run" to generate and run the desktop version. 
Compilation is quick, and you should use this version 
during program development.

Stage 2
-------
Use "gradlew html:superdev" to generate the HTML version which is
run via a local jetty-based HTML server. Access the page by typing:

http://localhost:8080

into your browser. On my test machine, html:superdev takes about
25 seconds to complete.

Stage 3
-------
Use "gradlew html:dist" to generate the distribution code for uploading
to a real web server. On my test machine, this command takes about
40 seconds to finish, not including the time to move the files over to 
the server.

The code is generated in the folder penguin3D\html\build\dist\

Copy everything over to your website:  
 * WEB-INF/
 * index.html
 * assets/
 * html/
 * styles.css

In my case, I copied the files to a new folder called
penguin3D/. I also embedded a call to its index.html
in an iframe in: 
http://fivedots.coe.psu.ac.th/~ad/libgdx/index.html

The iframe code is:

<p align="center">
<iframe src="http://fivedots.coe.psu.ac.th/~ad/libgdx/penguin3D/index.html" 
        width="800px" height="600px">
</iframe>
<p>

