-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
This is a full guide to setup a RenJava application and run it. Note, this is a Windows 10/11 guide. The project is compatible with Linux and Mac but the instructions may vary. There is a lot of spoon feeding as I want this guide to help those who have never used Java before.
- Java - Please look at the README.md for the exact java version you need. (Can install this within Intellij)
- IDEA - (Integrated development environment application). I will be using IntelliJ Community for this guide.
- Note: You will have to scroll down for community. I do not recommend installing the Ultimate Edition.
You can clone RenJava using the GitHub desktop application or Git commands. You can also download it as a zip and extract it to your projects folder. Next open the folder with Intellij. You will have to trust the project to use it.
Now you will have to setup the project SDK (software development kit) to the Java version requirement. You can download JDK (java development kit) from Intellij if you do not have it installed already. Select File -> Project Structure -> Project
. Then click on the SDK drop down box and select the proper JDK or Download JDK
. Set the language level to the correct Java version. Now click on the Modules
side menu option. Select the Language level drop down box and set it the correct Java version. At the bottom of the menu click Apply
and exit the menu.
Next in the Maven side panel run mvn install
. This will create a couple of jar files in the target
directory.
RenJava is now installed onto your computer. When you run the install command it will install the project to your local maven repository. C:\Users\You\.m2\repository\me\piitex\renjava
Please ensure this directory exists and replace You
with your computers username.
Next you need to create your own project. Select file -> New -> Project.
Ensure the build system is set to Maven and the language is set to Java. Define the Java jdk to the version RenJava supports. If you do not have a JDK you can download it within Intellij. Configure the advanced settings to properly define the projects group id and artifact. If you are new to maven to keep things simple follow this naming scheme. Group id should be me.you.game
where you is your alias or name. Artifact should be the name of your game, for the following guide my project and artifact will be called HeroAdventure
. Next press create.
When you create the project and open the window intellij should automatically open the pom.xml. If not please open the pom file and paste in the following. Do NOT change anything here.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>me.piitex.renjava.Main</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
After this you will have to add RenJava as a dependency. This step is tricky because my RenJava version will be different from yours. Please check the pom.xml
file in your RenJava project folder and find the version at the top.
Now paste the following into YOUR projects pom.xml. and replace with the version you got above.
<dependencies>
<dependency>
<groupId>me.piitex</groupId>
<artifactId>RenJava</artifactId>
<version>0.0.802-SNAPSHOT</version>
</dependency>
</dependencies>
Next delete the Main
class and make a new class which is the name of your Artifact. In my case I will make HeroAdventure. If you are new to Intellij simply right click on the last package/folder to open up the context menu.
Press enter
key to create the class. Now we have to make our class extends
the RenJava
class.
import me.piitex.renjava.RenJava;
public class HeroAdventure extends RenJava {
}
Note: Your class will highlight red with errors. Press ALT+Enter
to open a context menu. You can also hover over the highlighted part to view the keybinds.
Next select Implement methods
. You can select this by clicking on the option or pressing enter
. On the next screen make sure everything is selected and select ok
or press enter
again.
Now you should have the following.
package me.piitex.game;
import me.piitex.renjava.RenJava;
import me.piitex.renjava.gui.Menu;
public class HeroAdventure extends RenJava {
@Override
public void preEnabled() {
}
@Override
public void createBaseData() {
}
@Override
public Menu buildSplashScreen() {
return null;
}
@Override
public Menu buildTitleScreen() {
return null;
}
@Override
public void createStory() {
}
@Override
public void start() {
}
}
Now for the last step. For our class we need to annotate it with Game
and Configuration
. This tells the framework information and general configuration for the application.
package me.piitex.game;
import me.piitex.renjava.Game;
import me.piitex.renjava.RenJava;
import me.piitex.renjava.configuration.Configuration;
import me.piitex.renjava.gui.Menu;
@Game(name = "Hero Adventure", author = "piitex", version = "1.0.0")
@Configuration(title = "{name} {version}", width = 1920, height = 1080)
public class HeroAdventure extends RenJava {
@Override
public void preEnabled() {
}
@Override
public void createBaseData() {
}
@Override
public Menu buildSplashScreen() {
return null;
}
@Override
public Menu buildTitleScreen() {
return null;
}
@Override
public void createStory() {
}
@Override
public void start() {
}
}
The game annotation is used to gather details about the game. This information is used for loggers and information in the about
menu.
- Title - The title is the title for the window. You can use the following placeholders
- {name} - Is the name provided in the
Game
annotation. - {version} - Is the version provided in the
Game
annotation. - {author} - Is the author provided in the
Game
annotation.
- {name} - Is the name provided in the
- width - This is NOT the window width. This is the base resolution for the game. If you don't know what that is set it to 1920.
- height- This is NOT the window height. This is the base resolution for the game. If you don't know what that is set it to 1080.
- windowIconPath - You can leave this as default or change it. Only change it if you have a window icon file.
Now you are done setting up the project. The wiki is still under construction, the next steps will be linked at a later date.