List of usage examples for com.badlogic.gdx.graphics.glutils ShapeRenderer ShapeRenderer
public ShapeRenderer()
From source file:com.jmstudios.pointandhit.GameScreen.java
License:Open Source License
public GameScreen(final OneShotGame game) { this.game = game; this.scale = game.scale; batch = new SpriteBatch(); shapeRenderer = new ShapeRenderer(); scoreFont = new BitmapFont(Gdx.files.internal("fonts/deja_vu_sans_large.fnt")); scoreFont.setColor(Color.WHITE); scoreFont.getRegion().getTexture().setFilter(TextureFilter.Linear, TextureFilter.Linear); scoreFont.setScale(scale);/*from ww w. j a va2 s . c o m*/ heartTex = new Texture(Gdx.files.internal("heart.png")); screenSize = new Vector2(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); setupMenus(); // Set up multiplexers gameRunningMultiplexer = new InputMultiplexer(); gameRunningMultiplexer.addProcessor(gameRunningStage); gameRunningMultiplexer.addProcessor(this); gamePausedMultiplexer = new InputMultiplexer(); gamePausedMultiplexer.addProcessor(pauseStage); gamePausedMultiplexer.addProcessor(this); gameOverMultiplexer = new InputMultiplexer(); gameOverMultiplexer.addProcessor(gameOverStage); gameOverMultiplexer.addProcessor(this); }
From source file:com.jmstudios.pointandhit.TutorialScreen.java
License:Open Source License
public TutorialScreen(final OneShotGame game, boolean automatic) { this.game = game; this.automatic = automatic; this.scale = game.scale; batch = new SpriteBatch(); shapeRenderer = new ShapeRenderer(); screenSize = new Vector2(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); textFont = new BitmapFont(Gdx.files.internal("fonts/deja_vu_sans_medium.fnt")); textFont.setScale(scale);// w w w. j ava 2 s . co m infoLabelStyle = new Label.LabelStyle(textFont, Color.WHITE); tapToLabelStyle = new Label.LabelStyle(textFont, Color.LIGHT_GRAY); // Step 1 float padding = 50 * scale; step1Stage = new Stage(); step1Table = new Table(); step1Table.setFillParent(true); step1Table.align(Align.bottomLeft); step1TiltInfo = new Label(tiltInfo, infoLabelStyle); step1TiltInfo.setWrap(true); step1TiltInfo.setWidth(screenSize.x - padding * 2); step1TiltInfo.setAlignment(Align.center); step1TapInfo = new Label(tapInfo, infoLabelStyle); step1TapInfo.setWrap(true); step1TapInfo.setWidth(screenSize.x - padding * 2); step1TapInfo.setAlignment(Align.center); step1TapToContinue = new Label(tapToContinue, tapToLabelStyle); step1TapToContinue.setWrap(true); step1TapToContinue.setWidth(screenSize.x - padding * 2); step1TapToContinue.setAlignment(Align.center); step1Table.defaults().pad(padding); step1Table.add(step1TiltInfo).width(screenSize.x - padding * 2); step1Table.row(); step1Table.add(step1TapInfo).width(screenSize.x - padding * 2); step1Table.row(); step1Table.add(step1TapToContinue).width(screenSize.x - padding * 2); step1Stage.addActor(step1Table); // Step 2 step2Stage = new Stage(); step2Table = new Table(); step2Table.setFillParent(true); step2Table.align(Align.bottomLeft); step2ObjectiveInfo = new Label(objectiveInfo, infoLabelStyle); step2ObjectiveInfo.setWrap(true); step2ObjectiveInfo.setWidth(screenSize.x - padding * 2); step2ObjectiveInfo.setAlignment(Align.center); step2ShootToContinue = new Label(shootToContinueInfo, tapToLabelStyle); step2ShootToContinue.setWrap(true); step2ShootToContinue.setWidth(screenSize.x - padding * 2); step2ShootToContinue.setAlignment(Align.center); step2Table.defaults().pad(padding); step2Table.add(step2ObjectiveInfo).width(screenSize.x - padding * 2); step2Table.row(); step2Table.add(step2ShootToContinue).width(screenSize.x - padding * 2); step2Stage.addActor(step2Table); // Done doneStage = new Stage(); doneTable = new Table(); doneTable.setFillParent(true); doneTable.align(Align.left); doneEndMessage = new Label(endMessage, infoLabelStyle); doneEndMessage.setWrap(true); doneEndMessage.setWidth(screenSize.x - padding * 2); doneEndMessage.setAlignment(Align.center); if (automatic) { tapToPlay = "Tap to finish..."; } doneTapToInfo = new Label(tapToPlay, tapToLabelStyle); doneTapToInfo.setWrap(true); doneTapToInfo.setWidth(screenSize.x - padding * 2); doneTapToInfo.setAlignment(Align.center); doneTable.defaults().pad(padding); doneTable.add(doneEndMessage).width(screenSize.x - padding * 2); doneTable.row(); doneTable.add(doneTapToInfo).width(screenSize.x - padding * 2); doneStage.addActor(doneTable); }
From source file:com.johnogel.astrobros.managers.GameManager.java
public GameManager(SuperManager mngr) { this.mngr = mngr; this.fps = 1 / 48f; max_count = 50;/*from w ww . j a v a2 s .co m*/ alpha = 1; delta = .001f; game_objects = new Array(); levels = new Array(6); controllers = new Array(10); texture_handler = mngr.getTextureHandler(); batch = new SpriteBatch(100); shape_renderer = new ShapeRenderer(); started = false; width = Gdx.graphics.getWidth() / 5; height = Gdx.graphics.getHeight() / 5; level = this.LEVEL_ONE; total_score = 0; lives = 3; }
From source file:com.johnogel.astrobros.managers.GameManager.java
@Override public void initialize() { shape_renderer.dispose();//w ww .ja v a 2 s. c om shape_renderer = new ShapeRenderer(); mngr.initializeWorld(); this.camera = mngr.getCamera(); this.camera.position.set(width * .5f, height * .5f, 0); this.camera.update(); this.ray_handler = mngr.getRayHandler(); this.world = mngr.getWorld(); levels.clear(); controllers.clear(); levels.add(new LevelOne(this, 60)); levels.add(new LevelTwo(this, 60)); levels.add(new LevelThree(this, 60)); levels.add(new BonusLevel(this, 60)); top_score = 0; total_score = 0; controllers.add(levels.get(0)); controllers.add(levels.get(1)); controllers.add(levels.get(2)); controllers.add(levels.get(3)); controllers.add(new GameOverScreen(this)); controllers.add(new LevelWinScreen(this)); controllers.add(new LevelLossScreen(this)); controllers.add(new GameEndScreen(this)); controllers.add(new AwardScreen(this)); controllers.add(new BonusAwardScreen(this)); //this.setLevel(level); renderer = new Box2DDebugRenderer(); logger = new FPSLogger(); this.clearGameObjects(); //game_objects.add(player); ray_handler.setCombinedMatrix(camera); //ray_handler.setCulling(true); ray_handler.setBlur(true); //ray_handler.setLightMapRendering(false); ray_handler.setShadows(true); ray_handler.setAmbientLight(1, 1, 1, .6f); level = LEVEL_ONE; //controller_index = level; controller = controllers.get(level); controller.initialize(); levels.get(level).initializeGameObjects(); levels.get(level).update(); //this.setLevel(level); lives = 3; }
From source file:com.johnogel.astrobros.managers.OpeningManager.java
public OpeningManager(SuperManager mngr) { this.mngr = mngr; alpha = 0;/*from w ww .j a v a2 s . com*/ texture_index = 0; lights = new Array(); font = new BitmapFont(); batch = new SpriteBatch(); this.title_width = 160; this.title_height = 50; this.space_width = 120; this.space_height = 35; this.loading_width = 80; this.loading_height = 25; textures = new Array(); shape_renderer = new ShapeRenderer(); //music = mngr.getSoundPlayer(); }
From source file:com.johnogel.astrobros.managers.SuperManager.java
public SuperManager() { lights = new Array(); managers = new Array(); closing = false;/* ww w . j av a 2s . c o m*/ asset_manager = new AssetManager(); transitioning = false; /*this.world = world; this.camera = camera; this.ray_handler = ray_handler; */ texture_handler = new TextureHandler(this); alpha = 0f; //music = Gdx.audio.newMusic(Gdx.files.internal(TITLE_SONG)); sound_player = new SoundPlayer(); sound_player.initialize(); managers.add(new MenuManager(this)); managers.add(new GameManager(this)); managers.add(new OpeningManager(this)); //initialize(); shape_renderer = new ShapeRenderer(); fading_in = false; fading_out = false; super_controller_changed = false; }
From source file:com.johnogel.iceqube.GameManager.java
public GameManager() { sr = new ShapeRenderer(); //create Box2D world for physics and stuff world = new World(new Vector2(0, -98f), true); sprite_manager = new SpriteManager(world); player = new Player(250, "cube/cube", Player.PNG, 100, 400); game_objects = new ArrayList(); game_objects.add(player);//w ww .java 2 s .c om sprite_manager.addSprite(player); input_listener = new InputListener(); input_listener.registerObserver((Observer) game_objects.get(0)); }
From source file:com.kotcrab.vis.editor.module.scene.RendererModule.java
License:Apache License
@Override public void added() { shapeRenderer = new ShapeRenderer(); }
From source file:com.laex.cg2d.entityeditor.pages.ExternalAnimationPreview.java
License:Open Source License
@Override public void create() { super.create(); this.shapeRenderer = new ShapeRenderer(); Texture.setEnforcePotImages(false);/* ww w . java 2 s. c om*/ batch = new SpriteBatch(); w = Gdx.graphics.getWidth(); h = Gdx.graphics.getHeight(); cam = new OrthographicCamera(w, h); cam.position.set(0, 0, 0); CGEntityAnimation anim = null; FileInputStream fis; try { fis = new FileInputStream(cgeFile); CGEntity entity = CGEntity.parseFrom(fis); for (CGEntityAnimation ea : entity.getAnimationsList()) { if (ea.getAnimationName().equals(animationName)) { anim = ea; } } } catch (FileNotFoundException e) { } catch (IOException e) { } if (anim == null) { return; } FileHandle handle = Gdx.files.absolute(anim.getSpritesheetFile().getResourceFileAbsolute()); if (!handle.exists()) { return; } Texture tex = new Texture(handle); tex.setFilter(TextureFilter.Linear, TextureFilter.Linear); Array<TextureRegion> indexedFrames = new Array<TextureRegion>(); for (CGEntitySpritesheetItem esi : anim.getSpritesheetItemsList()) { CGBounds b = esi.getExtractBounds(); TextureRegion tr = new TextureRegion(tex, (int) b.getX(), (int) b.getY(), (int) b.getWidth(), (int) b.getHeight()); indexedFrames.add(tr); } Animation sa = new Animation(anim.getAnimationDuration(), indexedFrames); spriteAnimation = Optional.fromNullable(sa); spr = new Sprite(sa.getKeyFrame(stateTime, true)); }
From source file:com.luongbui.gdx.libpd.pianotest.character.PianoKey.java
License:Apache License
public PianoKey(float x, float y, float width, float height, float hertz, final PianoTest game) { renderer = new ShapeRenderer(); isPressed = false;// w ww .ja v a 2 s. com isLight = true; this.hertz = hertz; this.game = game; final PianoKey thisPtr = this; setBounds(x, y, width, height); addListener(new InputListener() { @Override public void enter(InputEvent event, float x, float y, int pointer, Actor fromActor) { isPressed = true; game.getAudioEngine().sendBang("stop"); game.getAudioEngine().sendFloat("freq", thisPtr.getHertz()); game.getAudioEngine().sendBang("trig"); } @Override public void exit(InputEvent event, float x, float y, int pointer, Actor fromActor) { isPressed = false; } }); }