List of usage examples for com.badlogic.gdx.graphics.glutils ShapeRenderer ShapeRenderer
public ShapeRenderer()
From source file:com.esotericsoftware.spine.Box2DExample.java
License:Open Source License
public void create() { batch = new SpriteBatch(); renderer = new ShapeRenderer(); skeletonRenderer = new SkeletonRenderer(); skeletonRenderer.setPremultipliedAlpha(true); atlas = new TextureAtlas(Gdx.files.internal("spineboy/spineboy.atlas")); // This loader creates Box2dAttachments instead of RegionAttachments for an easy way to keep // track of the Box2D body for each attachment. AtlasAttachmentLoader atlasLoader = new AtlasAttachmentLoader(atlas) { public RegionAttachment newRegionAttachment(Skin skin, String name, String path) { Box2dAttachment attachment = new Box2dAttachment(name); AtlasRegion region = atlas.findRegion(attachment.getName()); if (region == null) throw new RuntimeException("Region not found in atlas: " + attachment); attachment.setRegion(region); return attachment; }/*from w w w . ja va2 s. c o m*/ }; SkeletonJson json = new SkeletonJson(atlasLoader); json.setScale(0.6f * 0.05f); SkeletonData skeletonData = json.readSkeletonData(Gdx.files.internal("spineboy/spineboy.json")); animation = skeletonData.findAnimation("walk"); skeleton = new Skeleton(skeletonData); skeleton.x = -32; skeleton.y = 1; skeleton.updateWorldTransform(); // See Box2DTest in libgdx for more detailed information about Box2D setup. camera = new OrthographicCamera(48, 32); camera.position.set(0, 16, 0); box2dRenderer = new Box2DDebugRenderer(); createWorld(); // Create a body for each attachment. Note it is probably better to create just a few bodies rather than one for each // region attachment, but this is just an example. for (Slot slot : skeleton.getSlots()) { if (!(slot.getAttachment() instanceof Box2dAttachment)) continue; Box2dAttachment attachment = (Box2dAttachment) slot.getAttachment(); PolygonShape boxPoly = new PolygonShape(); boxPoly.setAsBox(attachment.getWidth() / 2 * attachment.getScaleX(), attachment.getHeight() / 2 * attachment.getScaleY(), vector.set(attachment.getX(), attachment.getY()), attachment.getRotation() * MathUtils.degRad); BodyDef boxBodyDef = new BodyDef(); boxBodyDef.type = BodyType.StaticBody; attachment.body = world.createBody(boxBodyDef); attachment.body.createFixture(boxPoly, 1); boxPoly.dispose(); } }
From source file:com.evoluzion.MenuInicio.java
License:Open Source License
public MenuInicio(Evoluzion ev) { this.ev = ev; tx = new Texto(); //m= new Mundo(ev,"",0,50,50,20,20,false); camara = new OrthographicCamera(); camara.setToOrtho(false, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); f2 = new File("evo_star.conf"); batch = new SpriteBatch(); fuente = new BitmapFont(); ta_atlas = new TextureAtlas("data/botones.pack");//carga el atlas de texturas donde estan los botones ta_atlas2 = new TextureAtlas("data/boxes.pack"); sk_skin = new Skin(); sk_skin.addRegions(ta_atlas);// w w w.j ava 2s .c o m sk_skin2 = new Skin(); sk_skin2.addRegions(ta_atlas2); fu_fuente = new BitmapFont(); //fu_titulo = new BitmapFont(Gdx.files.internal("data/fMensage.fnt"),false); // tx_titulo = new Texture("data/titulo.png"); // titulo = new Sprite(tx_titulo); // titulo.setSize(500,100); // titulo.setPosition(50,550); rectangulo = new ShapeRenderer(); a_ruta = new Archivar(); a_idioma = new Archivar(); leerRuta(); leerIdioma(); if (ingles == 1) { tx.setIngles(); } if (ingles == -1) { tx.setEspanol(); } controles(); //System.out.println("idioma "+ingles); leerMenuIncio(); }
From source file:com.evoluzion.Pantalla.java
License:Open Source License
public Pantalla(Evoluzion ev, Mundo m) { this.ev = ev; this.m = m;/*from w w w . ja va2s. c o m*/ tx = m.tx;//usamos la configuracionde taxto del menu inicio or = m.aorg.get(0); se = m.ase.get(0); qe = m.aqe.get(0); camara = new OrthographicCamera(); camara.setToOrtho(false, m.ancho, m.alto); batch = new SpriteBatch(); caja = new ShapeRenderer(); borde = new ShapeRenderer(); fuente = new BitmapFont(); ta_atlas = new TextureAtlas("data/botones.pack");//carga el atlas de texturas donde estan los botones ta_atlas2 = new TextureAtlas("data/boxes.pack"); sk_skin = new Skin(); sk_skin.addRegions(ta_atlas); sk_skin2 = new Skin(); sk_skin2.addRegions(ta_atlas2); fu_fuente = new BitmapFont(); //colecta los datos del tiempo 0 // m.archivarGenoma(); // m.archivarProteoma(); // m.guardarDatos(); }
From source file:com.gamemaker.gameworld.GameRenderer.java
License:Apache License
public GameRenderer(GameWorld world, int gameHeight) { myWorld = world;// ww w . j a v a 2 s. com this.gameHeight = gameHeight; cam = new OrthographicCamera(); cam.setToOrtho(true, 1280, 720); batcher = new SpriteBatch(); batcher.setProjectionMatrix(cam.combined); shapeRenderer = new ShapeRenderer(); shapeRenderer.setProjectionMatrix(cam.combined); //button restartButton_on = AssetLoader.restartBtn_on; restartButton_off = AssetLoader.restartBtn_off; restartBtn = new Button(530, 300, 150, 100, restartButton_on, restartButton_off); //watericon and hp icon water25 = AssetLoader.water25; water50 = AssetLoader.water50; water75 = AssetLoader.water75; water100 = AssetLoader.water100; HP25 = AssetLoader.HP25; HP50 = AssetLoader.HP50; HP75 = AssetLoader.HP75; HP100 = AssetLoader.HP100; //map mapStateBg = AssetLoader.mapStateBg; mapLine1 = AssetLoader.mapLine1; mapLine2 = AssetLoader.mapLine2; mapLine3 = AssetLoader.mapLine3; mapLine4 = AssetLoader.mapLine4; mapLine5 = AssetLoader.mapLine5; mapLine6 = AssetLoader.mapLine6; mapLine7 = AssetLoader.mapLine7; mapColor1 = AssetLoader.mapColor1; mapColor2 = AssetLoader.mapColor2; mapColor3 = AssetLoader.mapColor3; //background and waterhole bg1 = AssetLoader.bg1; bg2 = AssetLoader.bg2; bg3 = AssetLoader.bg3; bgFin1 = AssetLoader.bgFin1; bgFin2 = AssetLoader.bgFin2; bgFin3 = AssetLoader.bgFin3; bgFin4 = AssetLoader.bgFin4; wh = AssetLoader.waterhole; saltLakewh = AssetLoader.saltLakewh; //icons watericon = AssetLoader.watericon; HPicon = AssetLoader.HP; //items rockimage = AssetLoader.rock; digstick = AssetLoader.digstick; bushOnionImage = AssetLoader.bushOnion; billycanImage = AssetLoader.billyCan; cokeCanImage = AssetLoader.cokeCan; batteryImage = AssetLoader.battery; cigarettesImage = AssetLoader.cigarettes; meatpieImage = AssetLoader.meatpie; phoneImage = AssetLoader.phone; wheelBraceImage = AssetLoader.wheelBrace; grubsImage = AssetLoader.grubs; //obstacles tree_image = AssetLoader.obstacle_tree; antTrapImage = AssetLoader.antTrap; fallStoneImage = AssetLoader.fallStone; Bag = AssetLoader.backpack; //player frames playerAnimation1 = AssetLoader.playerAnimation1; playerAnimation2 = AssetLoader.playerAnimation2; idle = AssetLoader.idle; monsterAnimation = AssetLoader.monsterAnimation; scroller = world.getScroller(); background1 = scroller.getBackground1(); background2 = scroller.getBackground2(); background3 = scroller.getBackground3(); backgroundFin1 = scroller.getBackgroundFin1(); backgroundFin2 = scroller.getBackgroundFin2(); backgroundFin3 = scroller.getBackgroundFin3(); backgroundFin4 = scroller.getBackgroundFin4(); waterhole = scroller.getWaterhole(); player = world.getPlayer(); rock = scroller.getRock(); digStick = scroller.getDigStick(); bushOnion = scroller.getBushOnion(); billycan = scroller.getBillyCan(); cokecan = scroller.getCokeCan(); battery = scroller.getBattery(); cigarettes = scroller.getCigarettes(); meatpie = scroller.getMeatpie(); phone = scroller.getPhone(); wheelbrace = scroller.getWheelBrace(); grubs = scroller.getGrubs(); tree = scroller.getObstacle(); antTrap = new AntTrap[scroller.getAntAmount() + 1]; for (int i = 1; i <= scroller.getAntAmount(); i++) { antTrap[i] = scroller.getAntTrap(i); } fallStone = new FallStone[scroller.getStoneAmount() + 1]; for (int i = 1; i <= scroller.getStoneAmount(); i++) { fallStone[i] = scroller.getFallStone(i); } rabbit = new SmallAnimals[scroller.getRabbitAmount() + 1]; for (int i = 1; i <= scroller.getRabbitAmount(); i++) { rabbit[i] = scroller.getRabbit(i); } backpack = world.getBackpack(); //font font = new BitmapFont(Gdx.files.internal("font/numFont.fnt")); font.getData().setScale(1f, -1f); font2 = new BitmapFont(Gdx.files.internal("font/timerFont.fnt")); font2.getData().setScale(0.8f, -0.8f); font3 = new BitmapFont(Gdx.files.internal("font/timerFont.fnt")); font3.getData().setScale(1f, -1f); font4 = new BitmapFont(Gdx.files.internal("font/ComicSansMS.fnt")); font4.getData().setScale(1f, -1f); monster = AssetLoader.monster1; //monsterAnimation = AssetLoader.monsterAnimation; kingStand = AssetLoader.kingbrownStandAnimation; kingAnimation = AssetLoader.kingbrownAnimation; warnidle1Animation = AssetLoader.warnIdle1Animation; warnidle2Animation = AssetLoader.warnIdle2Animation; warnhelpAnimation = AssetLoader.warnHelpAnimation; warndismissAnimation = AssetLoader.warnDismissAnimation; warndimissStand = AssetLoader.wdismiss6; warnhelpStand = AssetLoader.whelp11; shadowAnimation = AssetLoader.shadowAnimation; warnStand = AssetLoader.warnampi1; warnAnimation = AssetLoader.warnampiAnimation; rabbAnimation = AssetLoader.rabbitAnimation; //phrases phrase1Active = AssetLoader.phrase1Active; phrase1Pressed = AssetLoader.phrase1Pressed; phrase2Active = AssetLoader.phrase2Active; phrase2Pressed = AssetLoader.phrase2Pressed; phrase3Active = AssetLoader.phrase3Active; phrase3Pressed = AssetLoader.phrase3Pressed; phrase4Active = AssetLoader.phrase4Active; phrase4Pressed = AssetLoader.phrase4Pressed; playerDeathFinal = AssetLoader.death3; playerDeath = AssetLoader.deathAnimation; shadowRuntime = new float[scroller.getStoneAmount() + 1]; for (int i = 1; i <= scroller.getStoneAmount(); i++) { shadowRuntime[i] = 0; } }
From source file:com.gamemaker.screens.AboutScreen.java
License:Apache License
public AboutScreen(Game game) { this.game = game; cam = new OrthographicCamera(); cam.setToOrtho(true, 1280, 720);/*w w w . j a v a2 s. c o m*/ batcher = new SpriteBatch(); batcher.setProjectionMatrix(cam.combined); shapeRenderer = new ShapeRenderer(); shapeRenderer.setProjectionMatrix(cam.combined); backBtn_on = AssetLoader.backBtn_on; backBtn_off = AssetLoader.backBtn_off; menuBG = AssetLoader.mapBg; // aboutText = AssetLoader.aboutText; font3 = new BitmapFont(Gdx.files.internal("font/numFont.fnt")); font3.getData().setScale(1f, -1f); backBtn = new Button(100, 100, 190, 190, backBtn_on, backBtn_off); }
From source file:com.gamemaker.screens.GameOverScreen.java
License:Apache License
public GameOverScreen(Game game) { this.game = game; cam = new OrthographicCamera(); cam.setToOrtho(true, 1280, 720);/*from w ww .j a va2 s .co m*/ batcher = new SpriteBatch(); batcher.setProjectionMatrix(cam.combined); shapeRenderer = new ShapeRenderer(); shapeRenderer.setProjectionMatrix(cam.combined); }
From source file:com.gamemaker.screens.HowtoplayScreen.java
License:Apache License
public HowtoplayScreen(Game game) { this.game = game; cam = new OrthographicCamera(); cam.setToOrtho(true, 1280, 720);/*from ww w . jav a2 s . c om*/ batcher = new SpriteBatch(); batcher.setProjectionMatrix(cam.combined); shapeRenderer = new ShapeRenderer(); shapeRenderer.setProjectionMatrix(cam.combined); mapBg = AssetLoader.mapBg; backBtn_on = AssetLoader.backBtn_on; backBtn_off = AssetLoader.backBtn_off; forwardBtn_on = AssetLoader.forwardBtn_on; forwardBtn_off = AssetLoader.forwardBtn_off; backBtn = new Button(50, 50, 150, 150, backBtn_on, backBtn_off); forwardBtn = new Button(50, 210, 150, 150, forwardBtn_on, forwardBtn_off); startButton_on = AssetLoader.startBtn_on; startButton_off = AssetLoader.startBtn_off; startBtn = new Button(50, 210, 150, 150, startButton_on, startButton_off); tutor_animation1 = AssetLoader.tutor_animation1; tutor_animation2 = AssetLoader.tutor_animation2; tutor_animation3 = AssetLoader.tutor_animation3; }
From source file:com.gamemaker.screens.IntroScreen.java
License:Apache License
public IntroScreen(Game game) { this.game = game; cam = new OrthographicCamera(); cam.setToOrtho(true, 1280, 720);//w w w .j a va 2 s.c om batcher = new SpriteBatch(); batcher.setProjectionMatrix(cam.combined); shapeRenderer = new ShapeRenderer(); shapeRenderer.setProjectionMatrix(cam.combined); introText = AssetLoader.introText; mapBg = AssetLoader.mapBg; }
From source file:com.gamemaker.screens.MenuScreen.java
License:Apache License
public MenuScreen(Game game) { this.game = game; cam = new OrthographicCamera(); cam.setToOrtho(true, 1280, 720);/*from w w w . ja v a2s . com*/ batcher = new SpriteBatch(); batcher.setProjectionMatrix(cam.combined); shapeRenderer = new ShapeRenderer(); shapeRenderer.setProjectionMatrix(cam.combined); menuBG = AssetLoader.mapBg; menuTitle1 = AssetLoader.textureMenuTitle1; menuTitle2 = AssetLoader.textureMenuTitle2; startButton_on = AssetLoader.startBtn_on; startButton_off = AssetLoader.startBtn_off; aboutButton_on = AssetLoader.aboutBtn_on; aboutButton_off = AssetLoader.aboutBtn_off; startBtn = new Button(400, 400, 150, 100, startButton_on, startButton_off); aboutBtn = new Button(700, 400, 150, 100, aboutButton_on, aboutButton_off); }
From source file:com.github.badoualy.badoualyve.ui.stage.IntroStage.java
License:Open Source License
private void initActors() { shapeRenderer = new ShapeRenderer(); shapeRenderer.setColor(0.8f, 0.8f, 0.8f, 1f); dialog = new Dialog(); dialog.setTitle("Login - Select your character name"); dialog.setPosition(getWidth() / 2 - dialog.getWidth() / 2, getHeight() / 2 - dialog.getHeight() / 2); addActor(dialog);/*from w w w .j a va 2 s .com*/ }