Author Topic: Converting Hello World to Applet  (Read 3237 times)

Offline fireside

  • double
  • *****
  • Posts: 605
    • View Profile
Converting Hello World to Applet
« on: July 25, 2008, 07:36:11 am »
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<-

Offline Melssj5

  • double
  • *****
  • Posts: 715
    • View Profile
Re: Converting Hello World to Applet
« Reply #1 on: July 25, 2008, 04:05:41 pm »
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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Converting Hello World to Applet
« Reply #2 on: July 25, 2008, 05:28:00 pm »
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.

Offline fireside

  • double
  • *****
  • Posts: 605
    • View Profile
Re: Converting Hello World to Applet
« Reply #3 on: July 25, 2008, 06:10:12 pm »
I don't suppose anyone has a small example of a software applet they could let me see. 
click here->Fireside 7 Games<-

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Converting Hello World to Applet
« Reply #4 on: July 25, 2008, 08:53:09 pm »
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

Offline fireside

  • double
  • *****
  • Posts: 605
    • View Profile
Re: Converting Hello World to Applet
« Reply #5 on: July 25, 2008, 11:03:53 pm »
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<-

Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: Converting Hello World to Applet
« Reply #6 on: July 26, 2008, 05:51:25 pm »
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.

Offline fireside

  • double
  • *****
  • Posts: 605
    • View Profile
Re: Converting Hello World to Applet
« Reply #7 on: July 27, 2008, 01:04:13 pm »
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<-

Offline raft

  • quad
  • ******
  • Posts: 1974
    • View Profile
    • http://www.aptalkarga.com
Re: Converting Hello World to Applet
« Reply #8 on: July 27, 2008, 10:45:00 pm »
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