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


Java Pools.free方法代码示例

本文整理汇总了Java中com.badlogic.gdx.utils.Pools.free方法的典型用法代码示例。如果您正苦于以下问题:Java Pools.free方法的具体用法?Java Pools.free怎么用?Java Pools.free使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.utils.Pools的用法示例。


在下文中一共展示了Pools.free方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: drawPlayerNames

import com.badlogic.gdx.utils.Pools; //导入方法依赖的package包/类
void drawPlayerNames(){
GlyphLayout layout = Pools.obtain(GlyphLayout.class);

      Draw.tscl(0.25f/2);
   for(Player player : Vars.control.playerGroup.all()){
      if(!player.isLocal){
       	layout.setText(Core.font, player.name);
		Draw.color(0f, 0f, 0f, 0.3f);
		Draw.rect("blank", player.x, player.y + 8 - layout.height/2, layout.width + 2, layout.height + 2);
		Draw.color();
		Draw.tcolor(NetClient.colorArray[player.id % NetClient.colorArray.length]);
           Draw.text(player.name, player.x, player.y + 8);
           Draw.tcolor();
          }
      }
Pools.free(layout);
      Draw.tscl(Vars.fontscale);
  }
 
开发者ID:Anuken,项目名称:Mindustry,代码行数:19,代码来源:Renderer.java

示例2: fireEventOnActor

import com.badlogic.gdx.utils.Pools; //导入方法依赖的package包/类
protected boolean fireEventOnActor(Actor actor, InputEvent.Type type, int pointer, Actor related) {
    if (actor == null || !isActorFocussable(actor) || !isActorHittable(actor))
        return false;

    InputEvent event = Pools.obtain(InputEvent.class);
    event.setType(type);
    event.setStage(this);
    event.setRelatedActor(related);
    event.setPointer(pointer);
    event.setButton(-1);

    actor.fire(event);

    boolean handled = event.isHandled();
    Pools.free(event);
    return handled;
}
 
开发者ID:MrStahlfelge,项目名称:gdx-controllerutils,代码行数:18,代码来源:ControllerMenuStage.java

示例3: setValue

import com.badlogic.gdx.utils.Pools; //导入方法依赖的package包/类
/**
 * Sets the progress bar position, rounded to the nearest step size and clamped to the minumum and maximim values.
 * {@link #clamp(float)} can be overidden to allow values outside of the progress bars min/max range.
 *
 * @return false if the value was not changed because the progress bar already had the value or it was canceled by a listener.
 */
public boolean setValue(float value) {
    value = snap(clamp(Math.round(value / stepSize) * stepSize));
    float oldValue = this.value;
    if (value == oldValue) {
        return false;
    }
    float oldVisualValue = getVisualValue();
    this.value = value;
    ChangeEvent changeEvent = Pools.obtain(ChangeEvent.class);
    boolean cancelled = fire(changeEvent);
    if (cancelled) {
        this.value = oldValue;
    } else if (animateDuration > 0) {
        animateFromValue = oldVisualValue;
        animateTime = animateDuration;
    }
    Pools.free(changeEvent);
    return !cancelled;
}
 
开发者ID:varFamily,项目名称:cocos-ui-libgdx,代码行数:26,代码来源:ProgressBar.java

示例4: dispose

import com.badlogic.gdx.utils.Pools; //导入方法依赖的package包/类
@Override
public void dispose()
{
    BackgroundPositionManager.setBackgroundPositionController(new RandomBackgroundPositionController());
    GameEntityManager.dispose();
    Constants.General.EVENT_BUS.unregister(this);
    ScreenManager.removeScreen(this.hudScreen);

    this.level.dispose();

    AssMan.getGameAssMan().clear();

    PhysicsEngine.dispose();

    if (this.shipProjection != null)
    {
        Pools.free(this.shipProjection);
    }
}
 
开发者ID:overengineering,项目名称:space-travels-3,代码行数:20,代码来源:GameScreen.java

示例5: drawSelf

import com.badlogic.gdx.utils.Pools; //导入方法依赖的package包/类
@Override
protected void drawSelf(KrRenderer renderer) {
    if (popupMenu.isShowing()) {
        renderer.setBrush(((KrComboBoxStyle) getStyle()).pressedBackground);
    } else {
        renderer.setBrush(((KrComboBoxStyle) getStyle()).background);
    }

    renderer.fillRect(0, 0, getWidth(), getHeight());

    rectangles(0, 0, getWidth(), getHeight()).shrink(getPadding()).value(tmpRect);
    Vector2 pTextPosition = KrAlignmentTool.alignRectangles(text.getBounds(), tmpRect, KrAlignment.MIDDLE_LEFT);

    renderer.setPen(1, getForeground());
    renderer.drawText(text.getString(), pTextPosition);

    Pools.free(pTextPosition);
}
 
开发者ID:alexpana,项目名称:kreativity-ui,代码行数:19,代码来源:KrComboBox.java

示例6: drawSelf

import com.badlogic.gdx.utils.Pools; //导入方法依赖的package包/类
@Override
protected void drawSelf(KrRenderer renderer) {
    Drawable grip = ((KrSplitPanelStyle) KrSplitPanel.this.getStyle()).splitterGrip;

    Rectangle gripRectangle = Pools.obtain(Rectangle.class).set(0, 0, grip.getMinWidth(), grip.getMinHeight());
    Rectangle geometryRectangle = Pools.obtain(Rectangle.class).set(0, 0, getWidth(), getHeight());
    Vector2 gripPosition = alignRectangles(gripRectangle, geometryRectangle, MIDDLE_CENTER);
    gripRectangle.setPosition(gripPosition);

    renderer.setBrush(grip);
    renderer.fillRect(gripRectangle);

    Pools.free(getGeometry());
    Pools.free(geometryRectangle);
    Pools.free(gripRectangle);
}
 
开发者ID:alexpana,项目名称:kreativity-ui,代码行数:17,代码来源:KrSplitPanel.java

示例7: debugRender

import com.badlogic.gdx.utils.Pools; //导入方法依赖的package包/类
/** Draws a polygon, using ray start and end points as vertices */
public void debugRender (PolygonShapeRenderer shapeRenderer) {
	shapeRenderer.setColor(Color.BLUE);
	FloatArray vertices = Pools.obtain(FloatArray.class);
	vertices.clear();
	for (int i = 0; i < rayNum; i++) {
		vertices.addAll(mx[i], my[i]);
	}
	for (int i = rayNum - 1; i > -1; i--) {
		vertices.addAll(startX[i], startY[i]);
	}
	vertices.add(vertices.get(0));
	vertices.add(vertices.get(1));
	shapeRenderer.polyline(vertices.shrink());
	Pools.free(vertices);
}
 
开发者ID:Quexten,项目名称:RavTech,代码行数:17,代码来源:RavChainLight.java

示例8: layoutInsideCell

import com.badlogic.gdx.utils.Pools; //导入方法依赖的package包/类
private void layoutInsideCell(KrWidget widget, Rectangle cellBounds) {
    Constraint constraint = constraints.get(widget);
    Vector2 widgetPreferredSize = widget.getPreferredSize();

    int widgetWidth = (widgetPreferredSize.x >= cellBounds.width) ? (int) cellBounds.width : (int) widgetPreferredSize.x;
    int widgetHeight = (widgetPreferredSize.y >= cellBounds.height) ? (int) cellBounds.height : (int) widgetPreferredSize.y;

    if (constraint.stretchHorizontal) {
        widgetWidth = (int) cellBounds.width;
    }

    if (constraint.stretchVertical) {
        widgetHeight = (int) cellBounds.height;
    }

    Vector2 widgetPosition = KrAlignmentTool.alignRectangles(new Rectangle(0, 0, widgetWidth, widgetHeight), cellBounds, constraint.alignment);

    widget.setGeometry((int) widgetPosition.x, (int) widgetPosition.y, widgetWidth, widgetHeight);
    Pools.free(widgetPosition);
}
 
开发者ID:alexpana,项目名称:kreativity-ui,代码行数:21,代码来源:KrGridLayout.java

示例9: loadInvitations

import com.badlogic.gdx.utils.Pools; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void loadInvitations(InvitationBuffer invitations) {
    ObjectSet<String> tmp = Pools.obtain(ObjectSet.class);
    tmp.addAll(invites);
    invites.clear();
    for (Invitation invitation : invitations) {
        invites.add(invitation.getInvitationId());
        if (!tmp.contains(invitation.getInvitationId())) {
            showInvitation(invitation);
        }
    }
    tmp.clear();
    Pools.free(tmp);
    Gdx.app.postRunnable(new Runnable() {
        @Override public void run() {
            invitesDispatcher.setState(invites.size);
        }
    });
}
 
开发者ID:ratrecommends,项目名称:dice-heroes,代码行数:20,代码来源:GameServicesMultiplayer.java

示例10: intersectSegments

import com.badlogic.gdx.utils.Pools; //导入方法依赖的package包/类
/** @param segments the segments
 *  @param polygon if the segments represent a closed polygon
 *  @param intersections the array to store the intersections in */
public static void intersectSegments(float x1, float y1, float x2, float y2, float[] segments, boolean polygon, FloatArray intersections) {
    if(polygon && segments.length < 6)
        throw new IllegalArgumentException("a polygon consists of at least 3 points: " + segments.length);
    else if(segments.length < 4)
        throw new IllegalArgumentException("segments does not contain enough vertices to represent at least one segment: " + segments.length);
    if(segments.length % 2 != 0)
        throw new IllegalArgumentException("malformed segments; the number of vertices is not dividable by 2: " + segments.length);
    intersections.clear();
    Vector2 tmp = Pools.obtain(Vector2.class);
    for(int i = 0, n = segments.length - (polygon ? 0 : 2); i < n; i += 2) {
        float x3 = segments[i], y3 = segments[i + 1], x4 = wrapIndex(i + 2, segments), y4 = wrapIndex(i + 3, segments);
        if(Intersector.intersectSegments(x1, y1, x2, y2, x3, y3, x4, y4, tmp)) {
            intersections.add(tmp.x);
            intersections.add(tmp.y);
        }
    }
    Pools.free(tmp);
}
 
开发者ID:lukz,项目名称:Simple-Isometric-Game,代码行数:22,代码来源:GeometryUtils.java

示例11: setKeyboardFocus

import com.badlogic.gdx.utils.Pools; //导入方法依赖的package包/类
/** Sets the actor that will receive key events.
 * @param actor May be null. */
public void setKeyboardFocus (Actor actor) {
	if (keyboardFocus == actor) return;
	FocusEvent event = Pools.obtain(FocusEvent.class);
	event.setStage(this);
	event.setType(FocusEvent.Type.keyboard);
	Actor oldKeyboardFocus = keyboardFocus;
	if (oldKeyboardFocus != null) {
		event.setFocused(false);
		event.setRelatedActor(actor);
		oldKeyboardFocus.fire(event);
	}
	if (!event.isCancelled()) {
		keyboardFocus = actor;
		if (actor != null) {
			event.setFocused(true);
			event.setRelatedActor(oldKeyboardFocus);
			actor.fire(event);
			if (event.isCancelled()) setKeyboardFocus(oldKeyboardFocus);
		}
	}
	Pools.free(event);
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:25,代码来源:Stage.java

示例12: fireEnterAndExit

import com.badlogic.gdx.utils.Pools; //导入方法依赖的package包/类
private Actor fireEnterAndExit (Actor overLast, int screenX, int screenY, int pointer) {
	// Find the actor under the point.
	screenToStageCoordinates(tempCoords.set(screenX, screenY));
	Actor over = hit(tempCoords.x, tempCoords.y, true);
	if (over == overLast) return overLast;

	InputEvent event = Pools.obtain(InputEvent.class);
	event.setStage(this);
	event.setStageX(tempCoords.x);
	event.setStageY(tempCoords.y);
	event.setPointer(pointer);
	// Exit overLast.
	if (overLast != null) {
		event.setType(InputEvent.Type.exit);
		event.setRelatedActor(over);
		overLast.fire(event);
	}
	// Enter over.
	if (over != null) {
		event.setType(InputEvent.Type.enter);
		event.setRelatedActor(overLast);
		over.fire(event);
	}
	Pools.free(event);
	return over;
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:27,代码来源:Stage.java

示例13: setScrollFocus

import com.badlogic.gdx.utils.Pools; //导入方法依赖的package包/类
/** Sets the actor that will receive scroll events.
 * @param actor May be null. */
public void setScrollFocus (Actor actor) {
	if (scrollFocus == actor) return;
	FocusEvent event = Pools.obtain(FocusEvent.class);
	event.setStage(this);
	event.setType(FocusEvent.Type.scroll);
	Actor oldScrollFocus = keyboardFocus;
	if (oldScrollFocus != null) {
		event.setFocused(false);
		event.setRelatedActor(actor);
		oldScrollFocus.fire(event);
	}
	if (!event.isCancelled()) {
		scrollFocus = actor;
		if (actor != null) {
			event.setFocused(true);
			event.setRelatedActor(oldScrollFocus);
			actor.fire(event);
			if (event.isCancelled()) setScrollFocus(oldScrollFocus);
		}
	}
	Pools.free(event);
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:25,代码来源:Stage.java

示例14: touchDown

import com.badlogic.gdx.utils.Pools; //导入方法依赖的package包/类
public boolean touchDown(int paramInt1, int paramInt2, int paramInt3, int paramInt4)
{
  screenToStageCoordinates(this.stageCoords.set(paramInt1, paramInt2));
  InputEvent localInputEvent = (InputEvent)Pools.obtain(InputEvent.class);
  localInputEvent.setType(InputEvent.Type.touchDown);
  localInputEvent.setStage(this);
  localInputEvent.setStageX(this.stageCoords.x);
  localInputEvent.setStageY(this.stageCoords.y);
  localInputEvent.setPointer(paramInt3);
  localInputEvent.setButton(paramInt4);
  Object localObject = hit(this.stageCoords.x, this.stageCoords.y);
  if (localObject == null)
    localObject = this.root;
  ((Actor)localObject).fire(localInputEvent);
  boolean bool = localInputEvent.isHandled();
  Pools.free(localInputEvent);
  return bool;
}
 
开发者ID:isnuryusuf,项目名称:ingress-indonesia-dev,代码行数:19,代码来源:Stage.java

示例15: computeTransformFor

import com.badlogic.gdx.utils.Pools; //导入方法依赖的package包/类
/**
 * For a given actor computes and applies the transformation to keep the
 * same screen transformation in a new group
 * 
 * @param actor
 * @param parent
 */
public static void computeTransformFor(Actor actor, Group parent) {
	Vector2 tmp1 = Pools.obtain(Vector2.class);
	Vector2 tmp2 = Pools.obtain(Vector2.class);
	Vector2 tmp3 = Pools.obtain(Vector2.class);
	Vector2 tmp4 = Pools.obtain(Vector2.class);
	Vector2 tmp5 = Pools.obtain(Vector2.class);

	calculateBounds(actor, tmp4, tmp5);
	Vector2 o = tmp1.set(tmp4.x, tmp4.y);
	Vector2 t = tmp2.set(tmp4.x + tmp5.x, tmp4.y);
	Vector2 n = tmp3.set(tmp4.x, tmp4.y + tmp5.y);
	actor.localToAscendantCoordinates(parent, o);
	actor.localToAscendantCoordinates(parent, t);
	actor.localToAscendantCoordinates(parent, n);
	actor.setRotation(actor.getRotation() + actor.getParent().getRotation());
	applyTransformation(actor, o, t, n);

	Pools.free(tmp1);
	Pools.free(tmp2);
	Pools.free(tmp3);
	Pools.free(tmp4);
	Pools.free(tmp5);
}
 
开发者ID:e-ucm,项目名称:ead,代码行数:31,代码来源:EngineUtils.java


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