More slow progress toward a test application that does chat to a Crowd

server. It looks like I'm going to have to write my own user interface
toolkit for JME as nothing exists for any Java-based GL library or engine
and precious few toolkits exist in C++. Yay!


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3519 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2005-04-21 04:40:12 +00:00
parent fc9603fc86
commit 84d7d7a611
10 changed files with 542 additions and 46 deletions
@@ -21,6 +21,8 @@
package com.threerings.jme.client;
import com.jme.util.LoggingSystem;
import com.threerings.util.Name;
import com.threerings.presents.client.Client;
@@ -80,6 +82,8 @@ public class JabberApp extends JmeApp
public static void main (String[] args)
{
LoggingSystem.getLogger().setLevel(java.util.logging.Level.OFF);
String server = "localhost";
if (args.length > 0) {
server = args[0];
@@ -21,6 +21,12 @@
package com.threerings.jme.client;
import com.jme.input.InputHandler;
import com.jme.renderer.Renderer;
import com.jme.scene.Node;
import com.jme.ui.UIColorScheme;
import com.jme.ui.UIFonts;
import com.samskivert.util.Config;
import com.threerings.util.MessageManager;
@@ -34,6 +40,8 @@ import com.threerings.crowd.client.OccupantDirector;
import com.threerings.crowd.client.PlaceView;
import com.threerings.crowd.util.CrowdContext;
import com.threerings.jme.JmeContext;
/**
* The Jabber client takes care of instantiating all of the proper
* managers and loading up all of the necessary configuration and getting
@@ -49,6 +57,8 @@ public class JabberClient
*/
public void init (JabberApp app)
{
_app = app;
// create our context
_ctx = createContextImpl();
@@ -125,7 +135,7 @@ public class JabberClient
* The context implementation. This provides access to all of the
* objects and services that are needed by the operating client.
*/
protected class JabberContextImpl implements CrowdContext
protected class JabberContextImpl implements CrowdContext, JmeContext
{
/**
* Apparently the default constructor has default access, rather
@@ -133,52 +143,68 @@ public class JabberClient
* protected. Why, I don't know, but we need to be able to extend
* this class elsewhere, so we need this.
*/
protected JabberContextImpl ()
{
protected JabberContextImpl () {
}
public Client getClient ()
{
public Client getClient () {
return _client;
}
public DObjectManager getDObjectManager ()
{
public DObjectManager getDObjectManager () {
return _client.getDObjectManager();
}
public Config getConfig ()
{
public Config getConfig () {
return _config;
}
public LocationDirector getLocationDirector ()
{
public LocationDirector getLocationDirector () {
return _locdir;
}
public OccupantDirector getOccupantDirector ()
{
public OccupantDirector getOccupantDirector () {
return _occdir;
}
public ChatDirector getChatDirector ()
{
public ChatDirector getChatDirector () {
return _chatdir;
}
public void setPlaceView (PlaceView view)
{
public void setPlaceView (PlaceView view) {
// TBD
}
public void clearPlaceView (PlaceView view)
{
public void clearPlaceView (PlaceView view) {
// we'll just let the next place view replace our old one
}
public Renderer getRenderer () {
return _app.getContext().getRenderer();
}
public Node getRoot () {
return _app.getContext().getRoot();
}
public InputHandler getInputHandler () {
return _app.getContext().getInputHandler();
}
public InputHandler getBufferedInputHandler () {
return _app.getContext().getBufferedInputHandler();
}
public UIColorScheme getColorScheme () {
return _app.getContext().getColorScheme();
}
public UIFonts getFonts () {
return _app.getContext().getFonts();
}
}
protected CrowdContext _ctx;
protected JabberApp _app;
protected Config _config = new Config("jabber");
protected Client _client;
@@ -14,6 +14,6 @@ public class JabberController extends PlaceController
{
protected PlaceView createPlaceView (CrowdContext ctx)
{
return null;
return new JabberView(ctx);
}
}
@@ -0,0 +1,42 @@
//
// $Id$
package com.threerings.jme.client;
import com.threerings.crowd.client.PlaceView;
import com.threerings.crowd.data.PlaceObject;
import com.threerings.crowd.util.CrowdContext;
import com.threerings.jme.JmeContext;
import com.threerings.jme.chat.ChatView;
/**
* Manages the "view" when we're in the chat room.
*/
public class JabberView
implements PlaceView
{
public JabberView (CrowdContext ctx)
{
_ctx = ctx;
_jctx = (JmeContext)ctx;
_chat = new ChatView(_jctx, _ctx.getChatDirector());
_jctx.getRoot().attachChild(_chat);
}
// documentation inherited from interface PlaceView
public void willEnterPlace (PlaceObject plobj)
{
_chat.willEnterPlace(plobj);
}
// documentation inherited from interface PlaceView
public void didLeavePlace (PlaceObject plobj)
{
_chat.didLeavePlace(plobj);
}
protected CrowdContext _ctx;
protected JmeContext _jctx;
protected ChatView _chat;
}