Thanks. Their forums are down or something, and for now they’re using stackoverflow. No reply yet.
Trying to find how to attach zip.
import java.awt.*;
import java.awt.Component;
import java.awt.event.*;
public class Game
{
Draw draw;
Frame frame;
Insets insets;
boolean isRunning = true;
private int FPS = 30;
private double averageFPS;
public static void main(String[] args)
{
Game game = new Game();
game.run();
System.exit(0);
}
void run()
{
initialize();
long startTime;
long URDTimeMillis;
long waitTime;
long totalTime = 0;
int frameCount = 0;
int maxFrameCount = 30;
long targetTime = 1000 / FPS;
while(isRunning)
{
startTime = System.nanoTime();
update();
draw();
URDTimeMillis = (System.nanoTime() - startTime) / 1000000;
waitTime = targetTime - URDTimeMillis;
try
{
Thread.sleep(waitTime);
}
catch(Exception e)
{
}
totalTime += System.nanoTime() - startTime;
frameCount++;
if(frameCount == maxFrameCount)
{
averageFPS = 1000.0 / ((totalTime / frameCount) / 1000000);
frameCount = 0;
totalTime = 0;
}
}
frame.close();
}
void initialize()
{
draw = new Draw();
frame = new Frame();
frame.add(draw);
}
void update()
{}
void draw()
{
frame.draw();
}
}
import java.awt.*;
import javax.swing.*;
import java.awt.image.BufferedImage;
import javax.swing.JFrame;
import java.awt.Component;
import java.awt.event.*;
public class Frame extends JFrame
{
int windowWidth = 960;
int windowHeight = 480;
Insets insets;
public Frame()
{
setTitle("Game");
setSize(windowWidth, windowHeight);
setResizable(false);
setDefaultCloseOperation(EXIT_ON_CLOSE);
insets = getInsets();
setSize(insets.left + windowWidth + insets.right, insets.top + windowHeight + insets.bottom);
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
setLocation(dim.width/2-this.getSize().width/2, dim.height/2-this.getSize().height/2);
setVisible(true);
}
public void close()
{
setVisible(false);
}
}
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.awt.image.BufferedImage;
public class Draw extends JPanel
{
public Draw()
{
}
@Override
protected void paintComponent(Graphics g)
{
super.paintComponent(g);
}
public void draw()
{
repaint();
}
}
Just creates a window. After using jwrapper, the program runs but a window doesn’t appear. I am following the instructions for the sample project and last night I was able to get that working, but translating to this is just doesn’t run.
My project is called ‘gametest’. Inside gametest there are two folders ‘JRE-1.7’ from extracting the jre pack. ‘gameapp’, contains game.jar (runs fine), jwrapper.xml, the sample logo/splash, two more folders, src and bin, bin class files, src source files.
XML:
<JWrapper>
<!-- The name of the app bundle -->
<BundleName>GameApp</BundleName>
<!-- The specification for one app within the bundle -->
<App>
<Name>Game</Name>
<LogoPNG>gameapp/logo.png</LogoPNG>
<MainClass>Game</MainClass>
<Param>one</Param>
<Param>two</Param>
</App>
<SupportedLanguages>en</SupportedLanguages>
<!-- App is a per-user app, it won't elevate and install for all users and the shared config folder will be per-user -->
<InstallType>CurrentUser</InstallType>
<!-- Splash and Logo -->
<SplashPNG>gameapp/splash.png</SplashPNG>
<BundleLogoPNG>gameapp/logo.png</BundleLogoPNG>
<!-- JVM options (e.g. extra memory) -->
<JvmOptions>
<JvmOption>-Xmx256m</JvmOption>
</JvmOptions>
<!-- The JREs JWrapper should use for Windows, Linux32, Linux64... -->
<Windows32JRE>JRE-1.7/win32/jre1.7.0_05</Windows32JRE>
<Windows64JRE>JRE-1.7/win32/jre1.7.0_05</Windows64JRE>
<Linux32JRE>JRE-1.7/linux/jre1.7.0_13</Linux32JRE>
<Linux64JRE>JRE-1.7/linuxx64/jre1.7.0_13</Linux64JRE>
<Mac64JRE>JRE-1.7/macos64/jre1.7.0_45.jre</Mac64JRE>
<!-- The files that the app wants to bundle, here we have just one which is a JAR file and we specify that it should be on the launch classpath -->
<File classpath='yes'>gameapp/game.jar</File>
</JWrapper>
Edit: My manifest.txt for the jar file is just “Main-Class: Game”