blob: 813dfdce236945835ad31e04e3b202d460c92291 (
plain) (
blame)
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
103
|
package NET.worlds.scape;
import java.awt.Color;
import java.io.IOException;
public class StringTexture extends Texture implements Persister {
private String _text;
private String _font;
private int _size;
private Color _fore;
private Color _back;
private char[] _array;
private int _length;
private static Object classCookie = new Object();
static {
nativeInit();
}
public StringTexture(String text, String font, int size, Color fore, Color back) {
this._text = text;
this._font = font;
this._size = size;
this._fore = fore;
this._back = back;
this._array = text.toCharArray();
this._length = text.length();
this.makeStringTexture();
}
protected StringTexture() {
}
public static native void nativeInit();
private native void makeStringTexture();
@Override
public void saveState(Saver s) throws IOException {
s.saveVersion(0, classCookie);
super.saveState(s);
s.saveString(this._text);
s.saveString(this._font);
s.saveInt(this._size);
s.saveInt(this._fore.getRGB());
s.saveInt(this._back.getRGB());
}
@Override
public void restoreState(Restorer r) throws IOException, TooNewException {
switch (r.restoreVersion(classCookie)) {
case 0:
super.restoreState(r);
this._text = r.restoreString();
this._array = this._text.toCharArray();
this._length = this._text.length();
this._font = r.restoreString();
this._size = r.restoreInt();
this._fore = new Color(r.restoreInt());
this._back = new Color(r.restoreInt());
this.makeStringTexture();
return;
default:
throw new TooNewException();
}
}
public String getText() {
return this._text;
}
public String getFont() {
return this._font;
}
public int getSize() {
return this._size;
}
public Color getForegroundColor() {
return this._fore;
}
public Color getBackgroundColor() {
return this._back;
}
@Override
public String toString() {
return super.toString()
+ "["
+ this._text
+ ", Font "
+ this._font
+ ", Size "
+ this._size
+ ", Forground "
+ this._fore
+ ", Background "
+ this._back
+ "]";
}
}
|