@Override public void show() { stage = new Stage(new StretchViewport(Width,Height)); stage.addActor(tabContinue); PerspectiveCamera camera2 = new PerspectiveCamera(40, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); camera2.position.set(0, -Width * 0.075f, Width * 0.135f); camera2.lookAt(0, 0, 0); camera2.far = Width*0.3f; camera2.near = 1; camera2.update(); controller = new CameraInputController(camera2); CameraGroupStrategy cameraGroupStrategy = new CameraGroupStrategy(camera2); batch = new DecalBatch(cameraGroupStrategy); modelBatch = new ModelBatch(); InputMultiplexer in = new InputMultiplexer(); in.addProcessor(stage); in.addProcessor(controller); Gdx.input.setInputProcessor(in); }
@Override public void show() { if(drawone){ addBackgroundExtension(); addPuls(); addimagebg(); addButtonBottom(); drawone = false; } cameraGroupStrategy = new CameraGroupStrategy(camera); batch = new DecalBatch(cameraGroupStrategy); stage = new Stage(new StretchViewport(Gdx.graphics.getWidth(),Gdx.graphics.getHeight())); addtostage(); Gdx.input.setCatchBackKey(true); inputmulti = new InputMultiplexer(); inputmulti.addProcessor(stage); Gdx.input.setInputProcessor(inputmulti); }
@Override public void show() { if(drawone){ addroomselect(); addButtonBottom(); addPuls(); addimagebg(); addbuildRoom(); addtimerbuildroom(); drawone = false; } cameraGroupStrategy = new CameraGroupStrategy(camera); // CameraInputController controller = new CameraInputController(camera); stage = new Stage(new StretchViewport(Gdx.graphics.getWidth(),Gdx.graphics.getHeight())); batchsprite = new SpriteBatch(); addtostage(); batch = new DecalBatch(this.cameraGroupStrategy); Gdx.input.setCatchBackKey(true); InputMultiplexer inputmulti = new InputMultiplexer(); inputmulti.addProcessor(stage); Gdx.input.setInputProcessor(inputmulti); }
public RenderSystem(DecalBatch decalBatch, AssetManager assetManager, float worldDegree, Assets.LevelAssets assets) { super(Aspect.all(RenderComponent.class, PositionComponent.class)); this.levelAssets = assets; decalMap = new ObjectMap<>(); uiMap = new ObjectMap<>(); this.decalBatch = decalBatch; this.assetManager = assetManager; buffers = new ObjectMap<>(); this.spriteBatch = new SpriteBatch(); this.font = assets.uifont; font.setColor(Color.BLACK); this.uiCamera = new OrthographicCamera(); Viewport viewportUi = new FitViewport(levelAssets.health_bar_gradient.getWidth(), levelAssets.health_bar_gradient.getHeight(), uiCamera); viewportUi.update(viewportUi.getScreenWidth(), viewportUi.getScreenHeight(), true); stateTime = 0; this.worldDegree = worldDegree; gradientShader = new ShaderProgram(Shaders.GradientShader.vertexShader, Shaders.GradientShader.fragmentShader); if (gradientShader.isCompiled() == false) throw new IllegalArgumentException("couldn't compile shader: " + gradientShader.getLog()); shaderBatch = new SpriteBatch(10, gradientShader); }
public State(){ entities = new Stack<Entity>(); layeredEntityList = new ArrayList<LayeredEntity>(); particles = new Stack<Particle>(); text = new Stack<Text>(); tiles = new Stack<Entity>(); cam = new Camera(MyGdxGame.VIRTUAL_WIDTH, MyGdxGame.VIRTUAL_HEIGHT, 1); cam3d = new Camera3D(75, MyGdxGame.VIRTUAL_WIDTH, MyGdxGame.VIRTUAL_HEIGHT); sb = new SpriteBatch(); CameraGroupStrategy cgs = new CameraGroupStrategy(cam3d, new LayeredEntity.YComparator()); db = new DecalBatch(cgs); cursor = new Cursor(cam); ui = new UI(cursor); inputMultiplexer = new InputMultiplexer(); inputMultiplexer.addProcessor(ui); Gdx.input.setInputProcessor(inputMultiplexer); }
@Override protected void onInitialize() { GLProfiler.enable(); this.overlay = new Overlay(); this.level = new Level(state, new DynamicGeometryProvider(state.terrainMap)); this.selectionSystem = new SelectionSystem(level); this.cameraController = new RTSCameraController(); this.decalBatch = new DecalBatch(new CameraGroupStrategy(level.camera)); level.camera.far = LEVEL_EDITOR_FAR_CAMERA; level.camera.near = 0.01f; level.camera.fieldOfView = 70; cameraController.setCenter(level.terrainMap.getWidth() / 2, level.terrainMap.getDepth() / 2); cameraController.setCamera(level.camera); cameraController.setOverlay(overlay); selectionSystem.setOverlay(overlay); level.entities.addSystem(selectionSystem); level.entities.psychics.disable(); this.fullScreenBuffer = new FullScreenFrameBufferResult(Fbo.FRAMEBUFFER_FINAL); // }
@Override public void create () { Gdx.gl.glEnable(GL20.GL_DEPTH_TEST); Gdx.gl.glDepthFunc(GL20.GL_LESS); egg = new Texture(Gdx.files.internal("data/egg.png")); egg.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear); egg.setWrap(Texture.TextureWrap.ClampToEdge, Texture.TextureWrap.ClampToEdge); wheel = new Texture(Gdx.files.internal("data/wheel.png")); wheel.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear); wheel.setWrap(Texture.TextureWrap.ClampToEdge, Texture.TextureWrap.ClampToEdge); w = Gdx.graphics.getWidth() / 0.8f; h = Gdx.graphics.getHeight() / 0.8f; for (int i = 0; i < INITIAL_RENDERED; i++) { toRender.add(makeDecal()); } cam = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); cam.near = 0.1f; cam.far = 10f; cam.position.set(0, 0, 0.1f); cam.direction.set(0, 0, -1f); batch = new DecalBatch(new CameraGroupStrategy(cam)); Gdx.gl.glClearColor(1, 1, 0, 1); }
@Override protected void initialize() { displayableCollections = new Array<Array<? extends Displayable>>(); modelDisplayables = new Array<ModelDisplayable>(); displayableCollections.add(modelDisplayables); decalDisplayables = new Array<DecalDisplayable>(); displayableCollections.add(decalDisplayables); renderContext = new RenderContext( new DefaultTextureBinder(DefaultTextureBinder.WEIGHTED)); renderContext.setCullFace(GL20.GL_BACK); modelBatch = new ModelBatch(renderContext, new DefaultShaderProvider(), new HelixRenderableSorter()); decalBatch = new DecalBatch(new CameraGroupStrategy(camera)); spriteBatch = new SpriteBatch(); }
public void renderDecalsForBufferAndBatch(FrameBuffer buffer, DecalBatch batch) { buffer.begin(); renderContext.begin(); renderContext.end(); renderContext.begin(); Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glViewport(0, 0, buffer.getWidth(), buffer.getHeight()); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT); for (Entity entity : entities) { if (EntityDecalRenderable.class.isInstance(entity)) { EntityDecalRenderable en = (EntityDecalRenderable)entity; en.renderBatch(batch, environment); } } batch.flush(); renderContext.end(); buffer.end(); }
@Override public void show() { if(!draw){ draw = true; addBackground(); addtoStage(); } stage = new Stage(new StretchViewport(Width,Height)); decalBatch = new DecalBatch(new CameraGroupStrategy(camera)); stage.addActor(groupStage); modelBatch = new ModelBatch(); Gdx.input.setInputProcessor(stage); }
@Override public void show() { if(drawone) { initializeMenuTab(); drawProfile(); addInformation(); drawone = false; } addInfoUser(); sp.setScrollPercentX(0); sp.updateVisualScroll(); b1.setChecked(true); stage = new Stage(new StretchViewport(Gdx.graphics.getWidth(),Gdx.graphics.getHeight())){ @Override public boolean keyDown(int keyCode) { if(keyCode == Input.Keys.BACK) gameManager.setScreen(gameManager.mapsScreen); return super.keyDown(keyCode); } }; stage.addActor(backButton); stage.addActor(groupUser); stage.addActor(groupInformation); stage.addActor(ta); queueDisplay.AddtoStage(stage); batchDecal = new DecalBatch(new CameraGroupStrategy(camera)); modelBatch = new ModelBatch(); Gdx.input.setInputProcessor(stage); Gdx.input.setCatchBackKey(true); }
@Override public void show() { CameraGroupStrategy cameraGroupStrategy = new CameraGroupStrategy(camera); decalBatch = new DecalBatch(cameraGroupStrategy); stagefordialog = new Stage(new StretchViewport(Gdx.graphics.getWidth(),Gdx.graphics.getHeight())); stage = new Stage(new StretchViewport(Gdx.graphics.getWidth(), Gdx.graphics.getHeight())) { @Override public boolean keyDown(int keyCode) { if (keyCode == Input.Keys.BACK) { if (InformationProfile.getInstance().getDateUserGame().getEnklaveCombatId() == -1) gameManager.setScreen(gameManager.screenEnklave); else dialogExit("You can't out from combat!"); } return super.keyDown(keyCode); } }; drawtopcombat(); drawmap(); drawdefenders(); drawAttachers(); addBtnStartCombat(); combatFight = new CombatFitght(this, WIDTH * 0.6f); addcomponenttostage(); progressBarEnergy.FadeIn(); Gdx.input.setCatchBackKey(true); InputMultiplexer inputmulti = new InputMultiplexer(); GestureDetector gd = new GestureDetector(this); inputmulti.addProcessor(stage); inputmulti.addProcessor(gd); inputmulti.addProcessor(this); Gdx.input.setInputProcessor(inputmulti); }
public MapsScreen(GameManager game) { gameManager = game; environment = new Environment(); environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 1f, 1f, 1f, 1f)); environment.add(new DirectionalLight().set(1f, 1f, 1f, -1f, -0.8f, -0.2f)); camera = new PerspectiveCamera(40, Width, Height); camera.lookAt(0, 0, 0); camera.far = 4000; camera.near = 1; camera.update(); pos = new Vector2[3][3]; CameraGroupStrategy cameraGroupStategy = new CameraGroupStrategy(camera); batch = new DecalBatch(cameraGroupStategy); bounds = new Bounds(); matrixPixmap = MapPixmap.getInstance(); managerAssets = ManagerAssets.getInstance(); myLocation = MyLocation.getInstance(); pointerx = new int[4]; pointery = new int[4]; compass = myLocation.getCompas(); queue = MyQueue.getInstance(); //calc bounds bounds.getCorners(matrixPixmap.getMatrix()[1][1].getLatitude(),matrixPixmap.getMatrix()[1][1].getLongitude() , 17.0, 640.0, 640.0); unitlong = (bounds.calcDisance(bounds.latSW, bounds.longSW, bounds.latSW, bounds.longNE)+bounds.calcDisance(bounds.latNE,bounds.longNE,bounds.latNE,bounds.longSW))/2.0; unitlong=600/unitlong; unitlat = bounds.calcDisance(bounds.latSW, bounds.longSW, bounds.latNE, bounds.longSW); unitlat= 600/unitlat; timerEnergy = new Timer(); informationProfile = InformationProfile.getInstance(); }
public void draw (DecalBatch decalBatch, BillboardDecalBatch billboardDecalBatch){ if (Settings.pointParticles){ for (int i = 0; i < Settings.numParticles; i++) { billboardDecalBatch.add(particles.get(i).point); } billboardDecalBatch.flush(); } else { for (int i = 0; i < Settings.numParticles; i++) { decalBatch.add(particles.get(i).decal); } decalBatch.flush(); } }
public void create () { float width = Gdx.graphics.getWidth(); float height = Gdx.graphics.getHeight(); camera = new PerspectiveCamera(45, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); camera.near = 1; camera.far = 300; camera.position.set(0, 0, 5); controller = new PerspectiveCamController(camera); Gdx.input.setInputProcessor(controller); batch = new DecalBatch(new CameraGroupStrategy(camera)); TextureRegion[] textures = {new TextureRegion(new Texture(Gdx.files.internal("data/egg.png"))), new TextureRegion(new Texture(Gdx.files.internal("data/wheel.png"))), new TextureRegion(new Texture(Gdx.files.internal("data/badlogic.jpg")))}; Decal decal = Decal.newDecal(1, 1, textures[1]); decal.setPosition(0, 0, 0); decals.add(decal); decal = Decal.newDecal(1, 1, textures[0], true); decal.setPosition(0.5f, 0.5f, 1); decals.add(decal); decal = Decal.newDecal(1, 1, textures[0], true); decal.setPosition(1, 1, -1); decals.add(decal); decal = Decal.newDecal(1, 1, textures[2]); decal.setPosition(1.5f, 1.5f, -2); decals.add(decal); decal = Decal.newDecal(1, 1, textures[1]); decal.setPosition(2, 2, -1.5f); decals.add(decal); }
public void initialize(AssetManager assetManager) { // User interface sb = GlobalResources.spriteBatch; ui = new Stage(new ScreenViewport(), sb); float factor = GlobalConf.SCALE_FACTOR; indicatorw = 300 * factor; indicatorh = 300 * factor; indicatorx = -20 * factor; indicatory = -25 * factor; // init gui camera aiCam = new PerspectiveCamera(30, indicatorw, indicatorh); aiCam.near = (float) (1e5 * Constants.KM_TO_U); aiCam.far = (float) (1e8 * Constants.KM_TO_U); aiCam.up.set(0, 1, 0); aiCam.direction.set(0, 0, 1); aiCam.position.set(0, 0, 0); // Init AI dlight = new DirectionalLight(); dlight.color.set(1f, 1f, 1f, 1f); dlight.setDirection(-1f, .05f, .5f); env = new Environment(); env.set(new ColorAttribute(ColorAttribute.AmbientLight, 1f, 1f, 1f, 1f), new ColorAttribute(ColorAttribute.Specular, .5f, .5f, .5f, 1f)); env.add(dlight); db = new DecalBatch(new CameraGroupStrategy(aiCam)); mb = new ModelBatch(); assetManager.load("data/tex/attitudeindicator.png", Texture.class); assetManager.load("img/ai-pointer.png", Texture.class); assetManager.load("img/ai-vel.png", Texture.class); assetManager.load("img/ai-antivel.png", Texture.class); EventManager.instance.subscribe(this, Events.SPACECRAFT_LOADED); }
public BillboardSpriteBatch() { sprites = new Array<Decal>(true, CAPACITY_INCREMENT, Decal.class); pointer = 0; addNewSprites(CAPACITY_INCREMENT); hasBegun = false; groupStrategy = new AlphaTestCameraGroupStrategy(null); decalBatch = new DecalBatch(groupStrategy); }
@Override public void show() { enklave3D = new Enklave3D(new Vector2(),InformationEnklave.getInstance().getFaction()); enklave3D.FrontEnklave(InformationEnklave.getInstance().getFaction()); this.enklave3D.setCoordraw(coordonatedraw); camera = new PerspectiveCamera(35, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); camera.position.set(0, -222, 350);//initial 180 camera.lookAt(0, 50, 0); camera.far = 2500; camera.near = 1; camera.update(); this.cameraGroupStrategy = new CameraGroupStrategy(camera); CameraInputController controller = new CameraInputController(camera); batch = new DecalBatch(this.cameraGroupStrategy); stage = new Stage(new StretchViewport(Gdx.graphics.getWidth(), Gdx.graphics.getHeight())){ @Override public boolean keyDown(int keyCode) { if(keyCode == Input.Keys.BACK){ if (buttonCombat.getText().toString().contentEquals("ROOMS ")) { buttonCombat.setText("COMBAT "); buttonDeveloper.setText(" DEVELOPER"); deployBricks.setVisible(false); informationEnklave.setVisible(true); disaibleButton.setVisible(true); if(disaibleButton1 !=null) disaibleButton1.setVisible(true); } else { manager.getAssertEnklaveScreen().setIsupdate(false); gameManager.setScreen(gameManager.mapsScreen); } } return super.keyDown(keyCode); } }; if(drawone){ adddrawenklave(); addToolInformation(); addDeployBrick(); addButtonsBottom(); addMap(); if (InformationProfile.getInstance().getDateUserGame().isInCombat()) { manager.loadAssetsCombat(); new SubscribeCombat().makeRequest(InformationEnklave.getInstance().getId()); gameManager.setScreen(new ScreenCircleLoading(gameManager, gameManager.screenCombat, manager.getAssetsCombat())); } drawone =false; } updatelabel(); rangeEnklave = new RangeEnklave((float)location.getLatitude(),(float)location.getLongitude(),infoEnklave.getLatitude(),infoEnklave.getLongitude(),this,range); if (infoEnklave.getId() !=16066)rangeEnklave.start(); else setvisibility(false); manager.getAssertEnklaveScreen().setIsupdate(false); labelName.setText(InformationEnklave.getInstance().getName()); backButton.setChecked(false); progressBarEnergy.addGrouptoStage(stage); stage.addActor(backButton); addinfo(stage); int level = infoEnklave.getBricks()/9; if(QueueBuildCraft.getInstance().deployOn) { labelLevel.setText("LVL " + level + " (Bricks:" + (infoEnklave.getBricks()-1) + ")"); }else{ labelLevel.setText("LVL " + level + " (Bricks:" + infoEnklave.getBricks() + ")"); } mmodelBatch = new ModelBatch(); progressBarEnergy.FadeIn(); controller.camera.lookAt(enklave3D.getDecalbrick(0).getCenterX(), enklave3D.getDecalbrick(0).getCenterY(), enklave3D.getDecalbrick(0).getCenterZ()); Gdx.input.setCatchBackKey(true); InputMultiplexer inputmulti = new InputMultiplexer(); inputmulti.addProcessor(stage); Gdx.input.setInputProcessor(inputmulti); }
@Override public void show() { if (drawone) { initializeMenuTab(); drawselector(); addModele3D(); drawBackground(); addbackObject(); createexitdialog(); addDescriptorModel(); drawone = false; } stage = new Stage(new StretchViewport(Gdx.graphics.getWidth(),Gdx.graphics.getHeight())) { @Override public boolean keyDown(int keyCode) { if(keyCode == Input.Keys.BACK){ gameManager.setScreen(gameManager.mapsScreen); } return super.keyDown(keyCode); } }; stage.addActor(backButton); stage.addActor(labelBusy); stage.addActor(arrowCraft); stage.addActor(buttoncraft); stage.addActor(labelDesc); stage.addActor(labelValue); stage.addActor(tab); stage.addActor(ta); // screenChat.addToStage(stage); queueDisplay.AddtoStage(stage); updateDisplay(); progressbar.addGrouptoStage(stage); // progressbar.update(); b2.setChecked(true); backButton.setChecked(false); sp.setScrollPercentX(0); sp.updateVisualScroll(); decalBatch = new DecalBatch(new CameraGroupStrategy(camera)); modelBatch = new ModelBatch(); GestureDetector gd = new GestureDetector(this); InputMultiplexer input = new InputMultiplexer(); input.addProcessor(gd); input.addProcessor(stage); Gdx.input.setInputProcessor(input); Gdx.input.setCatchBackKey(true); }
public DecalManager(Camera camera) { this(new DecalBatch(new CameraGroupStrategy(camera))); this.camera = camera; }
public DecalManager(CameraGroupStrategy strategy) { this(new DecalBatch(strategy)); camera = strategy.getCamera(); }
public DecalManager(DecalBatch batch) { this.batch = batch; this.decals = new ArrayList<>(); this.decalLife = new HashMap<>(); }
public void draw(DecalBatch db){ for(int i = 0; i < numberOfLayers; i++){ db.add(decalList.get(i)); } }
public GameLevelScreen(LevelFile levelDef) { this.gameObjectsTweenManager = new TweenManager(); this.uiTweenManager = new TweenManager(); this.renderContext = new RenderContext(new DefaultTextureBinder(DefaultTextureBinder.WEIGHTED, 1)); this.entities = new ArrayList<Entity>(); this.perspectiveCamera = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); levelDefinition = levelDef; this.map = new Map(levelDefinition.geometryFile()); perspectiveCamera.position.set(0, 0, 0); perspectiveCamera.near = 0.1f; perspectiveCamera.far = 50f; perspectiveCamera.update(true); this.cameraController = new RTSCameraController(); cameraController.setCamera(perspectiveCamera); cameraController.setCenter(0, 0); cameraController.setEnabled(true); environment = new Environment(); environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.3f, 0.3f, 0.3f, 1f)); this.cellShadingCompositor = new LevelCompositor(renderContext); this.robot = BotLogic.entities.robot(); this.robot.led = BotLogic.entities.led(); addEntity(this.robot); addEntity(this.robot.led); colorModelBatch = new ModelBatch(renderContext); decalBatch = new DecalBatch(); decalBatch.setGroupStrategy(new CameraGroupStrategy(perspectiveCamera)); DepthShader.Config depthConfig = new DepthShader.Config(Gdx.files.internal("shaders/depth.vertex").readString(), Gdx.files.internal("shaders/depth.frag").readString()); depthConfig.defaultCullFace = GL20.GL_BACK; depthConfig.depthBufferOnly = false; depthModelBatch = new ModelBatch(renderContext, new DepthShaderProvider(depthConfig)); map.environment = environment; this.controller = new GameController(this); reset(); environment.set(new ColorAttribute(ColorAttribute.Fog, 0f, 0f, 0f, 1f)); environment.add(new DirectionalLight().set(new Color(.4f,.4f, .4f, 0.1f), new Vector3(1,-1,0))); BotLogic.audio.mainMenuMusic.play(); }
@Override public void renderBatch(DecalBatch batch, Environment env) { batch.add(sonarSprite); }
public abstract void renderBatch(DecalBatch batch, Environment env);