List of usage examples for com.badlogic.gdx.utils.viewport ExtendViewport ExtendViewport
public ExtendViewport(float minWorldWidth, float minWorldHeight)
From source file:com.mcprog.ragnar.screens.GUIScreen.java
License:Apache License
public GUIScreen(Ragnar game, Table table) { super(game);//from w w w .ja v a 2s. c om this.table = table; stage = new Stage(); stage.setViewport(new ExtendViewport(Constants.IDEAL_WIDTH, Constants.IDEAL_HEIGHT)); stage.addActor(this.table); if (Ragnar.debugger.on) { stage.setDebugAll(true); } }
From source file:com.dongbat.game.screen.PickSkillScreen.java
@Override public void show() { stage.setViewport(new ExtendViewport(800, 480)); Viewport viewport = stage.getViewport(); float worldHeight = viewport.getWorldHeight(); float worldWidth = viewport.getWorldWidth(); stage.getViewport().update((int) worldWidth, (int) worldHeight); button.setPosition(-400, 120);/*from ww w.j a v a 2 s . c om*/ button.setSize(80, 80); button1.setPosition(-280, 120); button1.setSize(80, 80); button2.setPosition(-160, 120); button2.setSize(80, 80); button3.setPosition(-40, 120); button3.setSize(80, 80); button4.setPosition(-400, 0); button4.setSize(80, 80); button5.setPosition(-280, 0); button5.setSize(80, 80); button6.setPosition(-160, 0); button6.setSize(80, 80); button7.setPosition(-40, 0); button7.setSize(80, 80); stage.addActor(button); stage.addActor(button1); stage.addActor(button2); stage.addActor(button3); stage.addActor(button4); stage.addActor(button5); stage.addActor(button6); stage.addActor(button7); InputUtil.addProcessor(stage, 0); }
From source file:at.hid.tabletopsimulator.screens.About.java
License:Apache License
@Override public void show() { TableTopSimulator.debug(this.getClass().toString(), "creating About screen"); stage = new Stage(new ExtendViewport(Gdx.graphics.getWidth(), Gdx.graphics.getHeight())); Gdx.input.setInputProcessor(stage);//from w w w. j av a 2 s. com // creating skin TableTopSimulator.debug(this.getClass().toString(), "creating skin"); skin = TableTopSimulator.assets.get("ui/gui.json", Skin.class); table = new Table(skin); // table.setFillParent(true); // table.setBounds(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); // creating heading TableTopSimulator.debug(this.getClass().toString(), "creating heading"); Label lblHeading = new Label(TableTopSimulator.getLangBundle().format("About.lblHeading.text"), skin); final Label lblContent = new Label("http://libgdx.badlogicgames.com/\r\n" + "\r\n" + "libGDX is licensed under the Apache 2 License,\r\n" + "meaning you can use it free of charge, without strings attached in commercial and non-commercial projects.\r\n" + "We love to get (non-mandatory) credit in case you release a game or app using libgdx!", skin, "content"); // creating list final List<String> listAbout = new List<String>(skin, "content"); ArrayList<String> newItems = new ArrayList<String>(); newItems.add("libgdx"); newItems.add("libgdx-utils"); newItems.add("flare gameart"); String[] data = new String[newItems.size()]; listAbout.setItems(newItems.toArray(data)); listAbout.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { if (listAbout.getSelected().equals("libgdx")) { lblContent.clear(); lblContent.setText("http://libgdx.badlogicgames.com/\r\n" + "\r\n" + "libGDX is licensed under the Apache 2 License,\r\n" + "meaning you can use it free of charge, without strings attached in commercial and non-commercial projects.\r\n" + "We love to get (non-mandatory) credit in case you release a game or app using libgdx!"); } else if (listAbout.getSelected().equals("libgdx-utils")) { lblContent.clear(); lblContent.setText("https://bitbucket.org/dermetfan/libgdx-utils/wiki/Home\r\n" + "\r\n" + "/* Copyright (c) 2014 PixelScientists\r\n" + "*\r\n" + "* The MIT License (MIT)\r\n" + "*\r\n" + "* Permission is hereby granted, free of charge, to any person obtaining a copy of\r\n" + "* this software and associated documentation files (the \"Software\"), to deal in\r\n" + "* the Software without restriction, including without limitation the rights to\r\n" + "* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r\n" + "* the Software, and to permit persons to whom the Software is furnished to do so,\r\n" + "* subject to the following conditions:\r\n" + "*\r\n" + "* The above copyright notice and this permission notice shall be included in all\r\n" + "* copies or substantial portions of the Software.\r\n" + "*\r\n" + "* THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n" + "* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r\n" + "* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r\n" + "* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r\n" + "* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r\n" + "* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n" + "*/"); } else if (listAbout.getSelected().equals("flare gameart")) { lblContent.clear(); lblContent.setText("https://github.com/clintbellanger/flare-game\r\n" + "\r\n" + "Flare (the game) is Copyright 2010-2013 Clint Bellanger. Contributors retain copyrights to their original contributions.\r\n" + "\r\n" + "The Flare Engine is released under GPL version 3 or later.\r\n" + "\r\n" + "All of Flare's art and data files are released under CC-BY-SA 3.0. Later versions are permitted.\r\n" + "\r\n" + "The Liberation Sans fonts version 2 are released under the SIL Open Font License, Version 1.1.\r\n" + "\r\n" + "The GNU Unifont font is released under GPL v2, with the exception that embedding the font in a document does not in itself bind that document to the terms of the GPL."); } } }); // creating buttons TableTopSimulator.debug(this.getClass().toString(), "creating buttons"); TextButton btnBack = new TextButton(TableTopSimulator.getLangBundle().format("About.btnBack.text"), skin); btnBack.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { TableTopSimulator.debug(this.getClass().toString(), "switching to Options screen"); ((Game) Gdx.app.getApplicationListener()).setScreen(new Options()); dispose(); } }); btnBack.pad(10); ScrollPane spAboutList = new ScrollPane(null, skin); ScrollPane spAboutContent = new ScrollPane(null, skin); SplitPane splitAbout = new SplitPane(spAboutList, spAboutContent, false, skin); splitAbout.setSplitAmount(0.2f); spAboutList.setWidget(listAbout); spAboutContent.setWidget(lblContent); // building ui TableTopSimulator.debug(this.getClass().toString(), "building ui"); table.add(lblHeading).spaceBottom(100).row(); table.add(splitAbout).spaceBottom(15).width(1200).row(); table.add(btnBack).spaceBottom(15).row(); if (TableTopSimulator.DEBUG) { table.debug(); // draw debug lines splitAbout.debug(); // draw debug lines } stage.addActor(table); }
From source file:com.mcprog.ragnar.screens.KillScreen.java
License:Apache License
/** * Constructor initializes gui styles and sets ups stage and table * @param gameInstance//from w w w .j a v a 2 s.c o m */ public KillScreen(Ragnar gameInstance) { super(gameInstance); GuiStyles.init(); stage = new Stage(); stage.setViewport(new ExtendViewport(Constants.IDEAL_WIDTH, Constants.IDEAL_HEIGHT)); killTable = new KillTable(); stage.addActor(killTable); }
From source file:io.piotrjastrzebski.sfg.screen.DefaultScreen.java
License:Open Source License
public DefaultScreen() { assets = Locator.getAssets(); eventLoop = Locator.getEvents(); settings = Locator.getSettings(); actionResolver = Locator.getActionResolver(); playerStats = Locator.getPlayerStats(); batch = new SpriteBatch(); stage = new Stage(new ExtendViewport(768, 1280), batch); }
From source file:org.bladecoder.bladeengine.ui.MenuScreen.java
License:Apache License
@Override public void show() { int wWidth = EngineAssetManager.getInstance().getResolution().portraitWidth; int wHeight = EngineAssetManager.getInstance().getResolution().portraitHeight; stage = new Stage(new ExtendViewport(wWidth, wHeight)); Table table = new Table(); table.setFillParent(true);/*from ww w . j a v a2 s .c om*/ table.center(); table.addListener(new InputListener() { @Override public boolean keyUp(InputEvent event, int keycode) { if (keycode == Input.Keys.ESCAPE || keycode == Input.Keys.BACK) ui.setScreen(State.SCENE_SCREEN); return true; } }); stage.setKeyboardFocus(table); ImageButton back = new ImageButton(new TextureRegionDrawable(ui.getUIAtlas().findRegion(BACK_COMMAND))); back.addListener(new ClickListener() { public void clicked(InputEvent event, float x, float y) { ui.setScreen(State.SCENE_SCREEN); } }); table.add(back).pad(MARGIN); ImageButton reload = new ImageButton(new TextureRegionDrawable(ui.getUIAtlas().findRegion(RELOAD_COMMAND))); reload.addListener(new ClickListener() { public void clicked(InputEvent event, float x, float y) { ui.setScreen(State.RESTART_SCREEN); } }); table.add(reload).pad(MARGIN); ImageButton help = new ImageButton(new TextureRegionDrawable(ui.getUIAtlas().findRegion(HELP_COMMAND))); help.addListener(new ClickListener() { public void clicked(InputEvent event, float x, float y) { ui.setScreen(State.HELP_SCREEN); } }); table.add(help).pad(MARGIN); ImageButton credits = new ImageButton( new TextureRegionDrawable(ui.getUIAtlas().findRegion(CREDITS_COMMAND))); credits.addListener(new ClickListener() { public void clicked(InputEvent event, float x, float y) { ui.setScreen(State.CREDIT_SCREEN); } }); table.add(credits).pad(MARGIN); ImageButton quit = new ImageButton(new TextureRegionDrawable(ui.getUIAtlas().findRegion(QUIT_COMMAND))); quit.addListener(new ClickListener() { public void clicked(InputEvent event, float x, float y) { Gdx.app.exit(); } }); table.add(quit).pad(MARGIN); table.pack(); stage.addActor(table); Gdx.input.setInputProcessor(stage); }
From source file:com.tumblr.oddlydrawn.nahlc.screens.SetupScreen.java
License:Apache License
public SetupScreen(Game g) { game = g;/*from w w w . ja v a2 s. c om*/ assets = new Assets(); stage = new Stage(new ExtendViewport(Renderer.WIDTH, Renderer.HEIGHT)); Gdx.input.setInputProcessor(stage); skin = new Skin(); assets.initSetupScreen(); table = new Table(); table.setFillParent(true); table.align(Align.left); stage.addActor(table); // Add default font to skin. skin.add("default", new BitmapFont(Gdx.files.internal(FONT_PATH))); // Create style for the level select checked and unchecked buttons with text (0-9). ImageTextButtonStyle imageTextButtonStyle = new ImageTextButtonStyle(); imageTextButtonStyle.checked = new TextureRegionDrawable(assets.getSelectedSprite()); imageTextButtonStyle.up = new TextureRegionDrawable(assets.getUnselectedSprite()); imageTextButtonStyle.font = skin.getFont("default"); skin.add("default", imageTextButtonStyle); // Create style for checkboxes with text beside them. CheckBoxStyle checkBoxStyle = new CheckBoxStyle(); checkBoxStyle.checkboxOff = new TextureRegionDrawable(assets.getUncheckedSprite()); checkBoxStyle.checkboxOn = new TextureRegionDrawable(assets.getCheckedSprite()); checkBoxStyle.font = skin.getFont("default"); skin.add("default", checkBoxStyle); // Create style for 9patch image button with text ("Start" button). TextButtonStyle textButtonStyle = new TextButtonStyle(); textButtonStyle.font = skin.getFont("default"); textButtonStyle.up = new NinePatchDrawable(assets.getBoxPatch()); skin.add("default", textButtonStyle); final CheckBox soundOnBox = new CheckBox(LABEL_SOUND, skin); table.add(soundOnBox); table.row(); final CheckBox musicOnBox = new CheckBox(LABEL_MUSIC, skin); table.add(musicOnBox); table.row(); final CheckBox upsideDownBox = new CheckBox(LABEL_UPSIDE, skin); table.add(upsideDownBox); table.row(); // Create an embedded table to have its own cells and not mess up parent. Table buttonsTable = new Table(); final ImageTextButton zero = new ImageTextButton("0", skin); buttonsTable.add(zero); final ImageTextButton one = new ImageTextButton("1", skin); buttonsTable.add(one); final ImageTextButton two = new ImageTextButton("2", skin); buttonsTable.add(two); final ImageTextButton three = new ImageTextButton("3", skin); buttonsTable.add(three); final ImageTextButton four = new ImageTextButton("4", skin); buttonsTable.add(four); buttonsTable.row(); final ImageTextButton five = new ImageTextButton("5", skin); buttonsTable.add(five); final ImageTextButton six = new ImageTextButton("6", skin); buttonsTable.add(six); final ImageTextButton seven = new ImageTextButton("7", skin); buttonsTable.add(seven); final ImageTextButton eight = new ImageTextButton("8", skin); buttonsTable.add(eight); final ImageTextButton nine = new ImageTextButton("9", skin); buttonsTable.add(nine); ButtonGroup groupButtons = new ButtonGroup(); groupButtons.add(zero); groupButtons.add(one); groupButtons.add(two); groupButtons.add(three); groupButtons.add(four); groupButtons.add(five); groupButtons.add(six); groupButtons.add(seven); groupButtons.add(eight); groupButtons.add(nine); groupButtons.setMaxCheckCount(1); // Awesome. groupButtons.uncheckAll(); zero.setChecked(true); LabelStyle labelStyle = new LabelStyle(); labelStyle.font = skin.getFont("default"); skin.add("default", labelStyle); Label levelLabel = new Label(LABEL_LEVEL, skin); table.add(levelLabel).padTop(PAD).align(Align.left); table.row(); table.add(buttonsTable).padBottom(PAD); table.row(); Label bagSize = new Label(LABEL_BAG_SIZE, skin); table.add(bagSize).align(Align.left); table.row(); // Create an embedded table to have its own cells and not mess up parent. Table bagTable = new Table(); final ImageTextButton sizeRandom = new ImageTextButton("Rnd", skin); bagTable.add(sizeRandom); final ImageTextButton sizeSeven = new ImageTextButton("7", skin); bagTable.add(sizeSeven); final ImageTextButton sizeFourteen = new ImageTextButton("14", skin); bagTable.add(sizeFourteen); final ImageTextButton sizeTwentyOne = new ImageTextButton("21", skin); bagTable.add(sizeTwentyOne); table.add(bagTable); table.row(); ButtonGroup bagButtons = new ButtonGroup(); bagButtons.add(sizeRandom); bagButtons.add(sizeSeven); bagButtons.add(sizeFourteen); bagButtons.add(sizeTwentyOne); bagButtons.setMaxCheckCount(1); bagButtons.uncheckAll(); sizeSeven.setChecked(true); TextButton startButton = new TextButton(LABEL_START, skin); table.add(startButton).padTop(PAD); table.debugTable(); // Load preferences SavedStuff savedStuff = new SavedStuff(); savedStuff.loadPreferences(); soundOn = savedStuff.isSoundOn(); musicOn = savedStuff.isMusicOn(); upsideDown = savedStuff.isUpsideDown(); // Set loaded preferences soundOnBox.setChecked(soundOn); musicOnBox.setChecked(musicOn); upsideDownBox.setChecked(upsideDown); startButton.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { boolean sound; boolean music; boolean upside; int bag = 0; int level = 0; // Get selected starting level. if (zero.isChecked()) { level = 0; } else if (one.isChecked()) { level = 1; } else if (two.isChecked()) { level = 2; } else if (three.isChecked()) { level = 3; } else if (four.isChecked()) { level = 4; } else if (five.isChecked()) { level = 5; } else if (six.isChecked()) { level = 6; } else if (seven.isChecked()) { level = 7; } else if (eight.isChecked()) { level = 8; } else if (nine.isChecked()) { level = 9; } // Get selected randomized shape bag size if (sizeRandom.isChecked()) { bag = 0; } else if (sizeSeven.isChecked()) { bag = 1; } else if (sizeFourteen.isChecked()) { bag = 2; } else if (sizeTwentyOne.isChecked()) { bag = 3; } sound = soundOnBox.isChecked(); music = musicOnBox.isChecked(); upside = upsideDownBox.isChecked(); // Save preferences. SavedStuff stuff = new SavedStuff(); stuff.saveAll(sound, music, upside, bag, level); dispose(); game.setScreen(new GameScreen(game)); } }); }
From source file:com.dongbat.game.screen.DynamicMenuScreen.java
public DynamicMenuScreen() { stage = new Stage(); InputUtil.addProcessor(stage, 0);/*from ww w .ja v a 2s . co m*/ stage.setViewport(new ExtendViewport(800, 480)); stage.getViewport().update(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false); buttonSinglePlayer = new ImageButton(new SpriteDrawable(new Sprite(AssetUtil.singleButton)), new SpriteDrawable(new Sprite(AssetUtil.pressedSingleButton))); buttonSinglePlayer.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { ScreenUtil.setScreen(new GameScreen()); } }); buttonSinglePlayer.setSize(270, 62); buttonSinglePlayer.setPosition(-135, -90); buttonMultiPlayer = new ImageButton(new SpriteDrawable(new Sprite(AssetUtil.multiButton))); buttonMultiPlayer.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { } }); buttonMultiPlayer.setDisabled(true); buttonMultiPlayer.setSize(270, 62); buttonMultiPlayer.setPosition(-135, -180); title = new Image(new SpriteDrawable(new Sprite(AssetUtil.title))); title.setSize(230, 100); title.setPosition(-115, 60); stage.addActor(title); stage.addActor(buttonSinglePlayer); stage.addActor(buttonMultiPlayer); WorldConfiguration config = new WorldConfiguration(); config.setSystem(new Box2dSystem(2), false); config.setSystem(new AiControlledSystem(5), false); config.setSystem(new BuffSystem(), false); config.setSystem(new DetectionCleanupSystem(1), false); config.setSystem(new DetectionSystem(1), false); config.setSystem(new ConsumingSystem(), false); config.setSystem(new InputProcessorSystem(), false); config.setSystem(new MovementSystem(), false); config.setSystem(new SpriteRenderSystem(), true); config.setSystem(new GridRendererSystem(), true); config.setSystem(new ParallaxBackgroundSystem(), true); config.setSystem(new DisplayUpdateSystem(), true); config.setSystem(new FoodAnimationSystem(), true); config.setSystem(new AnimationRenderSystem(), true); // config.setSystem(new Shaperenderer1(), true); config.setManager(new UuidEntityManager()); world = new World(config); UnitRegistry.load(); BuffRegistry.load(); AbilityRegistry.load(); ECSUtil.init(world); worldProgress = new WorldProgress(0.015f); worldProgressMap.put(world, worldProgress); world.getSystem(DetectionSystem.class).setModifier(3); PhysicsUtil.init(world); PhysicsCameraUtil.getCamera().zoom = 5; PhysicsCameraUtil.getCamera().position.set(new Vector2(80, -70), 0); PhysicsCameraUtil.getCamera().update(); Entity queen = UnitFactory.createQueen(world, new Vector2(100, -80), 8); BuffComponent queenBuff = EntityUtil.getComponent(world, queen, BuffComponent.class); queenBuff.getBuffs().remove("QueenTeleportSchedule"); queenBuff.getBuffs().remove("SelfDefense"); queenBuff.getBuffs().remove("FeedSmaller"); queenBuff.getBuffs().remove("ProduceFoodSchedule"); BuffUtil.addBuff(world, queen, queen, "SelfDefense", -1, 1, "framePerFood", 15); UnitMovement queenMove = EntityUtil.getComponent(world, queen, UnitMovement.class); queenMove.setDirectionVelocity(new Vector2()); // PhysicsUtil.setPosition(world, queen, new Vector2(500, -500)); Entity createUnit = UnitFactory.createUnit(world, "bao", new Vector2(0, 30)); PhysicsUtil.setRadius(world, createUnit, 1); UnitFactory.createUnit(world, "bao", new Vector2(10, 30)); UnitFactory.createUnit(world, "bao", new Vector2(100, 100)); UnitFactory.createUnit(world, "bao", new Vector2(50, -40)); // UnitFactory.createUnit(world, "bao", new Vector2(30, 30)); // UnitFactory.createUnit(world, "bao", new Vector2(0, -30)); // UnitFactory.createUnit(world, "bao", new Vector2(-10, -30)); // UnitFactory.createUnit(world, "bao", new Vector2(-20, -30)); }
From source file:com.dongbat.game.screen.MenuScreen.java
public MenuScreen() { AdUtil.showAd();/*from ww w .ja v a2 s. c o m*/ stage = new Stage(); InputUtil.addProcessor(stage, 0); stage.setViewport(new ExtendViewport(800, 480)); stage.getViewport().update(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false); buttonSinglePlayer = new ImageButton(new SpriteDrawable(new Sprite(AssetUtil.singleButton)), new SpriteDrawable(new Sprite(AssetUtil.pressedSingleButton))); buttonSinglePlayer.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { ScreenUtil.setScreen(new GameScreen()); } }); buttonSinglePlayer.setSize(270, 62); buttonSinglePlayer.setPosition(-135, -50); buttonMultiPlayer = new ImageButton(new SpriteDrawable(new Sprite(AssetUtil.multiButton))); buttonMultiPlayer.setDisabled(true); buttonMultiPlayer.setSize(270, 62); buttonMultiPlayer.setPosition(-135, -130); buttonStory = new ImageButton(new SpriteDrawable(new Sprite(AssetUtil.storyButton))); buttonStory.setDisabled(true); buttonStory.setSize(270, 62); buttonStory.setPosition(-135, -210); title = new Image(new SpriteDrawable(new Sprite(AssetUtil.title))); title.setSize(230, 100); title.setPosition(-115, 60); stage.addActor(title); stage.addActor(buttonSinglePlayer); stage.addActor(buttonMultiPlayer); stage.addActor(buttonStory); WorldConfiguration config = new WorldConfiguration(); config.setSystem(new Box2dSystem(2), false); config.setSystem(new AiControlledSystem(5), false); config.setSystem(new BuffSystem(), false); config.setSystem(new DetectionCleanupSystem(1), false); config.setSystem(new DetectionSystem(1), false); config.setSystem(new ConsumingSystem(), false); config.setSystem(new InputProcessorSystem(), false); config.setSystem(new MovementSystem(), false); config.setSystem(new GridRendererSystem(), true); config.setSystem(new ParallaxBackgroundSystem(), true); config.setSystem(new DisplayUpdateSystem(), true); config.setSystem(new FoodAnimationSystem(), true); config.setSystem(new AnimationRenderSystem(), true); // config.setSystem(new Shaperenderer1(), true); config.setManager(new UuidEntityManager()); world = new World(config); UnitRegistry.load(); BuffRegistry.load(); AbilityRegistry.load(); ECSUtil.init(world); worldProgress = new WorldProgress(0.015f); worldProgressMap.put(world, worldProgress); world.getSystem(DetectionSystem.class).setModifier(3); PhysicsUtil.init(world); PhysicsCameraUtil.getCamera().zoom = 5; PhysicsCameraUtil.getCamera().position.set(new Vector2(80, -70), 0); PhysicsCameraUtil.getCamera().update(); Entity queen = UnitFactory.createQueen(world, new Vector2(100, -80), 15); BuffComponent queenBuff = EntityUtil.getComponent(world, queen, BuffComponent.class); queenBuff.getBuffs().remove("QueenTeleportSchedule"); queenBuff.getBuffs().remove("SelfDefense"); queenBuff.getBuffs().remove("FeedSmaller"); queenBuff.getBuffs().remove("ProduceFoodSchedule"); queenBuff.getBuffs().remove("QueenGrowth"); BuffUtil.addBuff(world, queen, queen, "SelfDefense", -1, 1, "framePerFood", 15); UnitMovement queenMove = EntityUtil.getComponent(world, queen, UnitMovement.class); queenMove.setDirectionVelocity(new Vector2()); // PhysicsUtil.setPosition(world, queen, new Vector2(500, -500)); Entity createUnit = UnitFactory.createUnit(world, "bao", new Vector2(0, 30)); PhysicsUtil.setRadius(world, createUnit, 1); UnitFactory.createUnit(world, "bao", new Vector2(10, 30)); UnitFactory.createUnit(world, "bao", new Vector2(100, 100)); UnitFactory.createUnit(world, "bao", new Vector2(50, -40)); // UnitFactory.createUnit(world, "bao", new Vector2(30, 30)); // UnitFactory.createUnit(world, "bao", new Vector2(0, -30)); // UnitFactory.createUnit(world, "bao", new Vector2(-10, -30)); // UnitFactory.createUnit(world, "bao", new Vector2(-20, -30)); }
From source file:com.ladinc.core.screens.GameScreenLobby.java
License:Creative Commons License
public GameScreenLobby(McpCah g) { this.game = g; initializeFont();// w w w .j ava2 s.c o m this.screenWidth = 1920; this.screenHeight = 1080; //spriteBatch = new SpriteBatch(); this.camera = new OrthographicCamera(); this.camera.setToOrtho(false, this.screenWidth, screenHeight); this.bg = this.game.backgorund; stage = new Stage(new ExtendViewport(screenWidth, screenHeight)); spriteBatch = (SpriteBatch) stage.getBatch(); buttomPressedDrawable = new TextureRegionDrawable( new TextureRegion(new Texture(Gdx.files.internal("buttons/pressed.png")))); buttomDrawable = new TextureRegionDrawable( new TextureRegion(new Texture(Gdx.files.internal("buttons/raised.png")))); credits = new TextureRegionDrawable(new TextureRegion(new Texture(Gdx.files.internal("credits.png")))); creditsSprite = new Sprite(new Texture(Gdx.files.internal("credits.png"))); }