Converting Hello World to Applet

Started by fireside, July 25, 2008, 07:36:11 AM

Previous topic - Next topic

fireside

I finally got a little applet running on my free website.  The next thing I'd like to do is convert the helloworld jpct software example to an applet.  Would I just drop the main function and use the init for that?
click here->Fireside 7 Games<-

Melssj5

No, some things have to be changed, for example the arguments of the methods to load the 3d model and the textures. You have to use the docbase to load things in jopct from an applet. If you want to render in opengl from an applet, the the client machine needs to have the dll from lwjgl.
Nada por ahora

EgonOlsen

And you have to spawn an extra thread that executes the game loop. Just any other applet that does active rendering does. Prsonally, i would just let the init-method spawn the thread and do the setup work plus the game loop in the thread.

fireside

I don't suppose anyone has a small example of a software applet they could let me see. 
click here->Fireside 7 Games<-

EgonOlsen

In the download directory (http://www.jpct.net/download), there's still an year old version (0.96) which was the last one, that came with an applet example. It does a lot of things terribly wrong (like the timing and such), but it may work as a starting point. Just don't take everything too serious that you see in the code. If it looks strange, it's most likely wrong...like doing the game logic in another thread... :P

fireside

O.K.  Thanks.  I found a java game applet tutorial so between the two maybe I can figure it out.
click here->Fireside 7 Games<-

paulscode

I wrote some threads a while back when I first started out using applets.  You might find them helpful:

A really basic one:
http://www.jpct.net/forum2/index.php/topic,1031.msg6376.html#msg6376

And this thread goes a little more in depth:
http://www.jpct.net/forum2/index.php/topic,1032.msg6431.html#msg6431

If you need any more explanations about the above threads and code, or help with using the appletloader (for hardware-rendering mode), let me know.

fireside

Thanks.  I didn't know you put up any software rendering code.  I'm getting closer.  Part of it is figuring out how Netbeans works and the tags and what not.  I have it reading a file now, but not displaying.  I'm getting closer, anyway. 
click here->Fireside 7 Games<-

raft

as posted in some other thread, here is another running applet sample. the main difference is i do the rendering in awt thread which makes using swing/awt components much easier IMHO.

http://www.aptalkarga.com/download/SwApplet.java