本文整理汇总了Java中com.badlogic.gdx.utils.Pools.get方法的典型用法代码示例。如果您正苦于以下问题:Java Pools.get方法的具体用法?Java Pools.get怎么用?Java Pools.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.utils.Pools
的用法示例。
在下文中一共展示了Pools.get方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: reset
import com.badlogic.gdx.utils.Pools; //导入方法依赖的package包/类
@Override
public void reset()
{
Pool<Vertex> vertexPool = Pools.get(Vertex.class);
for (Vertex vertex : this.vertices)
{
vertexPool.free(vertex);
}
this.vertices = null;
}
示例2: EntityFactory
import com.badlogic.gdx.utils.Pools; //导入方法依赖的package包/类
public EntityFactory(Renderer renderer, EntityDetector detector, TweenManager tweenManager) {
entityPool = Pools.get(Entity.class);
this.renderer = renderer;
this.tweenManager = tweenManager;
this.detector = detector;
villagerTexturePool = new TexturePool(TEXTURE_CAPACITY, new VillagerTextureGenerator());
villagerTexturePool.setTextureSize(VILLAGER_WIDTH * 2, VILLAGER_HEIGHT * 2);
policeTexturePool = new TexturePool(TEXTURE_CAPACITY, new VillagerTextureGenerator());
policeTexturePool.setTextureSize(VILLAGER_WIDTH * 2, VILLAGER_HEIGHT * 2);
}
示例3: prepare
import com.badlogic.gdx.utils.Pools; //导入方法依赖的package包/类
/**
* Returns a new or pooled action of the specified type.
*/
static public <T extends Step> T prepare(Class<T> type, float atAge) {
Pool<T> pool = Pools.get(type);
T node = pool.obtain();
node.setPool(pool);
node.atAge = atAge;
return node;
}
示例4: prepare
import com.badlogic.gdx.utils.Pools; //导入方法依赖的package包/类
/**
* Returns a new or pooled action of the specified type.
*/
public static <T extends Operation> T prepare(Class<T> type) {
final Pool<T> pool = Pools.get(type);
T node = pool.obtain();
node.setPool(pool);
return node;
}
示例5: action3d
import com.badlogic.gdx.utils.Pools; //导入方法依赖的package包/类
/** Returns a new or pooled action of the specified type. */
static public <T extends Action3d> T action3d (Class<T> type) {
Pool<T> pool = Pools.get(type);
T action = pool.obtain();
action.setPool(pool);
return action;
}
示例6: action
import com.badlogic.gdx.utils.Pools; //导入方法依赖的package包/类
public static <T extends Action> T action(Class<T> paramClass)
{
Pool localPool = Pools.get(paramClass);
Action localAction = (Action)localPool.obtain();
localAction.setPool(localPool);
return localAction;
}
示例7: show
import com.badlogic.gdx.utils.Pools; //导入方法依赖的package包/类
@Override
public void show() {
tweenManager = new TweenManager();
camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
camera.setToOrtho(true);
pool = Pools.get(Entity.class);
renderer = new Renderer(pool);
batch = new SpriteBatch();
final int BACKHEIGHT = 150;
generateStreet();
generateSky();
entityDetector = new BruteForceEntityDetector(renderer.getRenderTargets(), street);
entitySpawner = new EntityFactory(renderer, entityDetector, tweenManager);
foreground = generateHouseRow(street.getY() + street.getHeight(), (int) (Gdx.graphics.getHeight() - (street.getY() + street.getHeight())));
background = generateHouseRow(street.getY() - BACKHEIGHT, BACKHEIGHT);
crtShader = new ShaderProgram(Gdx.files.internal("crt.vert"), Gdx.files.internal("crt.frag"));
entityKiller = new SimpleEntityKiller(renderer, tweenManager);
System.out.println(crtShader.getLog());
aiHandler = new AIHandler(street, entitySpawner);
// Do day night cycle
Tween.to(ambientColor, ColorTween.R, DAY_DURATION)
.target(Color.valueOf(Resources.COLOR_NIGHT).r)
.ease(TweenEquations.easeInOutSine)
.repeatYoyo(Tween.INFINITY, 0)
.start(tweenManager);
Tween.to(ambientColor, ColorTween.G, DAY_DURATION)
.target(Color.valueOf(Resources.COLOR_NIGHT).g)
.ease(TweenEquations.easeInOutSine)
.repeatYoyo(Tween.INFINITY, 0)
.start(tweenManager);
Tween.to(ambientColor, ColorTween.B, DAY_DURATION)
.target(Color.valueOf(Resources.COLOR_NIGHT).b)
.ease(TweenEquations.easeInOutSine)
.repeatYoyo(Tween.INFINITY, 0)
.start(tweenManager);
// Play the music
Music music = SharedAssetManager.getInstance().get(Resources.MUSIC_AMBIENT, Music.class);
music.setLooping(true);
music.setVolume(0.4f);
music.play();
}
示例8: BufferedFileImageRenderer
import com.badlogic.gdx.utils.Pools; //导入方法依赖的package包/类
public BufferedFileImageRenderer(int bufferSize) {
this.bufferSize = bufferSize;
outputFrameBuffer = new ArrayList<BufferedFrame>(bufferSize);
bfPool = Pools.get(BufferedFrame.class, bufferSize);
}
示例9: calculateOffsets
import com.badlogic.gdx.utils.Pools; //导入方法依赖的package包/类
@Override
protected void calculateOffsets () {
super.calculateOffsets();
if (chunkUpdateScheduled == false) return;
chunkUpdateScheduled = false;
highlights.sort();
renderChunks.clear();
String text = getText();
Pool<GlyphLayout> layoutPool = Pools.get(GlyphLayout.class);
GlyphLayout layout = layoutPool.obtain();
boolean carryHighlight = false;
for (int lineIdx = 0, highlightIdx = 0; lineIdx < linesBreak.size; lineIdx += 2) {
int lineStart = linesBreak.items[lineIdx];
int lineEnd = linesBreak.items[lineIdx + 1];
int lineProgress = lineStart;
float chunkOffset = 0;
for (; highlightIdx < highlights.size; ) {
Highlight highlight = highlights.get(highlightIdx);
if (highlight.getStart() > lineEnd) {
break;
}
if (highlight.getStart() == lineProgress || carryHighlight) {
renderChunks.add(new Chunk(text.substring(lineProgress, Math.min(highlight.getEnd(), lineEnd)), highlight.getColor(), chunkOffset, lineIdx));
lineProgress = Math.min(highlight.getEnd(), lineEnd);
if (highlight.getEnd() > lineEnd) {
carryHighlight = true;
} else {
carryHighlight = false;
highlightIdx++;
}
} else {
//protect against overlapping highlights
boolean noMatch = false;
while (highlight.getStart() <= lineProgress) {
highlightIdx++;
if (highlightIdx >= highlights.size) {
noMatch = true;
break;
}
highlight = highlights.get(highlightIdx);
if (highlight.getStart() > lineEnd) {
noMatch = true;
break;
}
}
if (noMatch) break;
renderChunks.add(new Chunk(text.substring(lineProgress, highlight.getStart()), defaultColor, chunkOffset, lineIdx));
lineProgress = highlight.getStart();
}
Chunk chunk = renderChunks.peek();
layout.setText(style.font, chunk.text);
chunkOffset += layout.width;
//current highlight needs to be applied to next line meaning that there is no other highlights that can be applied to currently parsed line
if (carryHighlight) break;
}
if (lineProgress < lineEnd) {
renderChunks.add(new Chunk(text.substring(lineProgress, lineEnd), defaultColor, chunkOffset, lineIdx));
}
}
maxAreaWidth = 0;
for (String line : text.split("\\n")) {
layout.setText(style.font, line);
maxAreaWidth = Math.max(maxAreaWidth, layout.width + 30);
}
layoutPool.free(layout);
updateScrollLayout();
}
示例10: calculateOffsets
import com.badlogic.gdx.utils.Pools; //导入方法依赖的package包/类
@Override
protected void calculateOffsets () {
super.calculateOffsets();
if (!this.text.equals(lastText)) {
this.lastText = text;
BitmapFont font = style.font;
float maxWidthLine = this.getWidth()
- (style.background != null ? style.background.getLeftWidth() + style.background.getRightWidth() : 0);
linesBreak.clear();
int lineStart = 0;
int lastSpace = 0;
char lastCharacter;
Pool<GlyphLayout> layoutPool = Pools.get(GlyphLayout.class);
GlyphLayout layout = layoutPool.obtain();
for (int i = 0; i < text.length(); i++) {
lastCharacter = text.charAt(i);
if (lastCharacter == ENTER_DESKTOP || lastCharacter == ENTER_ANDROID) {
linesBreak.add(lineStart);
linesBreak.add(i);
lineStart = i + 1;
} else {
lastSpace = (continueCursor(i, 0) ? lastSpace : i);
layout.setText(font, text.subSequence(lineStart, i + 1));
if (layout.width > maxWidthLine && softwrap) {
if (lineStart >= lastSpace) {
lastSpace = i - 1;
}
linesBreak.add(lineStart);
linesBreak.add(lastSpace + 1);
lineStart = lastSpace + 1;
lastSpace = lineStart;
}
}
}
layoutPool.free(layout);
// Add last line
if (lineStart < text.length()) {
linesBreak.add(lineStart);
linesBreak.add(text.length());
}
showCursor();
}
}
示例11: OVDEventManager
import com.badlogic.gdx.utils.Pools; //导入方法依赖的package包/类
public OVDEventManager() {
tickEventPool = Pools.get( TickEvent.class );
}