Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add game template #629

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion jme3-templates/src/com/jme3/gde/templates/Bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ OpenIDE-Module-Long-Description=\
OpenIDE-Module-Name=Project Templates
OpenIDE-Module-Short-Description=Provides Project Templates
Templates/Project/JME3/BasicGameProject.zip=Basic Game (with Ant)
Templates/Project/JME3/GradleDesktopGameProject.zip=Basic Game (with Gradle)
Templates/Project/JME3/GradleDesktopGameProject.zip=Basic Game (with Gradle)
Templates/Project/JME3/Examples/RollingTheMonkeyProject.zip=Rolling The Monkey
Templates/Project/JME3/Examples/MonkeyZone=Monkey Zone
Templates/Project/JME3/Examples/JaimesAscent=Jaimes Ascent
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public enum AdditionalLibrary implements TemplateLibrary {
HEART("Heart Library", NbBundle.getMessage(AdditionalLibrary.class,
"additionalLibrary.heart.description"),
"com.github.stephengold", "Heart",
"8.1.0", false),
"9.0.0", false),
PARTICLE_MONKEY("Particle Monkey",
NbBundle.getMessage(AdditionalLibrary.class,
"additionalLibrary.particlemonkey.description"),
Expand All @@ -111,7 +111,11 @@ public enum AdditionalLibrary implements TemplateLibrary {
ZAY_ES_NET("Zay-ES-Net Networking Extension",
NbBundle.getMessage(AdditionalLibrary.class,
"additionalLibrary.zayesnet.description"),
"com.simsilica", "zay-es-net", "1.5.0", false);
"com.simsilica", "zay-es-net", "1.5.0", false),
WES("Wes Library", NbBundle.getMessage(AdditionalLibrary.class,
"additionalLibrary.wes.description"),
"com.github.stephengold", "Wes",
"0.8.1", false),;

/**
* The name of the library. This will be displayed in the jComboBox in the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ additionalLibrary.jme3-vr.description=Core jMonkeyEngine library providing Virtu
additionalLibrary.heart.description=The Heart Library provides an assortment of useful classes and assets to augment jMonkeyEngine.
additionalLibrary.particlemonkey.description=Particle Monkey is a more modern particle system with better artistic controls.
additionalLibrary.shaderblowex.description=Extended filters library for JMonkey Game Engine.
additionalLibrary.sio2.description=A base library of useful utility code for JME-based games. \
additionalLibrary.sio2.description=A base library of useful utility code for JME-based games.
additionalLibrary.wes.description=An animation editing and retargeting library for jMonkeyEngine. \
Includes game system management infrastructure, useful base app states, an event bus, and useful Zay-ES utilities. \
This is a useful base library for any JME game.
additionalLibrary.zayes.description=Zay-ES (pronounced like Doctor Zaius from Planet of the Apes) is a high-performance \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public enum NetworkingLibrary implements TemplateLibrary {
SIMETHEREAL("SimEthereal", NbBundle.getMessage(NetworkingLibrary.class,
"networkinglibrary.simethereal.description"),
"com.simsilica", "sim-ethereal",
"1.7.0", false);
"1.8.0", false);

/**
* The name of the library. This will be displayed in the jComboBox in the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public enum PhysicsLibrary implements TemplateLibrary {
MINIE("Minie", NbBundle.getMessage(PhysicsLibrary.class,
"physicslibrary.minie.description"),
"com.github.stephengold", "Minie",
"5.0.0", false);
"8.2.0", false);

/**
* The name of the library. This will be displayed in the jComboBox in the
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
LBL_DownloadProjectStep=Download project
LBL_CreateProjectStep=Name and Location
JaimesAscentPanelVisual.browseButton.text=Br&owse...
JaimesAscentPanelVisual.createdFolderLabel.text=Project &Folder:
JaimesAscentPanelVisual.projectLocationLabel.text=Project &Location:
JaimesAscentDownloadPanelVisual.downloadButton.text=Download project
JaimesAscentDownloadPanelVisual.downloadButton.actionCommand=DOWNLOAD
JaimesAscentPanelVisual.projectNameLabel.text=Project &Name:
JaimesAscentPanelVisual.browseButton.text=Browse
JaimesAscentPanelVisual.browseButton.actionCommand=BROWSE
JaimesAscentDownloadPanelVisual.jTextArea1.text=Pressing the button below will download the project from Github, to a temporary location from which it will be installed in the next step\n
JaimesAscentDownloadPanelVisual.statusField.text=
JaimesAscentDownloadPanelVisual.downloading=Downloading... Please wait
JaimesAscentDownloadPanelVisual.downloadSuccess=Download complete. Press 'next' to proceed.
JaimesAscentDownloadPanelVisual.downloadFailed=Download failed.
JaimesAscentDownloadPanelVisual.jLabel1.text=
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Jaimes Ascent</title>
</head>
<body>
A sample application demonstrating a chase cam with mouse look,<br>
physics, moving objects and animations.

Easily extendable classes and architecture using AppStates and Controls.<br>
Suitable for beginners.<br>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
/*
* Copyright (c) 2024 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.jme3.gde.templates.jaimesascent;

import java.awt.Component;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.HashSet;
import java.util.Set;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import org.openide.WizardDescriptor;
import org.openide.WizardValidationException;
import org.openide.util.HelpCtx;
import org.openide.util.NbBundle;

/**
* Panel just asking for basic info.
*/
@SuppressWarnings({"unchecked", "rawtypes"})
public class JaimesAscentDownloadPanel implements WizardDescriptor.Panel,
WizardDescriptor.ValidatingPanel, WizardDescriptor.FinishablePanel {

private WizardDescriptor wizardDescriptor;
private JaimesAscentDownloadPanelVisual component;

static String ZIP_NAME = "JaimesAscent.zip";
static String DOWNLOAD_FOLDER = System.getProperty("java.io.tmpdir");

public JaimesAscentDownloadPanel() {
}

public int doDownloadZip() {
return downloadFile("https://github.com/neph1/JaimesAscent/archive/refs/tags/v1.1.1.zip", DOWNLOAD_FOLDER, ZIP_NAME);
}

private int downloadFile(String fileURL, String saveDir, String fileName) {
HttpURLConnection httpConn = null;
BufferedInputStream inputStream = null;
FileOutputStream fileOutputStream = null;

final File outputFile = new File(saveDir, fileName);

if (outputFile.exists()) {
return 1;
}

try {
// Create URL object
URL url = new URL(fileURL);
httpConn = (HttpURLConnection) url.openConnection();

// Check HTTP response code
int responseCode = httpConn.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
// Open input stream from the HTTP connection
inputStream = new BufferedInputStream(httpConn.getInputStream());



// Create output stream to save the file
fileOutputStream = new FileOutputStream(outputFile);

byte[] buffer = new byte[4096];
int bytesRead;
while ((bytesRead = inputStream.read(buffer)) != -1) {
fileOutputStream.write(buffer, 0, bytesRead);
}

return 1;
}
} catch (IOException e) {
return 0;
} finally {
// Close resources
try {
if (inputStream != null) inputStream.close();
if (fileOutputStream != null) fileOutputStream.close();
if (httpConn != null) httpConn.disconnect();
} catch (IOException ex) {
return 0;
}
}
return 0;
}

@Override
public Component getComponent() {
if (component == null) {
component = new JaimesAscentDownloadPanelVisual(this);
component.setName(NbBundle.getMessage(JaimesAscentDownloadPanel.class, "LBL_DownloadProjectStep"));
}
return component;
}

@Override
public HelpCtx getHelp() {
return new HelpCtx("sdk.download_project");
}

@Override
public boolean isValid() {
getComponent();
return component.valid(wizardDescriptor);
}

private final Set<ChangeListener> listeners = new HashSet<>(1); // or can use ChangeSupport in NB 6.0

@Override
public final void addChangeListener(ChangeListener l) {
synchronized (listeners) {
listeners.add(l);
}
}

@Override
public final void removeChangeListener(ChangeListener l) {
synchronized (listeners) {
listeners.remove(l);
}
}

protected final void fireChangeEvent() {
Set<ChangeListener> ls;
synchronized (listeners) {
ls = new HashSet<>(listeners);
}
ChangeEvent ev = new ChangeEvent(this);
for (ChangeListener l : ls) {
l.stateChanged(ev);
}
}

@Override
public void readSettings(Object settings) {
wizardDescriptor = (WizardDescriptor) settings;
component.read(wizardDescriptor);
}

@Override
public void storeSettings(Object settings) {
WizardDescriptor d = (WizardDescriptor) settings;
component.store(d);
}

@Override
public boolean isFinishPanel() {
return false;
}

@Override
public void validate() throws WizardValidationException {
getComponent();
component.validate(wizardDescriptor);
}
}
Loading
Loading