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


Java Camera类代码示例

本文整理汇总了Java中com.badlogic.gdx.graphics.Camera的典型用法代码示例。如果您正苦于以下问题:Java Camera类的具体用法?Java Camera怎么用?Java Camera使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: renderForCamera

import com.badlogic.gdx.graphics.Camera; //导入依赖的package包/类
@Override
public void renderForCamera(Camera camera) {
    spriteBatch.begin();
    spriteBatch.draw(background, 0, 0, viewport.getWorldWidth(), viewport.getWorldHeight(), (int)(scroll / (float)length * (background.getWidth() - viewport.getScreenWidth())), 0, viewport.getScreenWidth(), (int)viewport.getWorldHeight(), false, false);
    for(int i = 0; i < campaignWorlds.size(); i++)
        if(segmentWidth + i * segmentWidth - scroll > 0 && halfFreeWidth + i * segmentWidth - scroll < background.getWidth() - viewport.getWorldWidth())
            spriteBatch.draw(campaignWorlds.get(i).icon, halfFreeWidth + i * segmentWidth - scroll, viewport.getWorldHeight() / 2f - ICON_SIZE / 2);
    if(selection != -1) {
        layout.setText(game.getFonts().get("moonhouse64"), campaignWorlds.get(selection).name);
        spriteBatch.draw(textBack, viewport.getWorldWidth() / 2 - (layout.width + 40) / 2, viewport.getWorldHeight() - 72 - layout.height, layout.width + 40, layout.height + 40);
        game.getFonts().get("moonhouse64").draw(spriteBatch, campaignWorlds.get(selection).name, viewport.getWorldWidth() / 2 - layout.width / 2, viewport.getWorldHeight() - 10 - layout.height);
        layout.setText(game.getFonts().get("moonhouse64"), campaignWorlds.get(selection).desc);
        spriteBatch.draw(textBack, viewport.getWorldWidth() / 2 - (layout.width + 40) / 2, layout.height + 20, layout.width + 40, layout.height + 40);
        game.getFonts().get("moonhouse64").draw(spriteBatch, campaignWorlds.get(selection).desc, viewport.getWorldWidth() / 2 - layout.width / 2, layout.height + 83);
    }
    spriteBatch.end();
}
 
开发者ID:justinmarentette11,项目名称:Tower-Defense-Galaxy,代码行数:18,代码来源:CampaignScreen.java

示例2: keepInBoundaries

import com.badlogic.gdx.graphics.Camera; //导入依赖的package包/类
private void keepInBoundaries(){
    final Camera camera = viewport.getCamera();
    final Vector3 position = camera.position;
    if(position.x < boundary.x){
        position.x = boundary.x;
    }
    if(position.x > boundary.x + boundary.width){
        position.x = boundary.x + boundary.width;
    }
    if(position.y < boundary.y){
        position.y = boundary.y;
    }
    if(position.y > boundary.y + boundary.height) {
        position.y = boundary.y + boundary.height;
    }
}
 
开发者ID:unlimitedggames,项目名称:gdxjam-ugg,代码行数:17,代码来源:CameraController.java

示例3: update

import com.badlogic.gdx.graphics.Camera; //导入依赖的package包/类
@Override
   public void update(Entity entity, GameWorld world, Map map, Camera camera, float deltaTime) {
if (State.IMMOBILE != state) {
    stateTime -= deltaTime;
    if (stateTime <= 0) {
	// change state
	stateTime = MathUtils.random(2);
	State nextState = State.getRandom();
	if (State.WALKING == nextState) {
	    entity.sendMessage(MessageType.SET_STATE, State.WALKING, Direction.getRandom());
	} else {
	    entity.sendMessage(MessageType.SET_STATE, nextState);
	}
    }

}
   }
 
开发者ID:Quillraven,项目名称:Quilly-s-Castle,代码行数:18,代码来源:NPCAIComponent.java

示例4: updateCamera

import com.badlogic.gdx.graphics.Camera; //导入依赖的package包/类
private void updateCamera()
{
    if (!GameEntityManager.getGameEntities().contains(this.level.getShip()))
    {
        return;
    }
    Camera camera = SpaceTravels3.gameViewport.getCamera();

    camera.position.set(
        this.level.getShip().physicsComponent.getPosition().x,
        this.level.getShip().physicsComponent.getPosition().y,
        0f);
    camera.update();

    SpaceTravels3.spriteBatch.setProjectionMatrix(camera.combined);
}
 
开发者ID:overengineering,项目名称:space-travels-3,代码行数:17,代码来源:GameScreen.java

示例5: update

import com.badlogic.gdx.graphics.Camera; //导入依赖的package包/类
@Override
public void update(float deltaTime, Camera camera) {
	sun.update(!isWorldMap());
	updateLocalGameObjects(deltaTime);
	super.update(deltaTime, camera);
	for (GameLocation loc : locations) {
		loc.update(deltaTime, camera);
	}
	
	fogOfWarRayHandler.setCombinedMatrix(camera.combined);
	fogOfWarRayHandler.update();
	unpausableTweenManager.update(deltaTime);
	if (!GameState.isPaused()) {
		tweenManager.update(deltaTime);
		if (particleEffectManager != null) {
			particleEffectManager.update(deltaTime);
		}
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:20,代码来源:GameMap.java

示例6: updateFastForward

import com.badlogic.gdx.graphics.Camera; //导入依赖的package包/类
private float updateFastForward(float deltaTime, Camera camera) {
	if (fastForwarding && fastForwarded >= fastForwardBy) {
		fastForwarding = false;
		UIManager.hideProgressDialog();
		if (fastForwardCallback != null) {
			fastForwardCallback.onFinished();
		}
		fastForwardCallback = null;
	}
	
	if (fastForwarding && !isPaused) {
		int currentTimeMultiplier = currentMap.getGameTimeMultiplier();
		deltaTime = Configuration.getFastForwardStep()
				* Math.max(Configuration.getWorldGameTimeMultiplier(),
						Configuration.getLocalGameTimeMultiplier())
				/ currentTimeMultiplier;
		fastForwarded += deltaTime;
		UIManager.updateProgressDialog((fastForwarded / 3600) * currentTimeMultiplier);
		if (fastForwardRandomEncounter != null && fastForwarded >= fastForwardRandomAfter) {
			handleFastForwardRandomEncounter();
		}
	}
	return deltaTime;
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:25,代码来源:GameState.java

示例7: render

import com.badlogic.gdx.graphics.Camera; //导入依赖的package包/类
public void render(ModelBatch batch, Environment environment) {
        if (drawShapes) {
            batch.render(hub.modelInstance, environment);
            batch.render(rim.modelInstance, environment);

            for (int i = 0; i < spokesToDraw; i++) {
                spokes.get(i).updateSpokeRender();
                batch.render(spokes.get(i).modelInstance, environment);
            }
//            spokes.forEach(s -> batch.render(s.modelInstance, environment));
//            bulletWorld.updateAabbs();
        }


        if (debugDrawer.getDebugMode() > 0) {
            Camera camera = batch.getCamera();
            batch.flush();
            debugDrawer.begin(camera);
            bulletWorld.debugDrawWorld();
            debugDrawer.end();
        }
    }
 
开发者ID:Matsemann,项目名称:eamaster,代码行数:23,代码来源:WheelWorld.java

示例8: render

import com.badlogic.gdx.graphics.Camera; //导入依赖的package包/类
public void render(ModelBatch batch, Environment environment) {
        if (drawShapes) {
            for (WorldEntity entity : entities) {
                batch.render(entity.instance, environment);
            }

            batch.render(instances);
        }

        if (getDebugMode() > 0) {
            Camera camera = batch.getCamera();
            batch.flush();
            debugDrawer.begin(camera);
            bulletWorld.debugDrawWorld();
            debugDrawer.end();
//            batch.begin(camera);
        }
    }
 
开发者ID:Matsemann,项目名称:eamaster,代码行数:19,代码来源:World.java

示例9: populate

import com.badlogic.gdx.graphics.Camera; //导入依赖的package包/类
public void populate(TiledMap tiledMap, State state, Camera camera, MapLayerRendererFactory rendererFactory,
      TiledMapConfig config) {
   MapLayers mapLayers = tiledMap.getLayers();
   handleMapProperties(tiledMap.getProperties(), state, config);
   List<String> layerIds = new ArrayList<String>();
   int lastTileLayerIndex = 0;
   for (int i = 0; i < mapLayers.getCount(); ++i) {
      MapLayer mapLayer = mapLayers.get(i);
      if (mapLayer instanceof TiledMapTileLayer) {
         if (i > 0) {
            lastTileLayerIndex++;
         }
         String layerId = handleTiledMapTileLayer((TiledMapTileLayer) mapLayer, i, tiledMap, camera, rendererFactory,
               config);
         layerIds.add(layerId);
         populateStaticMapData(lastTileLayerIndex, (TiledMapTileLayer) mapLayer, state, config);
      } else {
         // Not a tiledlayer so consider it as an object layer
         handleObjectLayer(lastTileLayerIndex, mapLayer, state, config);
      }
   }
   state.setLayerIds(layerIds);
}
 
开发者ID:bitbrain,项目名称:braingdx,代码行数:24,代码来源:StatePopulator.java

示例10: draw

import com.badlogic.gdx.graphics.Camera; //导入依赖的package包/类
/**
 * Draws the view with all information depending on the subclass.
 * 
 * @param sp
 *            The sprite batch to draw on.
 * @param position
 *            The position of the view in pixel coordinates.
 */
public void draw(SpriteBatch sp, Point position)
{
	METRO.__spriteBatch.end();
	METRO.__spriteBatch.begin();
	
	// Create scissor to draw only in the area of the statistic view.
	com.badlogic.gdx.math.Rectangle scissors = new com.badlogic.gdx.math.Rectangle();
	com.badlogic.gdx.math.Rectangle clipBounds = new com.badlogic.gdx.math.Rectangle(position.x + METRO.__getXOffset(), position.y + METRO.__getYOffset(), _size.x + 1, _size.y
	        + 1);
	ScissorStack.calculateScissors((Camera) METRO.__camera, METRO.__spriteBatch.getTransformMatrix(), clipBounds, scissors);
	ScissorStack.pushScissors(scissors);
	
	drawView(sp);
	
	ScissorStack.popScissors();
}
 
开发者ID:hauke96,项目名称:METRO,代码行数:25,代码来源:AbstractTrainStatisticView.java

示例11: draw

import com.badlogic.gdx.graphics.Camera; //导入依赖的package包/类
@Override
protected void draw()
{
	METRO.__spriteBatch.end();
	METRO.__spriteBatch.begin();
	
	// Create scissor to draw only in the area of the list box.
	com.badlogic.gdx.math.Rectangle scissors = new com.badlogic.gdx.math.Rectangle();
	com.badlogic.gdx.math.Rectangle clipBounds = new com.badlogic.gdx.math.Rectangle(_area.x + METRO.__getXOffset(), _area.y + METRO.__getYOffset(), _area.width
	        + 1, _area.height + 1);
	ScissorStack.calculateScissors((Camera) METRO.__camera, METRO.__spriteBatch.getTransformMatrix(), clipBounds, scissors);
	ScissorStack.pushScissors(scissors);
	
	if (_decorated) clearBackground();
	
	drawEntries();
	
	if (_decorated) drawBorders();
	
	drawScrollbar();
	
	ScissorStack.popScissors();
}
 
开发者ID:hauke96,项目名称:METRO,代码行数:24,代码来源:List.java

示例12: draw

import com.badlogic.gdx.graphics.Camera; //导入依赖的package包/类
@Override
protected void draw()
{
	Contract.RequireNotNull(_painter);
	
	Draw.setOffset(_area.x, _area.y);
	Fill.setOffset(_area.x, _area.y);
	
	com.badlogic.gdx.math.Rectangle scissors = new com.badlogic.gdx.math.Rectangle();
	com.badlogic.gdx.math.Rectangle clipBounds = new com.badlogic.gdx.math.Rectangle(_area.x + METRO.__getXOffset(), _area.y + METRO.__getYOffset(), _area.width
	        + 1, _area.height + 1);
	
	ScissorStack.calculateScissors((Camera) METRO.__camera, METRO.__spriteBatch.getTransformMatrix(), clipBounds, scissors);
	ScissorStack.pushScissors(scissors);
	
	_painter.paint();
	
	ScissorStack.popScissors();
	
	Draw.setOffset(METRO.__getXOffset(), METRO.__getYOffset());
	Fill.setOffset(METRO.__getXOffset(), METRO.__getYOffset());
}
 
开发者ID:hauke96,项目名称:METRO,代码行数:23,代码来源:Canvas.java

示例13: begin

import com.badlogic.gdx.graphics.Camera; //导入依赖的package包/类
@Override
public void begin(Camera camera, RenderContext context) {
	program.begin();
	viewProjTrans.set(camera.combined);

	program.setUniformf(u_cameraPosition, camera.position.x, camera.position.y, 
			camera.position.z, 1);
	program.setUniformf(u_worldLightDir, lightDirection.x, lightDirection.y, lightDirection.z, 0);

	context.setDepthTest(GL20.GL_LEQUAL);
	context.setCullFace(GL20.GL_BACK);
	context.setBlending(shouldFadeEnds ? true : false, GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);

	texture.bind(0);
	program.setUniformi(u_texture, 0);

	specLUT.getTexture().bind(1);
	program.setUniformi(u_specularPowerLUTTexture, 1);

}
 
开发者ID:CypherCove,项目名称:DoubleHelix,代码行数:21,代码来源:SubsurfaceScatteringShader.java

示例14: ParticleGroupStrategy

import com.badlogic.gdx.graphics.Camera; //导入依赖的package包/类
public ParticleGroupStrategy(final Camera camera) {
    this.camera = camera;

    cameraSorter = new Comparator<Decal>() {
        @Override
        public int compare (Decal o1, Decal o2) {
            return (int)Math.signum(((DecalPlus)o2).cameraDistance - ((DecalPlus)o1).cameraDistance);
        }
    };

    billboardCameraSorter = new Comparator<BillboardDecal>() {
        @Override
        public int compare (BillboardDecal o1, BillboardDecal o2) {
            return (int)Math.signum(o2.floatValue - o1.floatValue);
        }
    };

    loadShaders();
}
 
开发者ID:CypherCove,项目名称:DoubleHelix,代码行数:20,代码来源:ParticleGroupStrategy.java

示例15: replaceCameraActuator

import com.badlogic.gdx.graphics.Camera; //导入依赖的package包/类
public ActuatorEntity replaceCameraActuator(Camera camera, short height,
		float damping, float minDistanceX, float minDistanceY,
		String followTagEntity) {
	CameraActuator component = (CameraActuator) recoverComponent(ActuatorComponentsLookup.CameraActuator);
	if (component == null) {
		component = new CameraActuator(camera, height, damping,
				minDistanceX, minDistanceY, followTagEntity);
	} else {
		component.actuator = (indexOwner) -> {
			Set<GameEntity> followEntities = Indexed
					.getTagEntities(followTagEntity);
			for (GameEntity followEntity : followEntities) {
				RigidBody rc = followEntity.getRigidBody();
				Transform transform = rc.body.getTransform();
				Vector3 position = camera.position;
				position.x += (transform.getPosition().x + minDistanceX - position.x)
						* damping;
				position.y += (transform.getPosition().y + minDistanceY - position.y)
						* height;
			}
		};
	}
	replaceComponent(ActuatorComponentsLookup.CameraActuator, component);
	return this;
}
 
开发者ID:Rubentxu,项目名称:Entitas-Java,代码行数:26,代码来源:ActuatorEntity.java


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