-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSmokePuffPool.java
More file actions
43 lines (29 loc) · 1.07 KB
/
Copy pathSmokePuffPool.java
File metadata and controls
43 lines (29 loc) · 1.07 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
package com.smiths;
import org.andengine.opengl.texture.region.TiledTextureRegion;
import org.andengine.opengl.vbo.VertexBufferObjectManager;
import org.andengine.util.adt.pool.GenericPool;
public class SmokePuffPool extends GenericPool<SmokePuff> {
private TiledTextureRegion mTextureRegion;
private VertexBufferObjectManager VBO;
public SmokePuffPool(TiledTextureRegion SmokePuffTexture, VertexBufferObjectManager vbo) {
if (SmokePuffTexture == null) {
// Need to be able to create a Sprite so the Pool needs to have a TextureRegion
throw new IllegalArgumentException("The texture region must not be NULL");
}
mTextureRegion = SmokePuffTexture;
VBO = vbo;
}
@Override
protected SmokePuff onAllocatePoolItem() {
// TODO Auto-generated method stub
return new SmokePuff(0, 0, mTextureRegion, VBO);
}
@Override
protected void onHandleRecycleItem(final SmokePuff currentSmokePuff) {
currentSmokePuff.collect();
}
@Override
protected void onHandleObtainItem(final SmokePuff currentSmokePuff) {
currentSmokePuff.reset();
}
}