Java 类com.badlogic.gdx.graphics.OrthographicCamera 实例源码

项目:Parasites-of-HellSpace    文件:GameScreen.java   
@Override
public void show() 
{
    fpsLogger = new FPSLogger();

    batch = new SpriteBatch();
    camera = new OrthographicCamera(500, 800);
    viewport = new FitViewport(500, 800, camera);
    player = new Player();
    player.create();

    background = new Background();
    background.create();

    spawningFactory = new SpawningFactory();
    spawningFactory.create();

    spawningEnemy = new SpawningEnemy();
    spawningEnemy.create();

    spawningBullet = new SpawningBullet();
    spawningBullet.create();

    ui = new UI();
    ui.create();
}
项目:school-game    文件:CreateGameSlot.java   
/**
 * Zeigt den Namenswahl Bilschirm an
 *
 * @param camera  die aktuelle Kamera
 * @param deltaTime die vergangene Zeit seit dem letztem Frame
 */
public void renderName(OrthographicCamera camera, float deltaTime)
{
    strokeTimer += deltaTime;

    if (strokeTimer > 0.6f)
    {
        strokeTimer = 0f;
        stateSwitch = !stateSwitch;
        playerNameStroke = String.format("%s%s", playerName, stateSwitch ? " " : "|");
    }

    fontLayout.setText(font, localeBundle.get("name_eingeben"), Color.WHITE, camera.viewportWidth, Align.center, false);
    font.draw(batch, fontLayout, -camera.viewportWidth / 2, camera.viewportHeight / 2 - 120);

    fontLayout.setText(font, playerNameStroke, Color.ROYAL, camera.viewportWidth, Align.center, false);
    font.draw(batch, fontLayout, -camera.viewportWidth / 2, 30);

    fontLayout.setText(smallFont, localeBundle.get("enter_bestaetigen"), Color.WHITE, camera.viewportWidth, Align.center, false);
    smallFont.draw(batch, fontLayout, -camera.viewportWidth / 2, -camera.viewportHeight / 2 + 70);
}
项目:GDX-Engine    文件:GameService.java   
public GameService(SpriteBatch batch, IGameAsset asset,
    BaseGameSetting setting, OrthographicCamera camera,
    ISceneManager sceneManager) {
this.batch = batch;
this.asset = asset;
this.setting = setting;

if (asset == null)
    this.asset = new DefaultGameAsset();
if (setting == null)
    this.setting = new DefaultGameSetting();
this.camera = camera;
this.setChangeScene(sceneManager);
Rectangle.tmp.set(0, 0, getWindowSize().x, getWindowSize().y);

services = new IService[MAX_SERVICES];
   }
项目:GDX-Engine    文件:Utils.java   
public static boolean touchInRectangle(Rectangle r, OrthographicCamera camera) {
if (Gdx.input.isTouched()) {
    Vector3 touchPos = new Vector3();
    touchPos.set(Gdx.input.getX(), Gdx.input.getY(), 0);
    camera.unproject(touchPos);
    return r.x <= touchPos.x && r.x + r.width >= touchPos.x
        && r.y <= touchPos.y && r.y + r.height >= touchPos.y;
}
return false;
   }
项目:GDX-Engine    文件:TestCamera.java   
@Override
public void create() {

        rotationSpeed = 0.5f;
        mesh = new Mesh(true, 4, 6,
                        new VertexAttribute(VertexAttributes.Usage.Position, 3,"attr_Position"),
                        new VertexAttribute(Usage.TextureCoordinates, 2, "attr_texCoords"));
        texture = new Texture(Gdx.files.internal("data/Jellyfish.jpg"));
        mesh.setVertices(new float[] { 
                         -1024f, -1024f, 0, 0, 1,
                          1024f, -1024f, 0, 1, 1,
                          1024f,  1024f, 0, 1, 0,
                         -1024f,  1024f, 0, 0, 0
        });
        mesh.setIndices(new short[] { 0, 1, 2, 2, 3, 0 });

        cam = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());            
        xScale = Gdx.graphics.getWidth()/(float)TARGET_WIDTH;
        yScale = Gdx.graphics.getHeight()/(float)TARGET_HEIGHT;
        font = loadBitmapFont("default.fnt", "default.png");
        scale = Math.min(xScale, yScale);
        cam.zoom = 1/scale;
      //  cam.project(start_position);
        cam.position.set(0, 0, 0);
        batch = new SpriteBatch();
}
项目:GDX-Engine    文件:MyGdxGame.java   
@Override
public void create() {      
    float w = Gdx.graphics.getWidth();
    float h = Gdx.graphics.getHeight();

    camera = new OrthographicCamera(1, h/w);
    batch = new SpriteBatch();

    texture = new Texture(Gdx.files.internal("data/libgdx.png"));
    texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);

    TextureRegion region = new TextureRegion(texture, 0, 0, 200, 200);

    sprite = new Sprite(region);
    sprite.setSize(1f,  sprite.getHeight() / sprite.getWidth());
    sprite.setOrigin(sprite.getWidth()/2, sprite.getHeight()/2);
    sprite.setPosition(-.5f, -.5f);

}
项目:EarthInvadersGDX    文件:MenuScreen.java   
public MenuScreen() {
    camera = new OrthographicCamera();
    viewport = new FitViewport(Game.WIDTH, Game.HEIGHT, camera);
    viewport.apply();
    camera.position.set(Game.WIDTH / 2, Game.HEIGHT / 2, 0);
    camera.update();
    betaText = new BitmapFont(Gdx.files.internal("score.fnt"), Gdx.files.internal("score.png"), false);
    betaText.getData().setScale(0.35f);
    logo = new Sprite(new Texture("logo.png"));
    Random r = new Random();
    background = new Particle[r.nextInt(55 - 45) + 45];
    for (int i = 0; i < background.length; i++) {
        int size = r.nextInt(4) + 1;
        int x = r.nextInt(Game.WIDTH);
        int y = r.nextInt(Game.HEIGHT);
        background[i] = new Particle(x, y, 0, 0, -1, new Color(207 / 255f, 187 / 255f, 20 / 255f, 1f), size);
    }
    musicMuted = new Sprite(new Texture(Gdx.files.internal("buttons/music_muted.png")));
    musicUnmuted = new Sprite(new Texture(Gdx.files.internal("buttons/music_unmuted.png")));
    play = new CenteredButton(500, "buttons/play.png");
    music = new Button(Game.WIDTH - 130, 15, Game.musicMuted() ? musicMuted : musicUnmuted);
    music.setScale(4f);
}
项目:guitar-finger-trainer    文件:LevelScreen.java   
LevelScreen(GftGame game) {
    this.game = game;

    this.guiCam = new OrthographicCamera(800, 480);
    this.guiCam.position.set(800 / 2, 480 / 2, 0);

    this.backBounds = new Rectangle(7, 432, 48, 48);
    this.autoMoveToNextBounds = new Rectangle(0, 0, 800, 62);

    this.levelBounds = new ArrayList<Rectangle>();
    int line = 0;
    int column = 0;
    for(int i = 0; i < LEVELS; i++) {
        this.levelBounds.add(i, new Rectangle(370 + 75 * column++, 240 - 70 * line, 57, 57));
        if(column == 5) {
            column = 0;
            line++;
        }
    }

    this.touchPoint = new Vector3();
}
项目:curiosone-app    文件:GameCenter.java   
public GameCenter(Chat game){
  this.game = game;

  /*Camera Settings*/
  camera = new OrthographicCamera();
  camera.setToOrtho(false,480,800);
  camera.position.set(480/2,800/2,0);

  /*Button Areas*/
  wordTiles = new Rectangle(480/2-250/2,800/2,250,55);
  Arkanoid = new Rectangle(480/2-250/2,800/2-60,250,55);
  WordCrush = new Rectangle(480/2-250/2,800/2-120,250,55);
  EndlessRoad = new Rectangle(480/2-250/2,800/2-180,250,55);
  bottone4 = new Rectangle(480/2-250/2,800/2-240,250,55);
  buttonTexture = new Texture("green_button00.png");
  touch = new Vector3();
}
项目:enklave    文件:ScreenCombat.java   
public ScreenCombat(GameManager gameManager) {
    this.gameManager = gameManager;
    managerAssets = ManagerAssets.getInstance();
    cam = new OrthographicCamera();
    UpdateDisplayCombat.getInstance().setScreenCombat(this);
    camera = new PerspectiveCamera(40, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    camera.position.set(0, 0, 350);//initial 180
    camera.lookAt(0, 0, 0);
    camera.far = 2500;
    camera.near = 1;
    camera.update();
    centerPlayer = new Integer[7];
    for(int i=0;i<7;i++){
        centerPlayer[i]=-1;
    }
}
项目:Polymorph    文件:GameScreen.java   
private void initUtils() {
    //init camera & viewport
    camera = new OrthographicCamera();
    viewport = new StretchViewport(Polymorph.WORLD_WIDTH, Polymorph.WORLD_HEIGHT, camera);
    viewport.apply(true);
    camera.update();

    //init sprite batch
    batch = new SpriteBatch();
    batch.setProjectionMatrix(camera.combined);

    //init font
    FreeTypeFontGenerator fontGenerator = polymorph.getAssetManager().get(Polymorph.FONT_BOLD_PATH, FreeTypeFontGenerator.class);
    FreeTypeFontParameter fontSettings = new FreeTypeFontParameter();
    fontSettings.size = 80;
    fontSettings.minFilter = TextureFilter.Linear;
    fontSettings.magFilter = TextureFilter.Linear;
    font = fontGenerator.generateFont(fontSettings);
}
项目:arcadelegends-gg    文件:DefaultLoadingScreen.java   
public void show() {
    if (!init) {
        loadingScreenAssets = new Assets.LoadingScreenAssets();
        AL.getAssetManager().loadAssetFields(loadingScreenAssets);
        AL.getAssetManager().finishLoading();
        font = new BitmapFont();
        batch = new SpriteBatch();

        cam = new OrthographicCamera();
        viewport = new FitViewport(1920, 1080);
        viewport.setCamera(cam);
        stage = new Stage(viewport);
        stage.setViewport(viewport);
        skin = loadingScreenAssets.styles_json;

        loadingScreenBar = new ProgressBar(0, 100, 1, false, skin);
        loadingScreenBar.setPosition(25, -10);
        loadingScreenBar.setSize(1890, 50);

        stage.addActor(loadingScreenBar);
    }
    init = true;
}
项目:arcadelegends-gg    文件:InputSettingsScreen.java   
/**
 * Method responsible for initializing the main menu
 * Called when the screen becomes the current screen of the game
 */
@Override
public void show() {
    cam = new OrthographicCamera();
    viewport = new FitViewport(1920, 1080);
    viewport.setCamera(cam);
    stage = new Stage(viewport);
    stage.setViewport(viewport);
    skin = settingsAssets.styles_json;
    int x = 1920;
    int y = 1080;
    spriteBatch = new SpriteBatch();
    mainbackground = settingsAssets.testmainscreen;
    BitmapFont font = settingsAssets.bocklin_fnt;
    TextureRegion backgroundTexture = new TextureRegion(settingsAssets.background_textbutton);

    inputTable = new Table();
    keys = IInputConfig.InputKeys.values();
    keyMap = new HashMap<>();

    initInputRows(font, backgroundTexture);
    createBackButton();
    AL.input.setInputProcessor(new InputMultiplexer(stage, this));
}
项目:school-game    文件:LoadGameMenu.java   
public void render(OrthographicCamera camera, SpriteBatch batch, int y, MenuEntry activeEntry, SchoolGame game, I18NBundle localeBundle, float deltaTime) {

            Color entryColor = getColor();
            if (this == activeEntry)
            {
                entryColor = getActiveColor();
            }
            if (!isEnabled())
            {
                entryColor = getDisabledColor();
            }

            if (font == null)
                font = game.getDefaultFont();

            if (fontSmall == null)
                fontSmall = game.getLongTextFont();

            fontLayout.setText(font, localeBundle.format(getLabel(), id, used, playerName, gender), entryColor, camera.viewportWidth, Align.center, false);
            font.draw(batch, fontLayout, -camera.viewportWidth / 2, y);

            fontLayout.setText(fontSmall, localeBundle.format(detail, used, levelName, playTime), entryColor, camera.viewportWidth, Align.center, false);
            fontSmall.draw(batch, fontLayout, -camera.viewportWidth / 2, y - 50);
        }
项目:arcadelegends-gg    文件:RenderSystem.java   
public RenderSystem(DecalBatch decalBatch, AssetManager assetManager, float worldDegree, Assets.LevelAssets assets) {
    super(Aspect.all(RenderComponent.class, PositionComponent.class));
    this.levelAssets = assets;
    decalMap = new ObjectMap<>();
    uiMap = new ObjectMap<>();
    this.decalBatch = decalBatch;
    this.assetManager = assetManager;
    buffers = new ObjectMap<>();

    this.spriteBatch = new SpriteBatch();
    this.font = assets.uifont;
    font.setColor(Color.BLACK);
    this.uiCamera = new OrthographicCamera();

    Viewport viewportUi = new FitViewport(levelAssets.health_bar_gradient.getWidth(), levelAssets.health_bar_gradient.getHeight(), uiCamera);
    viewportUi.update(viewportUi.getScreenWidth(), viewportUi.getScreenHeight(), true);

    stateTime = 0;
    this.worldDegree = worldDegree;

    gradientShader = new ShaderProgram(Shaders.GradientShader.vertexShader, Shaders.GradientShader.fragmentShader);
    if (gradientShader.isCompiled() == false)
        throw new IllegalArgumentException("couldn't compile shader: " + gradientShader.getLog());
    shaderBatch = new SpriteBatch(10, gradientShader);
}
项目:ExamensArbeteTD    文件:UiStage.java   
public UiStage(){
     OrthographicCamera _uiCamera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
     this.setViewport(new ScreenViewport(_uiCamera));
     // create skin


     // root table
     _rootTable = createRootTable();
     createErrorMessagePanel();

     uiPanel = new UIPanel(Assets._skin);

     _rootTable.add(uiPanel)
             .align(Align.center)
             .fill(true , true)
             .minWidth(uiPanel.getLeftSection().getPrefWidth() + uiPanel.getMidSection().getPrefWidth() + uiPanel.getRightSection().getPrefWidth() + 50);
     // align stuff
     _rootTable.align(Align.bottom);
     // add root table to stage
     this.addActor(_rootTable);
     _pauseWindow = new PauseWindow("Pause", Assets._skin);
     _pauseWindow.setSize(Gdx.graphics.getWidth() , Gdx.graphics.getHeight());
     this.addActor(_pauseWindow);
     this.resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
}
项目:DarkDay    文件:Hud.java   
public Hud(SpriteBatch sb) {
    countKill = 0;
    viewport = new FitViewport(ScreenConf.V_WIDTH, ScreenConf.V_HEIGHT, new OrthographicCamera());

    stage = new Stage(viewport, sb);

    Table table = new Table();
    table.setFillParent(true);
    table.top();

    countKillLabel = new Label(String.format("%03d", countKill), new Label.LabelStyle(new BitmapFont(), Color.WHITE));

    table.add(countKillLabel).expandX().padTop(10);
    table.add().expandX();
    table.add().expandX();
    table.add().expandX();
    stage.addActor(table);

}
项目:guitar-finger-trainer    文件:TrainingScreen.java   
TrainingScreen(GftGame game) {
    this.game = game;

    this.guiCam = new OrthographicCamera(800, 480);
    this.guiCam.position.set(800 / 2, 480 / 2, 0);

    this.backBounds = new Rectangle(7, 432, 48, 48);
    this.playPauseBounds = new Rectangle(7, 7, 48, 48);
    this.restartBounds = new Rectangle(62, 7, 48, 48);
    this.backFowardtBounds = new Rectangle(127, 7, 48, 48);
    this.soundBounds = new Rectangle(192, 7, 48, 48);
    this.minusBounds = new Rectangle(590, 7, 48, 48);
    this.plusBounds = new Rectangle(699, 7, 48, 48);

    this.touchPoint = new Vector3();

    this.grid = new Grid(this.game);
    this.grid.loadTraining();

    this.bottomBar = new BottomBar(this.game);

    this.firstRun = 3;
    this.lastUpdateTime = TimeUtils.millis();
    this.bpm = MINUTE_IN_MILLIS / SettingsUtil.bpm;
}
项目:SpaceGame    文件:SelectionSystem.java   
/**
 * Create a new SelectionSystem object
 *
 * @param camera    - the world camera
 * @param batch     - the batch to draw to
 * @param commandUI - the command ui system used to remove set commands
 * @param quadtree  - the quadtree containign all selectable entities
 */
public SelectionSystem(OrthographicCamera camera, DrawingBatch batch, CommandUISystem commandUI,
                       SpatialQuadtree<Entity> quadtree) {
    super(4);
    this.camera = camera;
    this.batch = batch;
    this.cmdUI = commandUI;
    this.quadtree = quadtree;
}
项目:apps_small    文件:ThirdScreen.java   
public ThirdScreen (Game agame) {
    game = agame;
    batch = new SpriteBatch();
    img = new Texture("aklu.jpg");
    shapeRenderer = new ShapeRenderer();
    centerCircle = new Circle();
    leftCircle = new Circle();
    rightCircle = new Circle();
    myTouch = new Circle();
    camera = new OrthographicCamera();
    camera.setToOrtho(false, 800, 400);
    colorChanger = 0;
    counter = 0;
}
项目:SpaceGame    文件:GameScreen.java   
@Override
public void show() {
    //Initialize everything
    screenCamera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

    camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    camera.position.x = 0;
    camera.position.y = 0;
    batch = new DrawingBatch(1000, ShaderUtil.compileShader(Gdx.files.internal("shaders/basic.vertex.glsl"), Gdx.files
            .internal("shaders/basic.fragment.glsl")), true);
    batch.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);

    setLevel(level);
}
项目:apps_small    文件:MyGdxGame.java   
@Override
public void create () {
    batch = new SpriteBatch();
    img = new Texture("aklu.jpg");
       shapeRenderer = new ShapeRenderer();
       centerCircle = new Circle();
       leftCircle = new Circle();
       rightCircle = new Circle();
       myTouch = new Circle();
       camera = new OrthographicCamera();
       camera.setToOrtho(false, 800, 400);
       colorChanger = 0;
}
项目:Planet-Generator    文件:PixelBuffer.java   
public void render(SpriteBatch batch, OrthographicCamera screenCamera) {
    batch.setShader(null);
    batch.setProjectionMatrix(screenCamera.combined);
    batch.begin();
    batch.draw(pixelBufferRegion, 0, 0, screenCamera.viewportWidth, screenCamera.viewportHeight);
    batch.end();
}
项目:skycity    文件:GameScreen.java   
public GameScreen(SkyCity skyCity) {
    super(skyCity);
    state = InputState.GAME;
    hud = new Hud(skyCity.batch);
    chat = new Chat(skyCity.batch);

    mapCamera = new OrthographicCamera(SCREEN_WIDTH, SCREEN_HEIGHT);
    gamePort = new FitViewport(SCREEN_WIDTH, SCREEN_HEIGHT, mapCamera);

    renderer = new OrthogonalTiledMapRenderer(Assets.getInstance().getTiledMap(), skyCity.batch);

    mapCamera.position.set(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, 0);
    renderer.setView(mapCamera);

}
项目:penguins-in-space    文件:RenderSystem.java   
public RenderSystem(Batch batch) {
    super(FAMILY);
    this.camera = new OrthographicCamera();
    viewport = new FitViewport(Asteroids.VIRTUAL_WIDTH, Asteroids.VIRTUAL_HEIGHT, camera);
    viewport.apply(true);
    this.batch = batch;
    shapeRenderer = new ShapeRenderer();
    shapeRenderer.setColor(Color.RED);
    font = ServiceLocator.getAppComponent().getAssetService().getSkin(AssetService.SkinAsset.UISKIN).getFont("default-font");
}
项目:FlappyChapa    文件:Background.java   
public Background(OrthographicCamera camera) {

        this.camera = camera;
        this.texture = new Texture("bg.png");

        this.sprite = new Sprite(texture);
        this.sprite.setSize(texture.getWidth(),texture.getHeight());
        this.sprite.setPosition(0, 0);

        this.spriteClone = new Sprite(texture);
        this.spriteClone.setSize(texture.getWidth(),texture.getHeight());
        this.spriteClone.setPosition((FlappyChapa.WIDTH +
                FlappyChapa.WIDTH/2) - 20f, 0);

    }
项目:school-game    文件:Splashscreen.java   
/**
 * Zeigt den Splashscreen an.
 *
 * @param camera  die aktuelle Kamera
 * @param deltaTime die vergangene Zeit seit dem letztem Frame
 */
@Override
public void render(OrthographicCamera camera, float deltaTime) {

    batch.setProjectionMatrix(camera.combined);
    batch.begin();
    screenSprite.draw(batch);

    batch.end();
}
项目:GDX-Engine    文件:BaseGameScene.java   
public void setupUIManager(String skinFilePath) {
skin = new Skin(Gdx.files.internal(skinFilePath));
uiManager = new UIManager("dialog", skin, getGameService());
uiBatch = uiManager.getSpriteBatch();
uiManager.getCamera().update();
uiBatch.setTransformMatrix(uiManager.getCamera().combined);
// Gdx.graphics.setDisplayMode(Gdx.graphics.getWidth(),
// Gdx.graphics.getH, true);
if (isZoomUI()) {
    OrthographicCamera uiCamera = (OrthographicCamera) uiManager
        .getCamera();
    uiCamera.zoom = services.getCamera().zoom;
}
   }
项目:Onyx    文件:ZoomPulseEffect.java   
/**
 * @param configuration the {@link ZoomPulseEffectConfiguration} which drives the effect
 * @param cameras       the cameras to be manipulated
 */
public ZoomPulseEffect(ZoomPulseEffectConfiguration configuration, OrthographicCamera... cameras) {
    if (cameras.length == 0) throw new IllegalArgumentException("at least one camera is required");
    this.cameras = Array.with(cameras);
    this.maxZoomTime = configuration.maxZoomTime / 6;
    this.targetZoom = configuration.targetZoom;
}
项目:GDX-Engine    文件:BaseGameScene.java   
/**
    * Setup camera at specific zoom and position at map center
    * 
    * @param zoom
    */
   protected void setupCamera(float zoom) {
OrthographicCamera cam = services.getCamera();
cam.zoom = zoom;
cam.position.set(Gdx.graphics.getWidth() / 2f,
    Gdx.graphics.getHeight() / 2f, 0);
   }
项目:SpaceChaos    文件:CameraWrapper.java   
public CameraWrapper(OrthographicCamera camera) {
    this.camera = camera;

    this.cameraOffsetX = this.camera.position.x;
    this.cameraOffsetY = this.camera.position.y;

    this.tempCameraParams = new TempCameraParams(0, 0, 1);

    // this.sync();

    // add some basic modifications
    this.registerMod(new Shake1CameraModification(), Shake1CameraModification.class);
    this.registerMod(new Shake2CameraModification(), Shake2CameraModification.class);
    this.registerMod(new Shake3CameraModification(), Shake3CameraModification.class);
}
项目:miniventure    文件:GameScreen.java   
public GameScreen() {
    game.setGameScreen(this);

    createWorld();

    camera = new OrthographicCamera();
    camera.setToOrtho(false, GameCore.SCREEN_WIDTH, GameCore.SCREEN_HEIGHT);
    uiCamera = new OrthographicCamera();
    uiCamera.setToOrtho(false, GameCore.SCREEN_WIDTH, GameCore.SCREEN_HEIGHT);
}
项目:EarthInvadersGDX    文件:SplashScreen.java   
public SplashScreen() {
    camera = new OrthographicCamera();
    viewport = new FitViewport(Game.WIDTH, Game.HEIGHT, camera);
    viewport.apply();
    camera.position.set(Game.WIDTH / 2, Game.HEIGHT / 2, 0);
    camera.update();
    logo = new Sprite(new Texture(Gdx.files.internal("gussio.png")));
    initiateTime = System.currentTimeMillis();
}
项目:bad-wolf    文件:World.java   
public World(String avatarImage) {
    batch = new SpriteBatch();
    texture = new Texture("images/black.png");
    this.avatarImage = avatarImage;
    Gdx.input.setInputProcessor(this);
    camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    music.setLooping(true);
    music.play();
    connectedTiles = new HashMap<Integer, ArrayList<Tile>>();
    block = null;
    blockAlongX = false;
    lastBlockX = -1;
    lastBlockY = -1;
    fadeTime = FADE_TIME / 2.0f;

    level = 1;
    File levelsFolder = new File("levels/");
    if(levelsFolder.exists()) {
        File[] files = levelsFolder.listFiles();
        if(files == null) {
            maxLevels = 0;
        } else {
            maxLevels = files.length;
        }
    } else {
        maxLevels = 0;
    }

    loadLevel("levels/1.txt");
}
项目:school-game    文件:MenuState.java   
public void render(OrthographicCamera camera, SpriteBatch batch, int y, MenuEntry activeEntry, SchoolGame game, I18NBundle localeBundle, float deltaTime) {

            if (font == null)
                font = game.getTitleFont();

            fontLayout.setText(font, localeBundle.get(getLabel()), getColor(), camera.viewportWidth, Align.center, false);
            font.draw(batch, fontLayout, -camera.viewportWidth / 2, y);
        }
项目:school-game    文件:MenuState.java   
public void render(OrthographicCamera camera, SpriteBatch batch, int y, MenuEntry activeEntry, SchoolGame game, I18NBundle localeBundle, float deltaTime) {

            if (font == null)
                font = game.getDefaultFont();

            fontLayout.setText(font, localeBundle.get(getLabel()), getColor(), camera.viewportWidth, Align.center, false);
            font.draw(batch, fontLayout, -camera.viewportWidth / 2, y);
        }
项目:enklave    文件:ScreenRooms.java   
public ScreenRooms(GameManager gameManager) {
    this.gameManager = gameManager;
    manager = ManagerAssets.getInstance();
    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();
    cam = new OrthographicCamera();
    renderer = new ImmediateModeRenderer20(false, true, 1);
}
项目:enklave    文件:CombatFitght.java   
public void renderCercle(OrthographicCamera camera,float amt, Color c){
    float start = 0f;
    float end = amt * 360f;

    lookup.bind();
    renderer.begin(camera.combined, GL20.GL_TRIANGLE_STRIP);
    Gdx.gl.glEnable(GL20.GL_BLEND);
    Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
    int segs = (int)(24 * Math.cbrt(r));
    end += 90f;
    start += 90f;
    float halfThick = thickness/2f;
    float step = 360f / segs;
    for (float angle=start; angle<(end+step); angle+=step) {
        float tc = 0.5f;
        if (angle==start)
            tc = 0f;
        else if (angle>=end)
            tc = 1f;

        float fx = MathUtils.cosDeg(angle);
        float fy = MathUtils.sinDeg(angle);

        float z = 0f;
        //renderer.
        renderer.color(c.r, c.g, c.b, c.a);
        renderer.texCoord(tc, 1f);
        renderer.vertex(cx + fx * (r + halfThick), cy + fy * (r + halfThick), z);

        renderer.color(c.r, c.g, c.b, c.a);
        renderer.texCoord(tc, 0f);
        renderer.vertex(cx + fx * (r + -halfThick), cy + fy * (r + -halfThick), z);
    }
    renderer.end();
}
项目:fluffybalance    文件:CameraEntity.java   
@Override
public void create() {
    GameWorldEntity gameWorldEntity = mEngine.getFirstEntityOfType(GameWorldEntity.class);
    if (gameWorldEntity == null) {
        // cannot create a camera without a game world
        return;
    }

    mCamera = new OrthographicCamera(gameWorldEntity.getWorldWidth(), gameWorldEntity.getWorldHeight());
    mCamera.position.set(mCamera.viewportWidth / 2f, mCamera.viewportHeight / 2f, 0.f);

    PositionComponent positionComponent = getComponentByType(PositionComponent.class);
    positionComponent.position.set(mCamera.viewportWidth / 2f, mCamera.viewportHeight / 2f);
}
项目:gdx-cclibs    文件:OrthographicCameraSerializer.java   
@Override
public OrthographicCamera copy (Kryo kryo, OrthographicCamera original) {
    OrthographicCamera camera = new OrthographicCamera();
    camera.position.set(original.position);
    camera.direction.set(original.direction);
    camera.up.set(original.up);
    camera.near = original.near;
    camera.far = original.far;
    camera.viewportWidth = original.viewportWidth;
    camera.viewportHeight = original.viewportHeight;
    camera.zoom = original.zoom;
    camera.update();
    return camera;
}