www.pudn.com > BlackCross.rar > fader.java
import javax.microedition.lcdui.Graphics;
class fader
{
int timer;
int w;
int h;
int fps;
int type;
int y1;
int y2;
int y3;
int y4;
public fader(int i, int j, long l)
{
timer = 0;
type = 0;
y1 = 0;
y2 = 0;
y3 = 0;
y4 = 0;
w = i;
h = j + 1;
fps = (int)l - 1;
y1 = 0;
y2 = h / 4;
y3 = (h / 4) * 2;
y4 = (h / 4) * 3;
}
public void setType(int i)
{
if(i > 1)
{
return;
} else
{
type = i;
return;
}
}
public void out(Graphics g, int i, int j)
{
if(i < j || i > j + fps)
return;
int k = ((i - j) * w) / fps;
if(k > 128)
g.setColor(0x800000);
else
g.setColor(k * 256 * 256);
if(type == 0)
{
g.fillRect(-k, 0, w, h / 4);
g.fillRect(k, y2, w, h / 4);
g.fillRect(-k, y3, w, h / 4);
g.fillRect(k, y4, w, h / 4);
} else
if(type == 1)
{
g.fillRect(0, 0 - k, w, h / 2);
g.fillRect(0, y3 + k, w, h / 2);
g.fillRect(0 - k, 0, w / 2, h);
g.fillRect(w / 2 + k, 0, w / 2, h);
}
}
public void in(Graphics g, int i, int j)
{
if(i < j)
return;
int k;
if(i > j + fps)
k = 128;
else
k = ((i - j) * w) / fps;
g.setColor((128 - k) * 256 * 256);
g.fillRect(-w + k, 0, w, h / 4);
g.fillRect(w - k, y2, w, h / 4);
g.fillRect(-w + k, y3, w, h / 4);
g.fillRect(w - k, y4, w, h / 4);
if(i >= j + fps)
{
char c = '\377';
g.setColor(c + 256 * c + 0x10000 * c);
g.drawString("Loading...", w / 2, h / 2 - 8, 0x10 | 1);
}
}
public void in(Graphics g, int i, int j, boolean flag, int k)
{
if(i < j)
return;
int l;
if(i > j + fps)
l = 128;
else
l = ((i - j) * w) / fps;
g.setColor((128 - l) * 256 * 256);
g.fillRect(-w + l, 0, w, h / 4);
g.fillRect(w - l, y2, w, h / 4);
g.fillRect(-w + l, y3, w, h / 4);
g.fillRect(w - l, y4, w, h / 4);
if(i >= j + fps)
if(flag)
{
char c = '\377';
g.setColor(c + 256 * c + 0x10000 * c);
if(k == 1)
{
g.drawString("-Stage 1 Complete-", w / 2, h / 2 - 16, 0x10 | 1);
g.drawString("Descending to Earth", w / 2, h / 2 + 10, 0x10 | 1);
} else
if(k == 2)
{
g.drawString("-Stage 2 Complete-", w / 2, h / 2 - 16, 0x10 | 1);
g.drawString("Entering Complex", w / 2, h / 2 + 10, 0x10 | 1);
} else
if(k == 3)
{
g.drawString("-Stage 3 Complete-", w / 2, h / 2 - 16, 0x10 | 1);
g.drawString("Traversing Cave", w / 2, h / 2 + 10, 0x10 | 1);
} else
if(k == 4)
{
g.drawString("Congratulations!", w / 2, 2, 0x10 | 1);
g.drawString("Black Cross was", w / 2, 12, 0x10 | 1);
g.drawString("rescued by you!", w / 2, 22, 0x10 | 1);
g.drawString("He can now stand", w / 2, 32, 0x10 | 1);
g.drawString("to defend the earth.", w / 2, 42, 0x10 | 1);
}
} else
{
char c1 = '\377';
g.setColor(c1 + 256 * c1 + 0x10000 * c1);
g.drawString("Loading...", w / 2, h / 2 - 8, 0x10 | 1);
}
}
}