-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAbstractImageSprite.java
More file actions
172 lines (155 loc) · 4.85 KB
/
AbstractImageSprite.java
File metadata and controls
172 lines (155 loc) · 4.85 KB
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
package cn.colintree.aix.CanvasAddons;
import com.google.appinventor.components.annotations.DesignerProperty;
import com.google.appinventor.components.annotations.SimpleObject;
import com.google.appinventor.components.annotations.SimpleProperty;
import com.google.appinventor.components.common.PropertyTypeConstants;
import com.google.appinventor.components.runtime.ComponentContainer;
import com.google.appinventor.components.runtime.ImageSprite;
import com.google.appinventor.components.runtime.Sprite;
@SimpleObject(external = true)
public abstract class AbstractImageSprite extends AbstractSprite<ImageSprite> {
public AbstractImageSprite(ComponentContainer container) {
super(container);
}
// abstract methods for Events
public abstract void CollidedWith(Sprite other);
public abstract void Dragged(float startX, float startY, float prevX, float prevY, float currentX, float currentY);
public abstract void EdgeReached(int edge);
public abstract void NoLongerCollidingWith(Sprite other);
public abstract void Touched(float x, float y);
public abstract void Flung(float x, float y, float speed, float heading, float xvel, float yvel);
public abstract void TouchDown(float x, float y);
public abstract void TouchUp(float x, float y);
//@DesignerProperty(
// editorType = PropertyTypeConstants.PROPERTY_TYPE_BOOLEAN,
// defaultValue = "True")
@SimpleProperty
public void Enabled(boolean enabled) {
sprite.Enabled(enabled);
}
@SimpleProperty
public boolean Enabled() {
return sprite.Enabled();
}
//@DesignerProperty(
// editorType = PropertyTypeConstants.PROPERTY_TYPE_FLOAT,
// defaultValue = "0")
@SimpleProperty
public void Heading(double heading) {
sprite.Heading(heading);
}
@SimpleProperty
public double Heading() {
return sprite.Heading();
}
//@DesignerProperty(
// editorType = PropertyTypeConstants.PROPERTY_TYPE_INTEGER,
// defaultValue = "" + LENGTH_PREFERRED)
@SimpleProperty
public void Height(int height) {
sprite.Height(height);
}
@SimpleProperty
public int Height() {
return sprite.Height();
}
//@DesignerProperty(
// editorType = PropertyTypeConstants.PROPERTY_TYPE_INTEGER,
// defaultValue = "" + LENGTH_PREFERRED)
@SimpleProperty
public void Width(int width) {
sprite.Width(width);
}
@SimpleProperty
public int Width() {
return sprite.Width();
}
//@DesignerProperty(
// editorType = PropertyTypeConstants.PROPERTY_TYPE_NON_NEGATIVE_INTEGER,
// defaultValue = "100")
@SimpleProperty
public void Interval(int interval) {
sprite.Interval(interval);
}
@SimpleProperty
public int Interval() {
return sprite.Interval();
}
//@DesignerProperty(
// editorType = PropertyTypeConstants.PROPERTY_TYPE_ASSET,
// defaultValue = "")
@SimpleProperty
public void Picture(String path) {
sprite.Picture(path);
}
@SimpleProperty
public String Picture() {
return sprite.Picture();
}
//@DesignerProperty(
// editorType = PropertyTypeConstants.PROPERTY_TYPE_BOOLEAN,
// defaultValue = "True")
@SimpleProperty
public void Rotates(boolean rotates) {
sprite.Rotates(rotates);
}
@SimpleProperty
public boolean Rotates() {
return sprite.Rotates();
}
//@DesignerProperty(
// editorType = PropertyTypeConstants.PROPERTY_TYPE_FLOAT,
// defaultValue = "0.0")
@SimpleProperty
public void Speed(float speed) {
sprite.Speed(speed);
}
@SimpleProperty
public float Speed() {
return sprite.Speed();
}
//@DesignerProperty(
// editorType = PropertyTypeConstants.PROPERTY_TYPE_BOOLEAN,
// defaultValue = "True")
@SimpleProperty
public void Visible(boolean visible) {
sprite.Visible(visible);
}
@SimpleProperty
public boolean Visible() {
return sprite.Visible();
}
//@DesignerProperty(
// editorType = PropertyTypeConstants.PROPERTY_TYPE_FLOAT,
// defaultValue = "0.0")
@SimpleProperty
public void X(double x) {
sprite.X(x);
}
@SimpleProperty
public double X() {
return sprite.X();
}
//@DesignerProperty(
// editorType = PropertyTypeConstants.PROPERTY_TYPE_FLOAT,
// defaultValue = "0.0")
@SimpleProperty
public void Y(double y) {
sprite.Y(y);
}
@SimpleProperty
public double Y() {
return sprite.Y();
}
//@DesignerProperty(
// editorType = PropertyTypeConstants.PROPERTY_TYPE_FLOAT,
// defaultValue = "1.0")
@SimpleProperty
public void Z(double z) {
sprite.Z(z);
}
@SimpleProperty
public double Z() {
return sprite.Z();
}
}