Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (522)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (590)
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  
  Migration of demos to the xith-tk project  (Read 763 times)
0 Members and 1 Guest are viewing this topic.
Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Posted 2005-04-05 01:45:41 »

I am working on migrating the Xith3D demos to the xith-tk project and modifying them so they implement a common demo framework.

The demo framework is org.xith3d.test.Xith3DTestCanvas.  This canvas allows either the LWJGL or JOGL renderer to be chosen (from the command line), as well as adjusting the height and width of the frame.

Minor modifications are made to the demos including changing the input system to HIAL (which supports both LWJGL and JOGL) and removing the canvas setup code.

The xith-tk build script creates a sepertate .jar file for the demos (xith-demos.jar) which allows people to easily leave out that .jar when distributing a project.

Once migrated, I will update xith.org so that one can choose either LWJGL or JOGL when launching via JWS.  I will also add RunDemo .bat and shell scripts to the project.

It is also planned to add some of Java Cool Dude's demos to this package.

here's an example of the changes, Xith3DLineAttributeTest:
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  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
-public class Xith3DLineAttributesTest
+public class Xith3DLineAttributesTest extends Xith3DTestCanvas
 {
 
        Transform3D testRotateY = new Transform3D();
-267,65 +263,38 @@
 
        public void init() throws Exception
        {
-               // Prepare full-screen canvas adapted for current resolution
-               Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
-
-               VirtualUniverse universe = new VirtualUniverse();
-               view = new View();
+           this.createCanvas("Xith3D Line Attributes Test");
+          
+               view = getView();
                view.setBackClipDistance(100f);
                view.setProjectionPolicy(View.PERSPECTIVE_PROJECTION);
                view.getTransform().lookAt(
                        new Vector3f(0, 0, 3),
                        new Vector3f(0, 0, 0),
                        new Vector3f(0, 1, 3));
-               Locale locale = new Locale();
-               universe.addLocale(locale);
-               universe.addView(view);
-
-               RenderPeer renderPeer = new RenderPeerImpl();
-               CanvasPeer canvasPeer =
-                       renderPeer.makeCanvas(
-                               null,
-                               screenSize.width - 200,
-                               screenSize.height - 200,
-                               16,
-                               true);
-               canvasPeer.getWindow().setLocation(100, 100);
-               Canvas3D canvas = new Canvas3D();
-               canvas.set3DPeer(canvasPeer);
-               view.addCanvas3D(canvas);
-
-               class KeyboardEventListener implements AWTEventListener
-               {
-                       public void eventDispatched(AWTEvent event)
-                       {
-                               if (event instanceof KeyEvent)
-                               {
-                                       KeyEvent e = (KeyEvent) event;
-                                       if ((e.getID() == KeyEvent.KEY_TYPED) && (e.getKeyChar() == 27))
-                                       {
-                                               System.exit(0);
-                                               e.consume();
-                                       }
-                                       else if ((e.getID() == KeyEvent.KEY_TYPED) && (e.getKeyChar() == 32))
-                                       {
-                                               // Change the projection policy
-                                               if (view.getProjectionPolicy() == View.PERSPECTIVE_PROJECTION)
-                                                       view.setProjectionPolicy(View.PARALLEL_PROJECTION);
-                                               else
-                                                       view.setProjectionPolicy(View.PERSPECTIVE_PROJECTION);
-                                               e.consume();
+
+               getKeyboard().registerListener(new KeyboardListener() {
+
+                       public void keyPressed(int key) {
+                           if (key == KeyCode.VK_ESCAPE) {
+                               System.exit(0);
+                           } else if (key == KeyCode.VK_SPACE) {
+                               // Change the projection policy
+                                       if (view.getProjectionPolicy() == View.PERSPECTIVE_PROJECTION) {
+                                               view.setProjectionPolicy(View.PARALLEL_PROJECTION);
+                                       } else {
+                                               view.setProjectionPolicy(View.PERSPECTIVE_PROJECTION);
                                        }
-                               }
+                           }
                        }
-               }
-
-               Toolkit.getDefaultToolkit().addAWTEventListener(
-                       new KeyboardEventListener(),
-                       AWTEvent.KEY_EVENT_MASK);
 
+            public void keyReleased(int key) {
+                // ignore
+            }
+               });
+
                BranchGroup scene = createSceneGraph();
-               locale.addBranchGraph(scene);
+               getSceneRoot().addChild(scene);
 
                runTest();
        }
-337,6 +306,8 @@
                while (true)
                {
                        view.renderOnce();
+                       getKeyboard().update();
+
                        try
                        {
                                Thread.sleep(10L);


Cheers,

Will.

Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #1 - Posted 2005-04-05 04:42:25 »

I have re-worked two of Java Cool Dude's demos and placed them in the xith-tk using the Xith3DTestCanvas/HIAL abstraction layers.

The demos are:
* Nehe's Cel-Shading Tutorial (both with Shaders and without -- now a command line switch)
*  Texture CubeMap

Neither currently work with LWJGL which indicates a bug in either the Xith3D LWJGL renderer, or LWJGL itself.  This is one reason why I am adding these demo's, further test cases for the two renderers.

Will.


Offline Java Cool Dude

Senior Devvie




Java forever


« Reply #2 - Posted 2005-04-05 11:17:27 »

Quote

It is also planned to add some of Java Cool Dude's demos to this package.
Cheers,

Will.


Sounds good to me Cheesy
Yes, you can go ahead and include my resolution selector in the TK, that could only make me happier Smiley
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #3 - Posted 2005-04-06 03:24:38 »

Hey Java Cool Dude,

Hows it going?

Thanks.  I do plan on adding a resolution selector based on your code into the demo framework once I've finished migrating the remainder of the demos.

Cheers,

Will.

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.

trollwarrior1 (27 views)
2014-11-22 12:13:56

xFryIx (69 views)
2014-11-13 12:34:49

digdugdiggy (48 views)
2014-11-12 21:11:50

digdugdiggy (42 views)
2014-11-12 21:10:15

digdugdiggy (36 views)
2014-11-12 21:09:33

kovacsa (60 views)
2014-11-07 19:57:14

TehJavaDev (64 views)
2014-11-03 22:04:50

BurntPizza (62 views)
2014-11-03 18:54:52

moogie (77 views)
2014-11-03 06:22:04

CopyableCougar4 (77 views)
2014-11-01 23:36:41
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
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!