当前位置: 首页>>代码示例>>Java>>正文


Java Pools.get方法代码示例

本文整理汇总了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;
}
 
开发者ID:overengineering,项目名称:space-travels-3,代码行数:11,代码来源:Projection.java

示例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);
}
 
开发者ID:bitbrain,项目名称:pretender,代码行数:11,代码来源:EntityFactory.java

示例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;
}
 
开发者ID:DaanVanYperen,项目名称:naturally-selected-2d,代码行数:11,代码来源:Script.java

示例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;
}
 
开发者ID:DaanVanYperen,项目名称:artemis-odb-contrib,代码行数:10,代码来源:Operation.java

示例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;
}
 
开发者ID:pyros2097,项目名称:Scene3d,代码行数:8,代码来源:Actions3d.java

示例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;
}
 
开发者ID:isnuryusuf,项目名称:ingress-indonesia-dev,代码行数:8,代码来源:Actions.java

示例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();
}
 
开发者ID:bitbrain,项目名称:pretender,代码行数:52,代码来源:IngameScreen.java

示例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);
}
 
开发者ID:langurmonkey,项目名称:gaiasky,代码行数:6,代码来源:BufferedFileImageRenderer.java

示例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();
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:77,代码来源:HighlightTextArea.java

示例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();
	}
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:44,代码来源:VisTextArea.java

示例11: OVDEventManager

import com.badlogic.gdx.utils.Pools; //导入方法依赖的package包/类
public OVDEventManager() {
	tickEventPool = Pools.get( TickEvent.class );
}
 
开发者ID:Vhati,项目名称:OverdriveGDX,代码行数:4,代码来源:OVDEventManager.java


注:本文中的com.badlogic.gdx.utils.Pools.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。