Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (536)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Applet with lwjgl & slick  (Read 1079 times)
0 Members and 1 Guest are viewing this topic.
Offline Dregron
« Posted 2012-08-09 15:49:47 »

Hey am trying to learn how applets work with lwjgl & slick, but i can't seem to get it working... Here are the steps i take -

  • Export Game as "JAR file"
  • get - slick.jar, lwjgl.jar, natives-win.jar & lwjgl_util_applet.jar... i put it on my desk top
  • then i create a html file (notepad) the put the code it it.

this is the code i have in my html file -

<html>
<head>
<title>Applet Test</title>
</head>
<body bgcolor = "#222222">
<br><p>
<br><p>
<center>
<applet code="org.lwjgl.util.applet.AppletLoader"
        archive="lwjgl_util_applet.jar"
        codebase="."
        width="800" height="600">
 
  <param name="al_title" value="myslickgame">
  <param name="al_main" value="org.newdawn.slick.AppletGameContainer">
  <param name="game" value="Display">
 
  <param name="al_jars" value="Animation.jar, lwjgl.jar, slick.jar">
 
  <param name="al_windows" value="natives-win.jar">
</applet>
</center>
</body>
</html>


my game code -

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
import org.newdawn.slick.AppGameContainer;
import org.newdawn.slick.BasicGame;
import org.newdawn.slick.Color;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;

public class Display extends BasicGame {
   public static void main(String[] args){
      try{
      AppGameContainer app = new AppGameContainer(new Display());
      app.setDisplayMode(800, 600, false);
      app.start();
      }catch (SlickException e){ e.printStackTrace(); }
   }

   public Display() {
      super("Applet Game");
   }

   @Override
   public void render(GameContainer gc, Graphics g) throws SlickException {
      g.setColor(Color.white);
      g.fillOval(150, 150, 50, 50, 5);
   }

   @Override
   public void init(GameContainer gc) throws SlickException {
      // TODO Auto-generated method stub

   }

   @Override
   public void update(GameContainer gc, int delta) throws SlickException {
      // TODO Auto-generated method stub

   }

}


Error 'extracting downloaded packages'
Am not using any images in my code just appGameContainer using the Graphics to create an filloval

Cheers for taking a look Smiley

The trouble with programmers is that you can never tell what a programmer is doing until it’s too late.
Offline kappa
« League of Dukes »

JGO Kernel


Medals: 74
Projects: 15


★★★★★


« Reply #1 - Posted 2012-08-09 16:53:40 »

Post the output from the Java Console as the exception on there should explain why its failing on extracting the downloaded packages. If you haven't already, you'll have to enable to the Java Console from the Java Control Panel for it to show up when you run the applet in the browser.
Offline Dregron
« Reply #2 - Posted 2012-08-09 17:53:51 »

This occurred while 'Extracting downloaded packages'
error in opening zip file
java.util.zip.ZipException: error in opening zip file
   at java.util.zip.ZipFile.open(Native Method)
   at java.util.zip.ZipFile.<init>(Unknown Source)
   at java.util.zip.ZipFile.<init>(Unknown Source)
   at java.util.jar.JarFile.<init>(Unknown Source)
   at java.util.jar.JarFile.<init>(Unknown Source)
   at org.lwjgl.util.applet.AppletLoader.extractNatives(AppletLoader.java:1789)
   at org.lwjgl.util.applet.AppletLoader.run(AppletLoader.java:877)
   at java.lang.Thread.run(Unknown Source)


The trouble with programmers is that you can never tell what a programmer is doing until it’s too late.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline kappa
« League of Dukes »

JGO Kernel


Medals: 74
Projects: 15


★★★★★


« Reply #3 - Posted 2012-08-09 18:05:52 »

Which version of LWJGL are you using? If not already using, please try with the latest LWJGL 2.8.4 release (especially the latest lwjgl_util_applet.jar).
Offline Dregron
« Reply #4 - Posted 2012-08-09 18:17:03 »

am using the lastest version of lwjgl, just double checked there by download them... still the same error Sad

The trouble with programmers is that you can never tell what a programmer is doing until it’s too late.
Offline kappa
« League of Dukes »

JGO Kernel


Medals: 74
Projects: 15


★★★★★


« Reply #5 - Posted 2012-08-09 20:51:10 »

have you got the applet uploaded somewhere that you can share? (do please also include linux natives).
Offline Dregron
« Reply #6 - Posted 2012-08-09 22:37:45 »

I got it working, i think it was because i never took lwjgl.jar & lwjgl_util_applet.jar out of the applet version Tongue... finally got it working only took 2 days  Roll Eyes

Thanks for your help really appreciate it Smiley

The trouble with programmers is that you can never tell what a programmer is doing until it’s too late.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Riven (18 views)
2014-07-29 18:09:19

Riven (13 views)
2014-07-29 18:08:52

Dwinin (12 views)
2014-07-29 10:59:34

E.R. Fleming (31 views)
2014-07-29 03:07:13

E.R. Fleming (12 views)
2014-07-29 03:06:25

pw (42 views)
2014-07-24 01:59:36

Riven (41 views)
2014-07-23 21:16:32

Riven (28 views)
2014-07-23 21:07:15

Riven (29 views)
2014-07-23 20:56:16

ctomni231 (60 views)
2014-07-18 06:55:21
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!