List of usage examples for com.badlogic.gdx.graphics.glutils ShapeRenderer ShapeRenderer
public ShapeRenderer()
From source file:dk.sidereal.lumm.architecture.LummSceneLayer.java
License:Apache License
/** * Common initialisation code between the two constructors of * {@link LummSceneLayer}, initialising variables in the scene. * <p>//from w ww.j a va 2 s .c om * If the scene or the batch name are null, a {@link GdxRuntimeException} is * thrown. * * @param scene * The scene in which to add the game batch. * @param name * name of the gameBatch, used for retrieval of Batch using * {@link LummScene#getSceneLayer(String)}. */ private final void initialiseBatch(LummScene scene, String name) { if (scene == null) throw new GdxRuntimeException("GameScene parameter passed to GameBatch is null"); if (name == null) throw new GdxRuntimeException("String parameter passed to GameBatch is null"); this.scene = scene; this.name = name; this.shapeRenderer = new ShapeRenderer(); this.shapeRenderer.setAutoShapeType(true); this.spriteBatch = new SpriteBatch(); this.objects = new ArrayList<LummObject>(); this.priorityLevel = 0; this.sort = true; setSort(true, defaultComparator); }
From source file:es.eucm.ead.editor.control.Controller.java
License:Open Source License
public Controller(Platform platform, Files files, Group viewsContainer, Group modalsContainer) { this.shapeRenderer = new ShapeRenderer(); this.platform = platform; this.applicationAssets = createApplicationAssets(files); this.editorGameAssets = new EditorGameAssets(files, platform.getImageUtils()); this.templates = new Templates(this); this.model = new Model(editorGameAssets); this.commands = new Commands(model); this.views = createViews(viewsContainer, modalsContainer); this.clipboard = new Clipboard(Gdx.app.getClipboard(), this, editorGameAssets); this.actions = new Actions(this); this.backgroundExecutor = new BackgroundExecutor(); this.workerExecutor = new WorkerExecutor(this); this.downloadManager = new DownloadManager(this); this.libraryManager = new LibraryManager(this); this.preferences = applicationAssets.loadPreferences(); // Get the release info from editor assets this.releaseInfo = applicationAssets.loadReleaseInfo(); this.shortcutsMap = new ShortcutsMap(this); this.engine = new Engine(this); engine.init(buildEngineInitializer()); setTracker(viewsContainer, modalsContainer); setClipboard();//from ww w. jav a 2 s . co m loadPreferences(); indexes = new HashMap<Class, ControllerIndex>(); Q.setController(this); boolean firstRun = preferences.getBoolean(Preferences.FIRST_TIME_RUN, true); if (firstRun) { preferences.putBoolean(Preferences.FIRST_TIME_RUN, false); initFirstRun(); } }
From source file:es.eucm.ead.editor.utils.ShapeEditor.java
License:Open Source License
@Override public void create() { super.create(); executor = new AsyncExecutor(1); // prepare rendering aids shapeRenderer = new ShapeRenderer(); Gdx.input.setInputProcessor(this); }
From source file:es.eucm.ead.editor.utils.TexturedShapeEditor.java
License:Open Source License
@Override public void create() { super.create(); executor = new AsyncExecutor(1); // create a string of generally-overlapping polygons, will draw in // blue//ww w.ja v a 2 s. c o m GeoTester.randomPolys(3, 40, 80, new Vector2(100, 300), blue); float s = 10; Polygon p0 = new Polygon(new float[] { // north-west, low, north-east 0, 3 * s, 0, 2 * s, 2 * s, 0, 3 * s, 0, 4.5f * s, 2 * s, 6 * s, 0, 7 * s, 0, 9 * s, 2 * s, 9 * s, 3 * s, // north-east, high, north-west 8 * s, 3 * s, 6.5f * s, 1 * s, 5 * s, 3 * s, 4 * s, 3 * s, 2.5f * s, s, 1 * s, 3 * s }); blue.add(p0); // merge them into a single polygon, will draw in red for (Polygon bp : blue) { GeometryUtils.merge(geo, bp); } Geometry collapsed = GeometryUtils.collapse(geo); Polygon p = GeometryUtils.jtsCoordsToGdx(collapsed.getCoordinates()); red.add(p); triangles = GeometryUtils.triangulate(collapsed); Gdx.app.error("GeoTester", "ready to display triangles worth " + triangles.length + " vertices"); // use the polygon to clip a randomly-generated texture textureSolid = new Texture(GeoTester.randomPixmap(100, 100, null), false); PolygonRegion polyReg = new PolygonRegion(new TextureRegion(textureSolid), p.getVertices(), triangles); poly = new PolygonSprite(polyReg); poly.setOrigin(p.getVertices()[0], p.getVertices()[1]); polyBatch = new PolygonSpriteBatch(); // prepare rendering aids shapeRenderer = new ShapeRenderer(); Gdx.input.setInputProcessor(this); }
From source file:eu.asterics.component.actuator.ponggame.GameScreen.java
License:Open Source License
public GameScreen(AstericsPong game) { super(game);/*w ww . j a v a2 s . c om*/ // ballImage=loadImage("data/actuator.ponggame/ball.png"); // CRASHES // (?) if (useDebugRenderer) { camera = new OrthographicCamera(10, 8); camera.position.set(5, 4, 0); } else { camera = new OrthographicCamera(1000, 800); camera.position.set(500, 400, 0); } camera.update(); if (useDebugRenderer) { renderer = new Box2DDebugRenderer(); } else { shapeRenderer = new ShapeRenderer(); } }
From source file:eu.rubenrosado.inmisericordia.screens.PlayGame.java
License:Open Source License
public PlayGame(MainGame maingame) { super(maingame); Gdx.input.setInputProcessor(new GestureDetector(new PlayListener())); touch = new Vector3(); speed = new Vector2(); font = new BitmapFont(); renderer = new ShapeRenderer(); statusBar = new StatusBar(); bgTexture = maingame.manager.get("images/grassfloor.png"); bgTexture.setWrap(TextureWrap.Repeat, TextureWrap.Repeat); gameAtlas = maingame.manager.get("images/game.atlas"); dead = gameAtlas.findRegion("dead"); backbutton = gameAtlas.findRegion("back"); monsters = new ArrayList<Monster>(); mg = new MonstersManager(); lsg = new LSGame(); hits = new ArrayList<Hit>(); if (lsg.existsSavedGame()) { lsg.loadGame();/*from ww w . ja v a2s.com*/ } else { hero = new Hero(MainMenu.playerName); mg.manage(); } }
From source file:gameengine.GameEngine.java
@Override public void create() { world = new World(); netherworld = new Netherworld(); spriteBatch = new SpriteBatch(); gameData = new GameData(); animator = new AnimationHandler(); mapManager = new MapManager(); healthBarManager = new HealthBarManager(); AssetsJarFileResolver jfhr = new AssetsJarFileResolver(); assetManager = new AssetManager(jfhr); sr = new ShapeRenderer(); mapManager.loadMap(assetManager, gameData); Gdx.input.setInputProcessor(new GameInputProcessor(gameData)); renderer = new IsometricTiledMapRenderer(mapManager.getMap()); camera = new DotaCamera(); hudCamera = new OrthographicCamera(gameData.getDisplayWidth(), gameData.getDisplayHeight()); hudCamera.translate(gameData.getDisplayWidth() / 2, gameData.getDisplayHeight() / 2); hudCamera.update();//from w ww . ja v a 2 s . c o m entityPlugins = new CopyOnWriteArrayList<>(); gameData.setDisplayWidth(Gdx.graphics.getWidth()); gameData.setDisplayHeight(Gdx.graphics.getHeight()); camera.position.set(camera.viewportWidth, camera.viewportHeight, 0); gameData.setDisplayWidth(Gdx.graphics.getWidth()); gameData.setDisplayHeight(Gdx.graphics.getHeight()); camera.position.set(mapManager.getMapWidth() / 2, 0, 0); pluginResult = lookup.lookupResult(IGamePluginService.class); pluginResult.addLookupListener(lookupListener); pluginResult.allItems(); for (IGamePluginService plugin : pluginResult.allInstances()) { plugin.start(gameData, world); entityPlugins.add(plugin); } loadImages(); hud = new HUDManager(spriteBatch, gameData, world); gameData.setGameState(GameState.RUN); backgroundMusic = Gdx.audio.newMusic(Gdx.files.internal("assets/sounds/backgroundmusic.mp3")); backgroundMusic.setLooping(true); backgroundMusic.setVolume(0.5f); backgroundMusic.play(); // BACKGROUNDMUSIC_FINAL_PATH = GameEngine.class.getResource(BACKGROUNDMUSIC_PATH).getPath().replace("file:", ""); // ImageManager.createImage(BACKGROUNDMUSIC_FINAL_PATH, false); // backgroundMusic.loop(); }
From source file:GameWorld.Buffs.BuffsRenderer.java
public BuffsRenderer(BuffsWorld world) { super();//www . ja va 2 s . co m this.world = world; shapeRenderer = new ShapeRenderer(); shapeRenderer.setProjectionMatrix(cam.combined); }
From source file:GameWorld.Donate.DonateRenderer.java
public DonateRenderer(DonateWorld world, Interface ui) { super();//from w w w.j a va 2 s . c o m this.world = world; this.ui = ui; shapeRenderer = new ShapeRenderer(); shapeRenderer.setProjectionMatrix(cam.combined); }
From source file:GameWorld.Game.Debug.DebugRenderer.java
public DebugRenderer(DebugWorld world, Interface ui) { super();//from w w w . j av a 2 s .co m this.world = world; this.ui = ui; shapeRenderer = new ShapeRenderer(); shapeRenderer.setProjectionMatrix(cam.combined); }