Finished RSC implementation, worked on 508 image loading to clean it up, added 2 more parameters, randomBackground, and customClientClassName.

This commit is contained in:
Travis Burtrum 2012-01-26 15:03:08 -05:00 committed by moparisthebest
parent c3c68d9eef
commit a5b6500009
4 changed files with 112 additions and 9 deletions

View File

@ -107,21 +107,24 @@ public class client extends Applet_Sub1 implements ClientInterface {
public void setBackground(java.awt.Image image) {
if (image == null)
return;
int w = image.getWidth(null);
int h = image.getHeight(null);
BufferedImage bi = new BufferedImage(956, 503, BufferedImage.TYPE_INT_ARGB);
int onEachSide = (956-766)/2;
System.out.println("in new setbackground!!!!!!!!!!!");
int newWidth = 956;
int newHeight = 503;
int oldWidth = image.getWidth(null);
int oldHeight = image.getHeight(null);
BufferedImage bi = new BufferedImage(newWidth, newHeight, BufferedImage.TYPE_INT_ARGB);
int onEachSide = (newWidth-oldWidth)/2;
bi.getGraphics().drawImage(image,
onEachSide, 0, 956-onEachSide, 503,
0, 0, 766, 503,
onEachSide, 0, newWidth-onEachSide, newHeight,
0, 0, oldWidth, oldHeight,
null);
/* // this kind of stretches the image, but might be needed with HD
bi.getGraphics().drawImage(image,
0, 0, 956, 503,
0, 0, 766, 503,
null);
*/ bgImage = new int[956 * 503];
PixelGrabber pixelgrabber = new PixelGrabber(bi, 0, 0, 956, 503, bgImage, 0, 956);
*/ bgImage = new int[newWidth * newHeight];
PixelGrabber pixelgrabber = new PixelGrabber(bi, 0, 0, newWidth, newHeight, bgImage, 0, newWidth);
try {
pixelgrabber.grabPixels();
} catch (Exception e) {

View File

@ -1 +0,0 @@
../../mpc-client/src

1
clientRSC/src/client Symbolic link
View File

@ -0,0 +1 @@
../../../mpc-client/src/client

View File

@ -0,0 +1,100 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import client.Config;
import org.moparscape.iface.ClientInterface;
import java.awt.image.BufferedImage;
import java.util.HashMap;
import java.util.Map;
/**
* @author mopar
*/
public class mudclient extends client.mudclient implements ClientInterface {
public void setServer(String server) {
Config.SERVER_IP = server;
}
public void setPort(int port) {
Config.SERVER_PORT = port;
}
public void setCacheDir(String cacheDir) {
Config.CONF_DIR = cacheDir;
Config.MEDIA_DIR = cacheDir;
}
public int getPort() {
return Config.SERVER_PORT;
}
public java.awt.Dimension getDimension() {
return new java.awt.Dimension(512, 344);
}
public Map<String, String> getParams() {
HashMap<String, String> ret = new HashMap<String, String>();
// set params
ret.put("getCodeBase", "http://localhost");
ret.put("getDocumentBase", "http://localhost/index.php");
return ret;
}
public void setBackground(java.awt.Image image) {
//image = null;
if (image == null)
return;
int newWidth = 512;
int newHeight = 200;
bgPixels = new int[newWidth][newHeight];
int oldWidth = image.getWidth(null);
int oldHeight = image.getHeight(null);
bgImage = new BufferedImage(newWidth, newHeight, BufferedImage.TYPE_INT_ARGB);
bgImage.getGraphics().drawImage(image,
0, 0, newWidth, newHeight,
0, 0, oldWidth, oldHeight,
null);
for (int x = 0; x < newWidth; x++)
for (int y = 0; y < newHeight; y++)
bgPixels[x][y] = bgImage.getRGB(x, y);
}
// below here are unused imports
public void setKeyListener(java.awt.event.KeyListener kl) {
}
public org.moparscape.userver.Server[] getUpdateServers(String defaultLocation, String customLocation) {
return null;
}
public void setOndemandPort(int port) {
}
public void setJaggrabPort(int port) {
}
public void setMapLock(boolean maplock, int mapface) {
}
public void setHPheads(boolean on) {
}
public void setZoom(boolean on) {
}
public void modZoomInts(int zoom, int fwdbwd, int lftrit) {
}
}