List of usage examples for com.badlogic.gdx.graphics.glutils ShapeRenderer ShapeRenderer
public ShapeRenderer()
From source file:com.lv99.board_games.domino.DominoGame.java
@Override public void create() { renderer = new ShapeRenderer(); batch = new SpriteBatch(); screenHeight = Gdx.graphics.getHeight(); scrrenwidth = Gdx.graphics.getWidth(); numberOfStarts = (int) (scrrenwidth * screenHeight * starDensity); startingWidth = Gdx.graphics.getWidth(); startingHeight = Gdx.graphics.getHeight(); // fillStars(); }
From source file:com.mbrlabs.mundus.core.Mundus.java
License:Apache License
/** * Loads & initializes everything./*from ww w . j a v a2 s.co m*/ * * This includes editor specific resources but also project specific * resources (see ProjectContext). * */ public static void init() { File homeDir = new File(Registry.HOME_DIR); if (!homeDir.exists()) { homeDir.mkdir(); } initStyle(); initFontAwesome(); shapeRenderer = new ShapeRenderer(); modelBatch = new ModelBatch(); shaders = new Shaders(); input = new InputManager(); goPicker = new GameObjectPicker(); handlePicker = new ToolHandlePicker(); eventBus = new EventBus(); kryoManager = new KryoManager(); registry = kryoManager.loadRegistry(); freeCamController = new FreeCamController(); commandHistory = new CommandHistory(CommandHistory.DEFAULT_LIMIT); modelImporter = new ModelImporter(registry); projectManager = new ProjectManager(kryoManager, registry, shaders); toolManager = new ToolManager(input, projectManager, goPicker, handlePicker, modelBatch, shaders, shapeRenderer, commandHistory); shortcutController = new ShortcutController(registry, projectManager, commandHistory); }
From source file:com.me.mygdxgame.Entities.MydebugRenderer.java
License:Apache License
public MydebugRenderer(boolean drawBodies, boolean drawJoints, boolean drawAABBs, boolean drawInactiveBodies, boolean drawVelocities, boolean drawContacts) { // next we setup the immediate mode renderer renderer = new ShapeRenderer(); // initialize vertices array for (int i = 0; i < vertices.length; i++) vertices[i] = new Vector2(); this.drawBodies = drawBodies; this.drawJoints = drawJoints; this.drawAABBs = drawAABBs; this.drawInactiveBodies = drawInactiveBodies; this.drawVelocities = drawVelocities; this.drawContacts = drawContacts; }
From source file:com.minekrash.game.Plataforma.java
public Plataforma(Texture _imagen) { resetY = -(HEIGHT / 2) - _imagen.getHeight(); //Posicin inicial de las plataformas al salir limitY = HEIGHT; //Mxima altura de la plataforma. Al cruzarla se inactiva isAlive = false;//w ww. j a va2s. c om plataforma = new Sprite(_imagen); float scalaX2 = _imagen.getWidth() * ESCALA_METROS; float scalaY2 = _imagen.getHeight() * ESCALA_METROS; plataforma.setSize(scalaX2, scalaY2); plataforma.setOriginCenter(); initPlataforma(); plataforma.setBounds(x, y, scalaX2, scalaY2); makeRandomPosition(); debug = new ShapeRenderer(); }
From source file:com.minekrash.game.Vagon.java
public Vagon() { Texture textureTemp = new Texture("gfx/vagon.png"); textureTemp.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear); TextureRegion[][] textureRegionTemp = TextureRegion.split(textureTemp, textureTemp.getWidth() / 2, textureTemp.getHeight());//from www . ja va 2 s . com vagonAllFrames = new TextureRegion[2]; vagonAllFrames[0] = textureRegionTemp[0][0]; vagonAllFrames[1] = textureRegionTemp[0][1]; vagonAnim = new Animation(0f, vagonAllFrames); //Velocidad e imagen vagonSprite = new Sprite(vagonAllFrames[0]); float scalaX = vagonAllFrames[0].getRegionWidth() * ESCALA_METROS; float scalaY = vagonAllFrames[0].getRegionHeight() * ESCALA_METROS; vagonSprite.setSize(scalaX, scalaY); vagonSprite.setOriginCenter(); initVagon(); vagonSprite.setBounds(vagonX, vagonY, scalaX, scalaY); debug = new ShapeRenderer(); humo = new Humo[10]; imagenHumo = new Texture("gfx/humo.png"); imagenHumo.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear); for (int i = 0; i < humo.length; i++) { humo[i] = new Humo(imagenHumo); } nextHumo = 0; }
From source file:com.mrlamont.Model.TitleScreen.java
public void render(float delta) { camera = new OrthographicCamera(); viewport = new FitViewport(V_WIDTH, V_HEIGHT, camera); batch = new SpriteBatch(); // clear the screen with black Gdx.gl20.glClearColor(0, 0, 0, 1);//from w ww. j a v a 2 s .c o m Gdx.gl20.glClear(GL20.GL_COLOR_BUFFER_BIT); g = new ShapeRenderer(); batch = new SpriteBatch(); g.begin(ShapeRenderer.ShapeType.Filled); g.setColor(Color.PURPLE); g.rect(550, 0, 110, 600); g.setColor(Color.BLUE); g.rect(440, 0, 110, 600); g.setColor(Color.GREEN); g.rect(330, 0, 110, 600); g.setColor(Color.YELLOW); g.rect(220, 0, 110, 600); g.setColor(Color.ORANGE); g.rect(110, 0, 110, 600); g.setColor(Color.RED); g.rect(0, 0, 110, 600); g.end(); //draw different coloured Wheelys on screen batch.begin(); batch.draw(AssetManager.wheelyYellow, 190, -1); batch.draw(AssetManager.wheelyOrange, 90, -1); batch.draw(AssetManager.wheelyRed, -14, -1); batch.draw(AssetManager.wheelyGreenL, 320, -1); batch.draw(AssetManager.wheelyBlueL, 420, -1); batch.draw(AssetManager.wheelyPurpleL, 520, -1); batch.end(); //If a certain colour is left clicked, that colouro of Wheely is selected if (Gdx.input.isButtonPressed(Input.Buttons.LEFT)) { Vector3 mouseClick = new Vector3(Gdx.input.getX(), Gdx.input.getY(), 0); camera.unproject(mouseClick); System.out.println("x: " + mouseClick.x + " y: " + mouseClick.y); //Red if (mouseClick.y >= -1 && mouseClick.y <= 0.991 && mouseClick.x >= -1 && mouseClick.x <= -0.6625) { red = true; } //Green if (mouseClick.y >= -1 && mouseClick.y <= 1 && mouseClick.x >= 0.034374952 && mouseClick.x <= 0.36874998) { green = true; } //Orange if (mouseClick.y >= -1 && mouseClick.y <= 1 && mouseClick.x >= -0.653125 && mouseClick.x <= -0.32187498) { orange = true; } //Yellow if (mouseClick.y >= -1 && mouseClick.y <= 1 && mouseClick.x >= -0.309375 && mouseClick.x <= 0.024999976) { yellow = true; } //Blue if (mouseClick.y >= -1 && mouseClick.y <= 1 && mouseClick.x >= 0.37812495 && mouseClick.x <= 0.7125) { blue = true; } //Purple if (mouseClick.y >= -1 && mouseClick.y <= 1 && mouseClick.x >= 0.71875 && mouseClick.x <= 0.99375) { purple = true; } } }
From source file:com.mygdx.g3il.screens.MainMenuScreen.java
License:Apache License
@Override public void draw(float delta) { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); camera.update();//www . j av a2 s. c om ShapeRenderer shapeRenderer = new ShapeRenderer(); shapeRenderer.setProjectionMatrix(camera.combined); shapeRenderer.begin(ShapeRenderer.ShapeType.Line); shapeRenderer.setColor(1, 1, 0, 1); shapeRenderer.rect(playBounds.x, playBounds.y, playBounds.getWidth(), playBounds.getHeight()); shapeRenderer.rect(highscoresBounds.x, highscoresBounds.y, highscoresBounds.getWidth(), highscoresBounds.getHeight()); shapeRenderer.end(); game.batch.setProjectionMatrix(camera.combined); game.batch.setColor(Color.WHITE); game.batch.begin(); game.batch.disableBlending(); game.batch.draw(background, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); game.batch.end(); game.batch.enableBlending(); game.batch.begin(); final Vector2 position = new Vector2(); drawText("Play", playBounds.getCenter(position)); drawText("High Scores", highscoresBounds.getCenter(position)); //drawText("Help", helpBounds.getCenter(position)); game.batch.end(); }
From source file:com.mygdx.game.gameword.touchme.TouchMeRenderer.java
public TouchMeRenderer(TouchMe gameWorld) { super(gameWorld); shapeRenderer = new ShapeRenderer(); }
From source file:com.mygdx.game.HideAndSeek.HideAndSeekScreen.java
public HideAndSeekScreen(AI_Bundle has) { this.has = has; this.camera = new OrthographicCamera(); this.shapeRenderer = new ShapeRenderer(); camera.setToOrtho(false, has.WIDTH, has.HEIGHT); hiders = new ArrayList<Hider>(); hiders.add(new Hider(has.WIDTH / 4, has.HEIGHT / 4)); seeker = new Seeker(has.WIDTH / 2, has.HEIGHT / 2); }
From source file:com.mygdx.game.LoadingGameScreen.java
License:Apache License
@Override public void show() { camera = new OrthographicCamera(); camera.position.set(GdxDemo3D.WIDTH * .5f, GdxDemo3D.HEIGHT * .5f, 0); camera.update();/*from w ww . j a va 2 s.c o m*/ viewport = new FitViewport(GdxDemo3D.WIDTH, GdxDemo3D.HEIGHT, camera); shapeRenderer = new ShapeRenderer(); }