Java 类com.badlogic.gdx.graphics.g2d.SpriteBatch 实例源码

项目:nomoore    文件:ScreenGame.java   
private void drawSprite(SpriteBatch batch, Sprite sprite, int scene, Interactable interactable) {
    if (interactable.isConsumed()) {
        sprite.draw(batch);
        return;
    }
    Rectangle handle = null;
    if (dragsLeftHandle)
        handle = rectangleLeftHandle;
    if (dragsRightHandle)
        handle = rectangleRightHandle;
    if (handle == null)
        return;
    float percentage = (Math.min(sprite.getWidth(), Math.max(0, handle.x - sprite.getX())) / sprite.getWidth());
    boolean reverseDirection = (scene == 1 && dragsLeftHandle || scene == 2 && dragsRightHandle);
    if (reverseDirection) {
        percentage = 1 - percentage;
    }
    int visibleWidth = (int) (sprite.getWidth() * percentage);
    batch.draw(sprite.getTexture(), (reverseDirection ? sprite.getWidth() - visibleWidth : 0) + sprite.getX(), sprite.getY(), sprite.getWidth() / 2, sprite.getHeight() / 2, visibleWidth, sprite.getHeight(), sprite.getScaleX() * (interactable.isConsumable() ? scaleFactor : 1),
            sprite.getScaleY() * (interactable.isConsumable() ? scaleFactor : 1), 0, sprite.getRegionX(), sprite.getRegionY(), (int) (sprite.getRegionWidth() * percentage), sprite.getRegionHeight(), reverseDirection, false);
}
项目:Klooni1010    文件:ShareScoreScreen.java   
ShareScoreScreen(final Klooni game, final Screen lastScreen,
                 final int score, final boolean timeMode) {
    this.game = game;
    this.lastScreen = lastScreen;

    this.score = score;
    this.timeMode = timeMode;

    final Label.LabelStyle labelStyle = new Label.LabelStyle();
    labelStyle.font = game.skin.getFont("font_small");

    infoLabel = new Label("Generating image...", labelStyle);
    infoLabel.setColor(Klooni.theme.textColor);
    infoLabel.setAlignment(Align.center);
    infoLabel.layout();
    infoLabel.setPosition(
            (Gdx.graphics.getWidth() - infoLabel.getWidth()) * 0.5f,
            (Gdx.graphics.getHeight() - infoLabel.getHeight()) * 0.5f);

    spriteBatch = new SpriteBatch();
}
项目:Tower-Defense-Galaxy    文件:VRContext.java   
/**
 * Creates a new VRContext, initializes the VR system,
 * and sets up rendering surfaces.
 * 
 * @param renderTargetMultiplier multiplier to scale the render surface dimensions as a replacement for multisampling
 * @param hasStencil whether the rendering surfaces should have a stencil buffer
 * @throws {@link GdxRuntimeException} if the system could not be initialized 
 */
public VRContext(float renderTargetMultiplier, boolean hasStencil) {        
    int token = VR.VR_InitInternal(error, VR.EVRApplicationType_VRApplication_Scene);
    checkInitError(error);      
    OpenVR.create(token);

    VR.VR_GetGenericInterface(VR.IVRCompositor_Version, error);         
    checkInitError(error);

    VR.VR_GetGenericInterface(VR.IVRRenderModels_Version, error);
    checkInitError(error);

    for (int i = 0; i < devicePoses.length; i++) {
        devicePoses[i] = new VRDevicePose(i);
    }

    VRSystem.VRSystem_GetRecommendedRenderTargetSize(scratch, scratch2);
    int width = (int)(scratch.get(0) * renderTargetMultiplier);
    int height = (int)(scratch2.get(0) * renderTargetMultiplier);

    setupEye(Eye.Left, width, height, hasStencil);
    setupEye(Eye.Right, width, height, hasStencil);

    batcher = new SpriteBatch();
}
项目:CursedEcho    文件:Main.java   
@Override
public void create () {

    //initialize Asset Handler
    assetHandler = new AssetHandler();
    assets = new HashMap<String,Class<?>>();


    //load Game instance into GameUtils
    GameUtils.loadGame(this);

    //initialize Graphics
    batch = new SpriteBatch();

    //load starting assets
    assets.put("Fonts/mainFont.fnt",BitmapFont.class);
    assets.put("MenuScreen/CursedEchoMenuBackground.png", Texture.class);

    this.setScreen(new LoadingScreen(assets,"default","menu",null));
}
项目:arcadelegends-gg    文件:PauseMenuScreen.java   
/**
 * Method responsible for initializing the pause menu
 * Called when the screen becomes the current screen of the game
 */
@Override
public void show() {
    // Inits:
    cam = new OrthographicCamera();
    viewport = new FitViewport(1920, 1080);
    viewport.setCamera(cam);
    stage = new Stage(viewport);
    stage.setViewport(viewport);
    skin = menuAssets.styles_json;
    skin.getFont("bocklin").getData().setScale(0.8f, 0.8f);
    int x = 1920;
    int y = 1080;
    spriteBatch = new SpriteBatch();
    mainbackground = menuAssets.testmainscreen;

    createComponents();

    AL.input.setInputProcessor(new InputMultiplexer(stage, this));
}
项目:INFSEN01-2    文件:Program.java   
@Override
public void create() {
    this.batch = new SpriteBatch();
    this.backgroundImage = new Texture("coffee.jpg");

    GUIConstructor guiConstructor = new GUIConstructor();
    this.guiManager = guiConstructor.instantiate("1", () -> {
        Gdx.app.exit();
    });

    this.drawingManager = new GDXDrawingAdapter(this.batch);
    this.drawVisitor = new DefaultDrawVisitor(this.drawingManager);

    this.inputManager = new GDXMouse();
    this.updateVisitor = new DefaultUpdateVisitor(this.inputManager);
}
项目:JGame    文件:JGame.java   
@Override
public void create() {
    batch = new SpriteBatch();
    cam = new Camera(screenX, screenY);
    batch.setProjectionMatrix(cam.camera.combined);
    batch.enableBlending();
    try {
        save = new Save();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    this.setScreen(new MainMenu(this));

}
项目:libgdx-learnlib    文件:WorldRenderer.java   
private void renderGuiFpsCounter(SpriteBatch batch) {
    float x = cameraGUI.viewportWidth - 55;
    float y = cameraGUI.viewportHeight - 15;
    int fps = Gdx.graphics.getFramesPerSecond();
    BitmapFont fpsFont = Assets.instance.fonts.defaultNormal;
    if (fps >= 45) {
        // 45 or more FPS show up in green
        fpsFont.setColor(0, 1, 0, 1);
    } else if (fps >= 30) {
        // 30 or more FPS show up in yellow
        fpsFont.setColor(1, 1, 0, 1);
    } else {
        // less than 30 FPS show up in red
        fpsFont.setColor(1, 0, 0, 1);
    }
    fpsFont.draw(batch, "FPS: " + fps, x, y);
    fpsFont.setColor(1, 1, 1, 1);
}
项目:Cubes_2    文件:FrametimeGraph.java   
public static void drawLines(SpriteBatch batch) {
    if (!Settings.getBooleanSettingValue(Settings.DEBUG_FRAMETIME_GRAPH))
        return;

    float width = width();

    int size = frametimeGraph.frametimes.size();
    while (size < width) {
        frametimeGraph.frametimes.addFirst(0f);
        size = frametimeGraph.frametimes.size();
    }
    for (int i = 0; i <= 16; i++) {
        batch.draw(textureLine, 0, yOffset + (scale * i), width, 1);
    }
    batch.draw(textureLine60, 0, yOffset + (scale * 16.666666f), width, 1);
}
项目:StreetCampusFighter    文件:GameScreen.java   
public GameScreen(){
    spriteBatch = new SpriteBatch(); // buffer ok
    texture     = new Texture(Gdx.files.internal("bg/gameBG.jpg"));
    viewMatrix  = new Matrix4();  // matriz de visualização
    tranMatrix  = new Matrix4();  // matriz de escala

    // camera
    camera = new PerspectiveCamera(67.0f, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    camera.near = 0.1f;
    camera.far  = 1000f;
    camera.position.set(0, 5, 10);
    camera.lookAt(0, 5, 0);
    camera.update();

    // ambiente
    environment = new Environment();
    environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 1,1,1,1));

    // renderizador
    modelBatch = new ModelBatch();
    p1 = new Player(1);
    p2 = new Player(2);



}
项目:nomoore    文件:MyGdxGame.java   
@Override
public void create() {
    if (androidInterface != null)
        androidInterface.tryToStopMusicApp();

    batch = new SpriteBatch();
    sr = new ShapeRenderer();

    camera = new OrthographicCamera();
    viewport = new FitViewport(Configuration.WINDOW_WIDTH, Configuration.WINDOW_HEIGHT, camera);
    camera.position.set(viewport.getWorldWidth() / 2 - (viewport.getWorldWidth() - 500) / 2, viewport.getWorldHeight() / 2 - (viewport.getWorldHeight() - 220) / 2, 0);
    camera.update();

    fade = new Sprite(new Texture("sprites/fade.png"));
    fade.setBounds(0, -100, viewport.getWorldWidth(), viewport.getWorldHeight() - 40);

    font = new BitmapFont(Gdx.files.internal("fonts/amiga4everpro2.fnt"));

    showModernTimesCutscene(); // start the game
}
项目:SpaceChaos    文件:MainMenuScreen.java   
@Override
public void draw(GameTime time, SpriteBatch batch) {
    // set camera projection matrix
    batch.setProjectionMatrix(game.getUICamera().combined);

    // draw background
    batch.draw(this.bgImage, 0, 0, game.getViewportWidth(), game.getViewportHeight());

    // draw first (SpriteBatch) layer of HUD
    this.hud.drawLayer0(time, batch);
    batch.flush();
    batch.end();

    // draw second layer (ShapeRenderer) of HUD
    this.shapeRenderer.begin(ShapeRenderer.ShapeType.Filled);
    this.shapeRenderer.setProjectionMatrix(game.getUICamera().combined);
    this.hud.drawLayer1(time, this.shapeRenderer);
    this.shapeRenderer.end();

    // draw last (SpriteBatch) layer of HUD
    batch.begin();
    batch.setProjectionMatrix(game.getUICamera().combined);
    this.hud.drawLayer2(time, batch);
}
项目:SpaceChaos    文件:DrawTextureComponent.java   
@Override
public void draw(GameTime time, CameraWrapper camera, SpriteBatch batch) {
    // if no texture is set, we don't have to draw anything
    if (this.texture == null) {
        return;
    }

    // only draw texture, if entity is visible
    if (this.visible) {
        // draw texture
        batch.draw(this.texture,
                this.positionComponent.getX() + this.getPaddingLeft()/* - originX */,
                this.positionComponent.getY() + this.getPaddingBottom()/* - originY */, originX, originY, getWidth(), getHeight(), scaleX,
                scaleY, angle, 0, // srcX
                0, // srcY
                this.texture.getWidth(), this.texture.getHeight(), false, false);
    }
}
项目:SpaceChaos    文件:ImageButton.java   
public void draw(GameTime time, SpriteBatch batch) {
    // draw background texture
    if (hovered) {
        batch.draw(this.hoverTexture, x, y);
    } else {
        batch.draw(this.bgTexture, x, y);
    }

    float paddingBottom = (this.height / 2) - 32;

    // draw icon
    if (iconTexture != null) {
        batch.draw(iconTexture, x + 10, y + paddingBottom);
    }

    // draw button text
    this.font.draw(batch, text, x + 80, y + 60);
}
项目:enklave    文件:ScreenExtensions.java   
public ScreenExtensions(GameManager gameManager) {
    this.gameManager = gameManager;
    manager = ManagerAssets.getInstance();
    addExtensions = this;
    camera = new PerspectiveCamera(40, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    camera.position.set(0, 0, Gdx.graphics.getHeight() * 0.183f);//initial 180
    camera.lookAt(0, 0, 0);
    camera.far = 2500;
    camera.near = 1;
    camera.update();
    controller = new CameraInputController(camera);
    cam = new OrthographicCamera();
    batchsprite = new SpriteBatch();

    renderer = new ImmediateModeRenderer20(false, true, 1);
    gd = new GestureDetector(this);
}
项目:SpaceChaos    文件:Entity.java   
public void drawUILayer(GameTime time, CameraWrapper camera, SpriteBatch batch) {
    // draw all components
    for (IDrawUILayerComponent component : this.drawUILayerComponentList) {
        component.drawUILayer(time, camera, batch);
    }

    /*
     * this.drawUILayerComponentList.stream().forEach(component -> {
     * component.drawUILayer(time, camera, batch); });
     */
}
项目:GDX-Engine    文件:BaseGameScene3D.java   
@Override 
public void renderGL2(float gameTime)
{
    GLCommon gl = Gdx.gl;
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);

    SpriteBatch batch = getSpriteBatch();
    viewMatrix.setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    batch.setProjectionMatrix(viewMatrix);
    batch.begin();
    batch.disableBlending();
    batch.setColor(Color.WHITE);
    //begin render background
    renderBackground(gameTime);
    batch.enableBlending();
    batch.end();
    gl.glEnable(GL10.GL_DEPTH_TEST);
    gl.glEnable(GL10.GL_CULL_FACE);
    camera.update();

    for(IDrawable3D obj : collection)
        if(obj.isVisible())
        {
            obj.renderGL2(gameTime);
        }
    gl.glDisable(GL10.GL_CULL_FACE);
    gl.glDisable(GL10.GL_DEPTH_TEST);

    batch.setProjectionMatrix(viewMatrix);
    batch.begin();

    //begin render foreground
    renderForeground(gameTime);

    //batch.enableBlending();
    //batch.setBlendFunction(GL10.GL_ONE, GL10.GL_ONE_MINUS_SRC_ALPHA);
    batch.end();
}
项目:arcadelegends-gg    文件:LevelScreen.java   
@Override
public void show() {
    if (arcadeWorld == null || reInit) {
        AL.getAudioManager().registerSound("sword_1", levelAssets.sword_1);
        AL.getAudioManager().registerSound("sword_2", levelAssets.sword_2);
        AL.getAudioManager().registerSound("sword_3", levelAssets.sword_3);
        AL.getAudioManager().registerSound("sword_4", levelAssets.sword_4);
        AL.getAudioManager().registerSound("rocketlauncher", levelAssets.rocketLauncher);
        AL.getAudioManager().registerSound("boom", levelAssets.boom);
        spriteBatch = new SpriteBatch();
        font = new BitmapFont();

        camera = new PerspectiveCamera();
        camera.far = 1000;
        camera.position.set(new Vector3(-.5f, -.5f, 35));
        camera.rotateAround(new Vector3(-.5f, -.5f, 0), Vector3.X, rot);
        camera.fieldOfView = 15;
        camera.update();
        viewport = new ExtendViewport(1920, 1080, camera);
        viewport.apply();
        uiCamera = new OrthographicCamera();
        uiViewport = new FitViewport(1920, 1080, uiCamera);
        uiStage = new Stage(uiViewport);

        map = levelAssets.get(mapName);

        arcadeWorld = new ArcadeWorld(map, rot, camera, levelAssets);

        initUI();

        reInit = false;
        playerEnt = -1;

        spawnPlayer();
        enemies = arcadeWorld.spawnEnemies(playerEnt);
        arcadeWorld.setDebug(AL.getMiscellaneousConfig().debug());
    }

    Gdx.input.setInputProcessor(this);
}
项目:ggvm    文件:HorizontalMirroringRenderManager.java   
private void drawNametable(GGVm ggvm, SpriteBatch spriteBatch, int scrollX, int scrollY, float splitYStart, float splitYEnd) {
    int patternTable = ggvm.getBackgroundPatternTableAddress() == 0 ? 0 : 1;

    boolean toggleNametableEarly = false;
    if (scrollY > 239 && scrollY <= 255) {
        scrollY -= 16;
        toggleNametableEarly = true;
    }

    int coarseScrollX = scrollX >> 3;
    int coarseScrollY = scrollY >> 3;
    int fineScrollX = scrollX & 7;
    int fineScrollY = scrollY & 7;

    int nameTableX = coarseScrollX;
    int nameTableY = coarseScrollY;
    int actualNameTableX;
    int actualNameTableY;
    int screenX = 0;
    int screenY = 8;
    int nameTableRowCount = fineScrollY == 0 ? 30 : 31;
    int nameTableColumnCount = 33;
    int nameTable;

    while (nameTableColumnCount > 0) {
        screenY = 0;
        nameTableRowCount = fineScrollY == 0 ? 30 : 31;
        nameTableY = coarseScrollY;
        nameTable = (ggvm.getNametableAddress() == Ppu.NAME_TABLE_0_BASE_ADDRESS) ? 0 : 1;
        if (toggleNametableEarly) {
            nameTable ^= 1;
        }
        while (nameTableRowCount > 0) {
            actualNameTableX = nameTableX % 32;
            actualNameTableY = nameTableY % 30;
            int whichNameTable = nameTable ^ (nameTableY / 30);

            int nameTableAddress = whichNameTable == 1 ? Ppu.NAME_TABLE_2_BASE_ADDRESS : Ppu.NAME_TABLE_0_BASE_ADDRESS;
            int attributeTableAddress = whichNameTable == 1 ? Ppu.ATTRIBUTE_TABLE_2_BASE_ADDRESS : Ppu.ATTRIBUTE_TABLE_0_BASE_ADDRESS;

            int index = ggvm.getNametableTile(nameTableAddress, actualNameTableX, actualNameTableY);
            int attribute = ggvm.getAttributeForNametableTile(attributeTableAddress, actualNameTableX, actualNameTableY);

            int indexRow = index >> 4;
            int indexColumn = index & 0x0f;
            Sprite sprite = patternTableManager.getSprite(patternTable, indexRow, indexColumn);//patternTableSprites[patternTableOffset * 16 + indexRow][indexColumn];
            sprite.setColor(0, attributes[attribute], 0, 0);
            if (!GGVmRegisterStatusBar.isSprite0HitStatusBarEnabled() || (screenY >= splitYStart && screenY < splitYEnd)) {
                sprite.setPosition(screenX - fineScrollX, 232 - screenY + fineScrollY);
                sprite.draw(spriteBatch);
            }
            screenY += 8;
            nameTableY++;
            nameTableRowCount--;
        }
        screenX += 8;
        nameTableX++;
        nameTableColumnCount--;
    }
}
项目:skycity    文件:Hud.java   
public Hud(SpriteBatch batch){
    viewport = new FillViewport(Config.SCREEN_WIDTH,Config.SCREEN_HEIGHT,new OrthographicCamera());
    stage = new Stage(viewport,batch);
    labelHP = new Label("HP: 100/100", Assets.getInstance().getSkin());
    labelVP = new Label("VP: 100/100",Assets.getInstance().getSkin());

    table = new Table();
    table.setFillParent(true);
    table.top().right().padTop(20).padRight(20).setDebug(false);
    table.add(labelHP);
    table.row();
    table.add(labelVP);
    stage.addActor(table);
}
项目:ggvm    文件:VerticalMirroringRenderManager.java   
private void drawNametable(GGVm ggvm, SpriteBatch spriteBatch, int startingNametableAddress, int scrollX, int scrollY, float splitYStart, float splitYEnd) {
    int patternTable = ggvm.getBackgroundPatternTableAddress() == 0 ? 0 : 1;

    int coarseScrollX = scrollX >> 3;
    int coarseScrollY = scrollY >> 3;
    int fineScrollX = scrollX & 7;
    int fineScrollY = scrollY & 7;

    int nameTableX = coarseScrollX;
    int nameTableY = coarseScrollY;
    int actualNameTableX;
    int actualNameTableY;
    int screenX = 0;
    int screenY = 0;
    int nameTableRowCount = fineScrollY == 0 ? 30 : 31;
    int nameTableColumnCount;
    int nameTable;

    while (nameTableRowCount > 0) {
        screenX = 0;
        nameTableColumnCount = fineScrollX == 0 ? 32 : 33;
        nameTableX = coarseScrollX;
        nameTable = (startingNametableAddress == Ppu.NAME_TABLE_0_BASE_ADDRESS || startingNametableAddress == Ppu.NAME_TABLE_2_BASE_ADDRESS) ? 0 : 1;
        while (nameTableColumnCount > 0) {
            actualNameTableX = nameTableX % 32;
            actualNameTableY = nameTableY % 30;
            int whichNameTable = nameTable ^ ((nameTableX >> 5) & 1);

            int nameTableAddress = whichNameTable == 1 ? Ppu.NAME_TABLE_1_BASE_ADDRESS : Ppu.NAME_TABLE_0_BASE_ADDRESS;
            int attributeTableAddress = whichNameTable == 1 ? Ppu.ATTRIBUTE_TABLE_1_BASE_ADDRESS : Ppu.ATTRIBUTE_TABLE_0_BASE_ADDRESS;

            int index = ggvm.getNametableTile(nameTableAddress, actualNameTableX, actualNameTableY);
            int attribute = ggvm.getAttributeForNametableTile(attributeTableAddress, actualNameTableX, actualNameTableY);

            int indexRow = index >> 4;
            int indexColumn = index & 0x0f;
            Sprite sprite = patternTableManager.getSprite(patternTable, indexRow, indexColumn);//patternTableSprites[patternTableOffset * 16 + indexRow][indexColumn];
            sprite.setColor(0, attributes[attribute], 0, 0);
            if (!GGVmRegisterStatusBar.isSprite0HitStatusBarEnabled() || (screenY >= splitYStart && screenY < splitYEnd)) {
                sprite.setPosition(screenX - fineScrollX, 232 - screenY + fineScrollY);
                sprite.draw(spriteBatch);
            }
            screenX += 8;
            nameTableX++;
            nameTableColumnCount--;
        }
        screenY += 8;
        nameTableY++;
        nameTableRowCount--;
    }
}
项目:Polymorph    文件:Splash.java   
public Splash(final Polymorph polymorph) {
    this.polymorph = polymorph;
    batch = new SpriteBatch();

    initAssets();
    Timer.schedule(new Task() {
        @Override
        public void run() {
            polymorph.setScreen(new MainMenu(polymorph));
        }

    }, 3); //change screen after 3 seconds
}
项目:INFSEN01-2    文件:Program.java   
@Override
public void create() {
    this.batch = new SpriteBatch();
    this.backgroundImage = new Texture("coffee.jpg");

    this.guiManager = new GUIManager(() -> {
        Gdx.app.exit();
    });
    this.drawingManager = new GDXDrawingAdapter(this.batch);
    this.drawVisitor = new DefaultDrawVisitor(this.drawingManager);
    this.inputManager = new GDXMouse();
    this.updateVisitor = new DefaultUpdateVisitor(this.inputManager);
}
项目:school-game    文件:Splashscreen.java   
/**
 * Initialisierung
 *
 * @param game zeigt auf das SchoolGame, dass das Spiel verwaltet
 */
@Override
public void create(SchoolGame game) {
    this.game = game;
    batch = new SpriteBatch();

    Texture splashImg = new Texture(Gdx.files.internal("data/misc/splashscreen.png"));
    screenSprite = new Sprite(splashImg);
    screenSprite.setPosition(-screenSprite.getWidth() / 2, -screenSprite.getHeight() / 2);
    screenSprite.setAlpha(0);

    timer = SHOW_TIME + FADE_TIME * 2;
}
项目:savethebunny    文件:LevelItem.java   
@Override
public void render(SpriteBatch batch) {
    if (this.visible) {
        super.render(batch);
        if (levelNum > -1) {
            Cache.font.draw(batch, text, textX, textY);
        }
    }
}
项目:gdx-cclibs    文件:ExampleRunner.java   
@Override
public void create() {
    spriteBatch = new SpriteBatch();
    stage = new Stage(new ScreenViewport());
    skin = new Skin(Gdx.files.internal("uiskin.json"));
    Table table = new Table(skin);
    table.setFillParent(true);
    selectBox = new SelectBox<Class<? extends Example>>(skin){
        protected String toString (Class<? extends Example> obj) {
            return obj.getSimpleName();
        }
    };
    selectBox.setItems(examples);
    table.add(selectBox).fillX().space(20).row();
    stage.addActor(table);
    TextButton startButton = new TextButton("Start example", skin);
    startButton.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            runSelectedExample();
        }
    });
    table.add(startButton).fillX();

    if (arg != null && arg.length > 0) {
        Class<? extends Example> specifiedExample = getExample(arg[0]);
        if (specifiedExample != null){
            startExample(specifiedExample);
            return;
        }
    }

    setScreen(menuScreen);
}
项目:SpaceChaos    文件:DrawHPBarComponent.java   
@Override
public void drawUILayer(GameTime time, CameraWrapper camera, SpriteBatch batch) {
    // get current HP in percent
    float percent = this.hpComponent.getPercent();

    // calculate x and y position
    float x = this.positionComponent.getX() + offsetX;
    float y = this.positionComponent.getY() + this.positionComponent.getHeight() + offsetY;

    // draw background
    SpriteBatcherUtils.fillRectangle(batch, x, y, barWidth, barHeight, backgroundColor);

    // draw foreground
    SpriteBatcherUtils.fillRectangle(batch, x, y, barWidth * percent, barHeight, foregroundColor);
}
项目:savethebunny    文件:PhaseItem.java   
@Override
public void render(SpriteBatch batch) {
    super.render(batch);
    if (this.visible) {
        Cache.font.draw(batch, title, titleX, titleY);
        Cache.font.draw(batch, subtitle, subtitleX, subtitleY);
    }
}
项目:Polymorph    文件:PolyGame.java   
public void render(SpriteBatch batch) {
    batch.disableBlending();
    //draw opaques
    for (Map map : maps) {
        map.render(batch);
    }

    batch.enableBlending();
    //draw transparents
    player.render(batch);
    for (Slot slot : slots) {
        slot.render(batch);
    }
}
项目:miniventure    文件:BounceEntity.java   
@Override
public void render(SpriteBatch batch, float delta) {
    blinker.update(delta);

    if(time < lifetime * BLINK_THRESHOLD || blinker.shouldRender())
        super.render(batch, delta);
}
项目:libgdx-learnlib    文件:Clouds.java   
@Override
public void render(SpriteBatch batch) {
    TextureRegion reg = regCloud;
    batch.draw(reg.getTexture(), position.x + origin.x, position.y
                    + origin.y, origin.x, origin.y, dimension.x, dimension.y,
            scale.x, scale.y, rotation, reg.getRegionX(),
            reg.getRegionY(), reg.getRegionWidth(),
            reg.getRegionHeight(), false, false);
}
项目:guitar-finger-trainer    文件:GftGame.java   
@Override
public void create () {
    spriteBatch = new SpriteBatch();

    glyphLayout = new GlyphLayout();

    SettingsUtil.load();
    AssetsUtil.load();

    setScreen(new MainScreen(this));
}
项目:TreasureHunting    文件:GameRenderer.java   
public GameRenderer(GameWorld world) {
    this.world = world;

    this.cam = new OrthographicCamera();
    cam.setToOrtho(true, com.home.knowhunt.screens.GameScreen.GAME_WIDTH, 204);

    batcher = new SpriteBatch();
    batcher.setProjectionMatrix(cam.combined);
    shapeRenderer = new ShapeRenderer();
    shapeRenderer.setProjectionMatrix(cam.combined);

    initGameObjects();
}
项目:libgdx-learnlib    文件:WaterOverlay.java   
@Override
public void render(SpriteBatch batch) {
    TextureRegion reg = null;
    reg = regWaterOverlay;
    batch.draw(reg.getTexture(), position.x + origin.x, position.y
                    + origin.y, origin.x, origin.y, dimension.x, dimension.y,
            scale.x, scale.y, rotation, reg.getRegionX(), reg.getRegionY(),
            reg.getRegionWidth(), reg.getRegionHeight(), false, false);
}
项目:libgdx-learnlib    文件:Feather.java   
@Override
public void render(SpriteBatch spriteBatch) {
    if (collected) {
        return;
    }

    TextureRegion reg = null;
    reg = regGoldCoin;
    spriteBatch.draw(reg.getTexture(), position.x, position.y, origin.x, origin.y,
            dimension.x, dimension.y, scale.x, scale.y, rotation,
            reg.getRegionX(), reg.getRegionY(), reg.getRegionWidth(), reg.getRegionHeight(), false, false);

}
项目:Tower-Defense-Galaxy    文件:TDScreen.java   
@Override
public void show () {
    //orthographicCamera = new OrthographicCamera(3840, 2160);
    matrix4 = new Matrix4();
    spriteBatch = new SpriteBatch();
    viewport = new FitViewport(2560, 1440, new OrthographicCamera());
    viewport.apply();
    stage = new Stage(viewport);
    camera = createCamera();
    multiplexer = new InputMultiplexer();
    multiplexer.addProcessor(stage);
    Gdx.input.setInputProcessor(multiplexer);
    if(TDGalaxy.preferences.isDebug())
        stage.setDebugAll(true);
}
项目:miniventure    文件:Tile.java   
@Override
public void render(SpriteBatch batch, float delta) {

    // draw the ground sprite and overlaps
    renderTileType(groundType, batch);

    // draw the surface sprite and overlaps
    if(surfaceType != null)
        renderTileType(surfaceType, batch);
}
项目:bobbybird    文件:GameState.java   
@Override
public void draw(SpriteBatch spriteBatch, float delta) {
    Gdx.gl.glClearColor(0, 113/255.0f, 188/255.0f, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    camera.update();
    spriteBatch.setProjectionMatrix(camera.combined);
    spriteBatch.begin();
    manager.draw(spriteBatch, delta);
    spriteBatch.end();

    stage.draw();
}
项目:FlappyChapa    文件:MenuState.java   
@Override
public void render(SpriteBatch spriteBatch) {
    spriteBatch.setProjectionMatrix(camera.combined);
    spriteBatch.begin();
    spriteBatch.draw(backGround, 0, 0);
    spriteBatch.draw(playButton, camera.position.x - playButton.getWidth() / 2, camera.position.y);
    spriteBatch.end();
}
项目:SpaceChaos    文件:ActionBar.java   
@Override
public void drawLayer0(GameTime time, SpriteBatch batch) {
    // draw background
    batch.draw(this.bgTexture, getX(), getX());

    // draw items
    for (int i = 0; i < rows; i++) {
        for (int j = 0; j < cols; j++) {
            // update item
            if (items[i][j] != null) {
                items[i][j].drawLayer0(time, batch);
            }
        }
    }
}