From cb4394e6b4c4deab338280ffcfd660770fe0e0b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Delorme?= Date: Wed, 15 Nov 2017 18:05:30 +0100 Subject: [PATCH 1/2] fix some issues on the internal JFrame and README not updated. --- README.md | 239 ++++++++---------- .../com/snapgames/gdj/core/ui/Window.java | 13 +- 2 files changed, 118 insertions(+), 134 deletions(-) diff --git a/README.md b/README.md index 861b6bd..1a9eb0c 100644 --- a/README.md +++ b/README.md @@ -1,131 +1,108 @@ -# GDJ107 - -[![TravisCI](https://travis-ci.org/SnapGames/GDJ107.svg?branch=develop)](https://travis-ci.org/SnapGames/GDJ107 "open the TravisCI compilation trend") [![Dependency Status](https://www.versioneye.com/user/projects/59dd5fd72de28c2198ef86e9/badge.svg?style=flat-square)](https://www.versioneye.com/user/projects/59dd5fd72de28c2198ef86e9 "Open on VersionEye") - -## Game Development Java Basics 107 - -This project is part of the [GDJ107](https://classroom.google.com/c/NzI2ODQ3NjU2MFpa/t/NzI2Nzg0MjgxNFpa) course from [GameDev Basics -Java](https://classroom.google.com/c/NzI2ODQ3NjU2MFpa "Open the official on-line course") -provided by the [SnapGames](http://snapgames.fr) site. - -### Goal - -In this step of course, you will bee discover how to manage collision, manage a HUD and USe a camera to track an active GameObject (like the Player). - -The Google docs corresponding to that course can be find at [GDJ107 - Camera, Collision et HUD](https://docs.google.com/document/d/1ek1M8tnFkciXyRcTje5ClGWW5Ku_AkKlXOOhDiMWIqg "open the corresponding Google Doc.") - -## Compile - -To compile the full project, please execute the following command : - -```bash - $> mvn clean install -``` - -## Execute - -to execute the compiled jar, please execute the command bellow : - -```bash - $> mvn exec:java -``` - -or : - -```bash - $> java -jar GDJ107-0.0.1-SNAPSHOT-jar-with-dependencies.jar -``` - -## Windows executable - -To build a windows executable file, you must run : - -```bat - C:\> mvn clean install site -``` - -This will build a `GDJ107.exe` into the `target` directory. - -Then you can directly execute : - -```bat - C:\> target/GDJ107.exe -``` - -If needed, you can also add some arguments from the bellow table: - -| argument | short | sample | default | Description | -|:--------:|:------:|:-----------:|:-------:|:----------------------------------------------| -| --debug | -d | -d \[0-4\] | 0 | Request debug information with the level | -| --height | -h | -h 320 | 320 | Set the width of the window | -| --width | -w | -w 240 | 240 | Set the height of the window | -| --scale | -s | -s 2 | 2 | Set a scale factor for the window | -| --full | -f | -f | off | switch to fullscreen mode | - -Executing the following line bello: - -```bat - C:/> target/GDJ107.exe -d 1 -``` - -will open the next window : - -![The welcome title state](src/main/docs/images/screenshot-title.jpg "The welcome title state") - - -## Edit - -Import this project as an Existing Maven Project into your prefered IDE, -(like [Eclipse](http://www.eclipse.org/downloads "open the eclipse official web download page") ?) - - -## Some screen shots ? - -### Play State - -The `PlayState` is only a capabilities demonstration purpose state. - -![PlayState with minimum debug info](src/main/docs/images/screenshot-002.jpg "PlayState with minimum debug info") ![PlayState without any debug info](src/main/docs/images/screenshot-008.jpg "PlayState without any debug info"); - -Use the following keys: - -- D / F9 switch between DEBUG modes (see previous table) - -- H display a help panel to show keyboard shortcuts :) -- UP / DOWN / LEFT / RIGHT to move the blue square which is the `Player` game object, -- SHIFT / CTRL with cursor key will accelerate move, -- PG-UP / PG-DOWN will increase decrease number of `Enemy` and `Eatable` game objects (to raise-up your energy), -- SHIFT / CTRL with PG-UP and PG-DOWN keys will accelerate increasing. - -### Options - -The options state is a first version of the options, just to manage Sound and music activation. - -![The options state](src/main/docs/images/screenshot-options.jpg "The options state") - -> **Info**
-> More to come soon in ths state to manage inputs, sound and music volume, etc... ! - -## Maven Repo ? - -To publish to the right maven repo, just execute the following lines: - -```bash - $> mvn clean site deploy -``` - -Before execution, be sure that your `settings.xml` contains a `server` entry with your login/password for the github repository. - - - - github - [GITHUB-USERNAME] - [GITHUB-USERPASSWORD] - - - -Have Fun ! - -Send a mail to [SnapGames](mailto:contact@snapgames.fr?subject=GDJ107 "send a mail to your tutor") - - +# GDJ107 + +[![TravisCI](https://travis-ci.org/SnapGames/GDJ107.svg?branch=develop)](https://travis-ci.org/SnapGames/GDJ107 "open the TravisCI compilation trend") [![Dependency Status](https://www.versioneye.com/user/projects/59dd5fd72de28c2198ef86e9/badge.svg?style=flat-square)](https://www.versioneye.com/user/projects/59dd5fd72de28c2198ef86e9 "Open on VersionEye") + +## Game Development Java Basics 107 + +This project is part of the [GDJ107](https://classroom.google.com/c/NzI2ODQ3NjU2MFpa/t/NzI2Nzg0MjgxNFpa) course from [GameDev Basics +Java](https://classroom.google.com/c/NzI2ODQ3NjU2MFpa "Open the official on-line course") +provided by the [SnapGames](http://snapgames.fr) site. + +### Goal + +> TODO + +## Compile + +To compile the full project, please execute the following command : + +```bash + $> mvn clean install +``` + +## Execute + +to execute the compiled jar, please execute the command bellow : + +```bash + $> mvn exec:java +``` + +or : + +```bash + $> java -jar GDJ107-0.0.1-SNAPSHOT-jar-with-dependencies.jar +``` + +## Windows executable + +To build a windows executable file, you must run : + +```bat + C:\> mvn clean install site +``` + +This will build a `GDJ107.exe` into the `target` directory. + +Then you can directly execute : + +```bat + C:\> target/GDJ107.exe +``` + +If needed, you can also add some arguments from the bellow table: + +| argument | short | sample | default | Description | +|:--------:|:------:|:-----------:|:-------:|:----------------------------------------------| +| --debug | -d | -d \[0-4\] | 0 | Request debug information with the level | +| --height | -h | -h 320 | 320 | Set the width of the window | +| --width | -w | -w 240 | 240 | Set the height of the window | +| --scale | -s | -s 2 | 2 | Set a scale factor for the window | +| --full | -f | -f | off | switch to fullscreen mode | + +Executing the following line bello: + +```bat + C:/> target/GDJ107.exe -d 1 +``` + +will open the next window : + +![The welcome title state](src/main/docs/images/screenshot-title.jpg "The welcome title state") + + +## Edit + +Import this project as an Existing Maven Project into your prefered IDE, +(like [Eclipse](http://www.eclipse.org/downloads "open the eclipse official web download page") ?) + + +## Some screen shots ? + +### States + +> TODO + +## Maven Repo ? + +To publish to the right maven repo, just execute the following lines: + +```bash + $> mvn clean site deploy +``` + +Before execution, be sure that your `settings.xml` contains a `server` entry with your login/password for the github repository. + + + + github + [GITHUB-USERNAME] + [GITHUB-USERPASSWORD] + + + +Have Fun ! + +Send a mail to [SnapGames](mailto:contact@snapgames.fr?subject=GDJ107 "send a mail to your tutor") + + diff --git a/src/main/java/com/snapgames/gdj/core/ui/Window.java b/src/main/java/com/snapgames/gdj/core/ui/Window.java index 909188c..da5c334 100644 --- a/src/main/java/com/snapgames/gdj/core/ui/Window.java +++ b/src/main/java/com/snapgames/gdj/core/ui/Window.java @@ -22,11 +22,12 @@ * @author Frédéric Delorme * */ -public class Window extends JFrame{ +public class Window extends JFrame { + /** - * the internal JFrame containing the {@link Game} object. + * */ - JFrame frame = null; + private static final long serialVersionUID = 3295181469904415221L; /** * The default unique constructor to initialize a {@link Window} on the @@ -37,6 +38,7 @@ public class Window extends JFrame{ */ public Window(Game game) { super(game.getTitle()); + // set game size. game.setDimension(Game.WIDTH, Game.HEIGHT, Game.SCALE); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); @@ -46,6 +48,11 @@ public Window(Game game) { setPreferredSize(game.getDimension()); setMaximumSize(game.getDimension()); setResizable(false); + + // center window on default display monitor. + setLocationRelativeTo(null); + + // set window icon. setIconImage(ResourceManager.getImage("/res/icons/gdj-app.png")); // add the Game InputHandler as a KeyListener From bc44baf24c01b3df9d4afea739c5a8e6fd6f9b26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Delorme?= Date: Wed, 15 Nov 2017 22:21:48 +0100 Subject: [PATCH 2/2] Add some missing JavaDoc comments. --- src/main/java/com/snapgames/gdj/core/ui/Window.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/snapgames/gdj/core/ui/Window.java b/src/main/java/com/snapgames/gdj/core/ui/Window.java index da5c334..250713d 100644 --- a/src/main/java/com/snapgames/gdj/core/ui/Window.java +++ b/src/main/java/com/snapgames/gdj/core/ui/Window.java @@ -3,7 +3,7 @@ * * Game Development Java * - * gdj104 + * gdj107 * * @year 2017 */ @@ -17,7 +17,7 @@ import com.snapgames.gdj.core.ResourceManager; /** - * the {@link Window} class to contains and display all the game. + * The {@link Window} class to contains and display all the game. * * @author Frédéric Delorme * @@ -25,7 +25,7 @@ public class Window extends JFrame { /** - * + * Internal serial version UID. */ private static final long serialVersionUID = 3295181469904415221L;