Java 类com.badlogic.gdx.utils.viewport.FillViewport 实例源码

项目:Topicos2015-2    文件:GameScreen.java   
/**
 * Chamado quando a tela é exibida
 */
@Override
public void show() {
    camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    batch = new SpriteBatch();
    stage = new Stage(new FillViewport(camera.viewportWidth, camera.viewportHeight, camera));
    stageInfo = new Stage(new FillViewport(camera.viewportWidth, camera.viewportHeight, camera));

    initSound();
    initTextures();
    initFont();
    initPlayer();
    initInformation();

    recPlayer = new Rectangle();
    recShot = new Rectangle();
    recShot = new Rectangle();
    recEnemy = new Rectangle();
}
项目:libgdxcn    文件:ViewportTest1.java   
static public Array<Viewport> getViewports (Camera camera) {
    int minWorldWidth = 640;
    int minWorldHeight = 480;
    int maxWorldWidth = 800;
    int maxWorldHeight = 480;

    Array<Viewport> viewports = new Array();
    viewports.add(new StretchViewport(minWorldWidth, minWorldHeight, camera));
    viewports.add(new FillViewport(minWorldWidth, minWorldHeight, camera));
    viewports.add(new FitViewport(minWorldWidth, minWorldHeight, camera));
    viewports.add(new ExtendViewport(minWorldWidth, minWorldHeight, camera));
    viewports.add(new ExtendViewport(minWorldWidth, minWorldHeight, maxWorldWidth, maxWorldHeight, camera));
    viewports.add(new ScreenViewport(camera));

    ScreenViewport screenViewport = new ScreenViewport(camera);
    screenViewport.setUnitsPerPixel(0.75f);
    viewports.add(screenViewport);

    viewports.add(new ScalingViewport(Scaling.none, minWorldWidth, minWorldHeight, camera));
    return viewports;
}
项目:ProjectRiddle    文件:Final.java   
/**
 * Contructor de la clase
 */

public Final(){
    stage = new Stage(new FillViewport(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()));
    camara = new OrthographicCamera();
    batch = new SpriteBatch();

    Gdx.input.setInputProcessor(stage);

    textura = new Texture(Gdx.files.internal(GestorImagen.URL_PANTALLA_FINAL)); 
    musica = Gdx.audio.newMusic(Gdx.files.internal("Musica/Tension.mp3"));
    musica.play();

    // instanciamos la cámara
    camara.position.set(TheHouseOfCrimes.WIDTH / 2f, TheHouseOfCrimes.HEIGHT / 2f, 0);
    viewport = new FillViewport(TheHouseOfCrimes.WIDTH, TheHouseOfCrimes.HEIGHT, camara);

    salir = new BotonSalir(game, true);
    salir.setTouchable(Touchable.enabled);

    stage.addActor(salir);
}
项目:ProjectRiddle    文件:Introduccion.java   
/**
 * Constructor de la clase
 */

public Introduccion() {
    stage = new Stage(new FillViewport(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()));
    camara = new OrthographicCamera();
    batch = new SpriteBatch();

    Gdx.input.setInputProcessor(stage);

    textura = new Texture(Gdx.files.internal(GestorImagen.URL_PANTALLA_INTRO)); 
    musica = Gdx.audio.newMusic(Gdx.files.internal("Musica/Tension.mp3"));
    musica.play();

    // instanciamos la cámara
    camara.position.set(TheHouseOfCrimes.WIDTH / 2f, TheHouseOfCrimes.HEIGHT / 2f, 0);
    viewport = new FillViewport(TheHouseOfCrimes.WIDTH, TheHouseOfCrimes.HEIGHT, camara);

    //Actores
    botonContinuar = new BotonContinuar(game);
    botonContinuar.setTouchable(Touchable.enabled);

    stage.addActor(botonContinuar);
}
项目:ProjectRiddle    文件:Creditos.java   
/**
 * Contructor de la clase
 */

public Creditos(){
    stage = new Stage(new FillViewport(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()));
    camara = new OrthographicCamera();
    batch = new SpriteBatch();

    Gdx.input.setInputProcessor(stage);

    pantalla = new Texture(Gdx.files.internal(GestorImagen.URL_PANTALLA_CREDITOS)); 

    // instanciamos la cámara
    camara.position.set(TheHouseOfCrimes.WIDTH / 2f, TheHouseOfCrimes.HEIGHT / 2f, 0);
    viewport = new FillViewport(TheHouseOfCrimes.WIDTH, TheHouseOfCrimes.HEIGHT, camara);

    botonSalir = new BotonSalirCreditos(game);
    botonSalir.setTouchable(Touchable.enabled);

    stage.addActor(botonSalir);
}
项目:ProjectRiddle    文件:Diccionario.java   
public Diccionario(){
    stage = new Stage(new FillViewport(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()));
    camara = new OrthographicCamera();
    batch = new SpriteBatch();

    Gdx.input.setInputProcessor(stage);

    pantalla = new Texture(Gdx.files.internal(GestorImagen.URL_PANTALLA_DICCIONARIO)); 

    salirDiccionario = new BotonSalirDiccionario(game);
    salirDiccionario.setTouchable(Touchable.enabled);

    // instanciamos la cámara
    camara.position.set(TheHouseOfCrimes.WIDTH / 2f, TheHouseOfCrimes.HEIGHT / 2f, 0);
    viewport = new FillViewport(TheHouseOfCrimes.WIDTH, TheHouseOfCrimes.HEIGHT, camara);

    // Música
    musica = Gdx.audio.newMusic(Gdx.files.internal("Musica/Inventario.mp3"));
    musica.setLooping(true);
    musica.play();

    stage.addActor(salirDiccionario);
}
项目:libgdx_ui_editor    文件:MainEditor.java   
@Override
    public void create () {
        this.resize(Config.width,Config.height);
//      VisUI.load("skins/tixel/x1/tixel.json");
        VisUI.load();
        mainViewPort = new FillViewport(Config.width,Config.height);
        mainStage = new MainStage(mainViewPort);
        Gdx.input.setInputProcessor(mainStage);
    }
项目:alquran-alkarem    文件:book.java   
private void inetilate_camera() {
        // TODO Auto-generated method stub
        pages_camera = new OrthographicCamera(/*M.game_camera_width, M.game_camera_height*/) ;
        pages_viewport = new FillViewport(screen_width,screen_height, pages_camera);
        pages_camera.position.x = screen_width/2 ;
        pages_camera.position.y = screen_height/2;

        managment_camera = new OrthographicCamera() ;
        managment_viewport = new FillViewport(screen_width, screen_height , managment_camera);
        managment_camera.position.x = screen_width /2 ; 
        managment_camera .position.y = screen_height/2 ;



}
项目: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);
}
项目:skycity    文件:Chat.java   
public Chat(SpriteBatch batch){
    field = new TextField("", Assets.getInstance().getSkin());
    field.setVisible(false);

    table = new Table();
    table.bottom().padLeft(20).padRight(20).padBottom(10).setFillParent(true);
    table.setDebug(false);
    table.add(field).width(Config.SCREEN_WIDTH-40);
    stage = new Stage(new FillViewport(Config.SCREEN_WIDTH,Config.SCREEN_HEIGHT,new OrthographicCamera()),batch);
    stage.addActor(table);
    stage.setKeyboardFocus(field);
}
项目:clouboy    文件:AbstractScreen.java   
@Override
public final void resize(int width, int height) {
  if (stage == null) {
    stage = new Stage(new FillViewport(1000, 600));
    initStage(stage);
    tooltip.init(tweenManager, stage, camera);
    input.addProcessor(stage);
  }
  camera.setToOrtho(false, 1000, 600);
  onResize(width, height);
}
项目:Topicos2015-2    文件:MenuScreen.java   
@Override
public void show() {
    camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    stage = new Stage(new FillViewport(camera.viewportWidth, camera.viewportHeight, camera));
    Gdx.input.setInputProcessor(stage);

    initFonts();
    initLabels();
    initButtons();
}
项目:ProjectRiddle    文件:Inicio.java   
/**
 * Constructor de la clase Inicio.
 * @param game
 */

public Inicio(TheHouseOfCrimes game){
    Inicio.game = game;

    stage = new Stage(new FillViewport(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()));
    camara = new OrthographicCamera();
    batch = new SpriteBatch();

    //musica
    /*if(MyGdxGame.SUSPENSE_MUSICA)
        musica = Gdx.audio.newMusic(Gdx.files.internal("Musica/titulo.mp3"));
    else*/

    musica = Gdx.audio.newMusic(Gdx.files.internal("Musica/TituloSinSuspense.mp3"));
    musica.play();

    //instanciamos la cámara
    camara.position.set(TheHouseOfCrimes.WIDTH / 2f, TheHouseOfCrimes.HEIGHT / 2f ,0);
    viewport = new FillViewport(TheHouseOfCrimes.WIDTH, TheHouseOfCrimes.HEIGHT, camara);

    //añadimos botones y hacemos que sean tocables
    inicio = new BotonInicio(game);
    inicio.setTouchable(Touchable.enabled);

    salir = new BotonSalir(game, false);
    salir.setTouchable(Touchable.enabled);

    creditos = new BotonCreditos(game);
    creditos.setTouchable(Touchable.enabled);

    Gdx.input.setInputProcessor(stage);

    //se añaden los botones
    stage.addActor(inicio);
    stage.addActor(salir);
    stage.addActor(creditos);
}
项目:KyperBox    文件:KyperBoxGame.java   
public KyperBoxGame() {
    this(new FillViewport(Resolutions._720.WIDTH(), Resolutions._720.HEIGHT()));
}
项目:KyperBox    文件:TileCollisionTest.java   
public TileCollisionTest() {
    super(new FillViewport(1280, 720));
}
项目:KyperBox    文件:ParallaxMappingTest.java   
public ParallaxMappingTest() {
    super(new FillViewport(1280,720));
}
项目:braingdx    文件:TmxScreen.java   
@Override
protected Viewport getViewport(int width, int height) {
    return new FillViewport(width, height);
}
项目:ProjectRiddle    文件:Inventario.java   
/**
 * Constructor de la clase
 * @param game
 */

private Inventario(TheHouseOfCrimes game) {
    stage = new Stage(new FillViewport(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()));
    Inventario.game = game;
    camara = new OrthographicCamera();
    batch = new SpriteBatch();

    // Música
    musica = Gdx.audio.newMusic(Gdx.files.internal("Musica/Inventario.mp3"));
    musica.setLooping(true);

    estado = EstadoInventario.NORMAL;
    inventario = new Array<Objeto>();

    //Usamos un array especial, solo de dos elementos, para las combinaciones
    combinacion = new Array<Objeto>(2);

    //instanciamos la cámara
    camara.position.set(TheHouseOfCrimes.WIDTH / 2f, TheHouseOfCrimes.HEIGHT / 2f ,0);
    viewport = new FillViewport(TheHouseOfCrimes.WIDTH, TheHouseOfCrimes.HEIGHT, camara);

    //Inicializamos los botones y hacemos que se puedan pulsar
    cerrarInventario = new BotonCerrarInventario(game);
    cerrarInventario.setTouchable(Touchable.enabled);

    aceptarCombinar = new BotonAceptarCombinar(game);
    aceptarCombinar.setTouchable(Touchable.enabled);

    cancelarCombinar = new BotonCancelarCombinar(game);
    cancelarCombinar.setTouchable(Touchable.enabled);

    combinarObjeto = new BotonCombinarObjeto(game);
    combinarObjeto.setTouchable(Touchable.enabled);

    //Instanciamos los cuadros de texto
    cuadroDescripcion = new CuadroDescripcion(game);
    cuadroObjetivo = new CuadroEstado(game);

    Gdx.input.setInputProcessor(stage);

    //añadimos botones
    stage.addActor(cerrarInventario);
    stage.addActor(aceptarCombinar);
    stage.addActor(cancelarCombinar);
    stage.addActor(combinarObjeto);

    //añadimos los cuadros de texto
    stage.addActor(cuadroDescripcion);
    stage.addActor(cuadroObjetivo);
}
项目:ProjectRiddle    文件:PantallaArma.java   
/**
 * Contructor de la clase
 */

public PantallaArma() {
    stage = new Stage(new FillViewport(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()));
    camara = new OrthographicCamera();
    batch = new SpriteBatch();

    // instanciamos la camara
    camara.position.set(TheHouseOfCrimes.WIDTH / 2f, TheHouseOfCrimes.HEIGHT / 2f, 0);
    viewport = new FillViewport(TheHouseOfCrimes.WIDTH, TheHouseOfCrimes.HEIGHT, camara);

    Gdx.input.setInputProcessor(stage);

    armas = new Array<Arma>();

    armas.add(new Arma(new Texture(Gdx.files.internal("Imagenes/armaDaga.png")), NombreArma.DAGA));
    armas.add(new Arma(new Texture(Gdx.files.internal("Imagenes/armaPistola.png")), NombreArma.PISTOLA));
    armas.add(new Arma(new Texture(Gdx.files.internal("Imagenes/armaRifle.png")), NombreArma.RIFLE));
    armas.add(new Arma(new Texture(Gdx.files.internal("Imagenes/armaSerpiente.png")), NombreArma.SERPIENTE));

    if(OrganizadorEstados.getArma().equals(NombreArma.DAGA)){ //se usa la daga
        armas.get(0).setUsada(true);
        arma = NombreArma.DAGA;
    }else if(OrganizadorEstados.getArma().equals(NombreArma.PISTOLA)){ //se usa la pistola
        armas.get(1).setUsada(true);
        arma = NombreArma.PISTOLA;
    }else if(OrganizadorEstados.getArma().equals(NombreArma.RIFLE)){ //se usa el rifle
        armas.get(2).setUsada(true);
        arma = NombreArma.RIFLE;
    }else if(OrganizadorEstados.getArma().equals(NombreArma.SERPIENTE)){ //se usa la serpiente
        armas.get(3).setUsada(true);
        arma = NombreArma.SERPIENTE;
    }

    textura = new Texture(Gdx.files.internal(GestorImagen.URL_PANTALLA_ARMA));
    musica = Gdx.audio.newMusic(Gdx.files.internal("Musica/Tension.mp3"));

    musica.setLooping(true);
    musica.play();

    for(int i = 0; i < armas.size; ++i){
        stage.addActor(armas.get(i));
        armas.get(i).setTouchable(Touchable.enabled);
    }
}
项目:ProjectRiddle    文件:PantallaAsesino.java   
/**
 * Constructor de la clase, además de inicializar los atributos, elige quien
 * es el asesino.
 */
public PantallaAsesino(){
    stage = new Stage(new FillViewport(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()));
    camara = new OrthographicCamera();
    batch = new SpriteBatch();

    // instanciamos la camara
    camara.position.set(TheHouseOfCrimes.WIDTH / 2f, TheHouseOfCrimes.HEIGHT / 2f, 0);
    viewport = new FillViewport(TheHouseOfCrimes.WIDTH, TheHouseOfCrimes.HEIGHT, camara);

    Gdx.input.setInputProcessor(stage);

    asesinos = new Array<Asesino>();

    asesinos.add(new Asesino(new Texture(Gdx.files.internal("Imagenes/Personajes/chica.png")), NombreAsesino.NIÑA));
    asesinos.add(new Asesino(new Texture(Gdx.files.internal("Imagenes/Personajes/hombre.png")), NombreAsesino.HOMBRE));
    asesinos.add(new Asesino(new Texture(Gdx.files.internal("Imagenes/Personajes/joven.png")), NombreAsesino.JOVEN));
    asesinos.add(new Asesino(new Texture(Gdx.files.internal("Imagenes/Personajes/MujerMayor.png")), NombreAsesino.ANCIANA));
    asesinos.add(new Asesino(new Texture(Gdx.files.internal("Imagenes/Personajes/mujer.png")), NombreAsesino.MUJER));

    if(OrganizadorEstados.getAsesino().equals(NombreAsesino.NIÑA)){ //es la niña
        asesinos.get(0).setCulpable(true);
        asesino = NombreAsesino.NIÑA;
    }else if(OrganizadorEstados.getAsesino().equals(NombreAsesino.HOMBRE)){ //es el hombre
        asesinos.get(1).setCulpable(true);
        asesino = NombreAsesino.HOMBRE;
    }else if(OrganizadorEstados.getAsesino().equals(NombreAsesino.JOVEN)){ //es el joven
        asesinos.get(2).setCulpable(true);
        asesino = NombreAsesino.JOVEN;
    }else if(OrganizadorEstados.getAsesino().equals(NombreAsesino.ANCIANA)){ //es la anciana
        asesinos.get(3).setCulpable(true);
        asesino = NombreAsesino.ANCIANA;
    }else if(OrganizadorEstados.getAsesino().equals(NombreAsesino.MUJER)){ //es la mujer
        asesinos.get(4).setCulpable(true);
        asesino = NombreAsesino.MUJER;
    }

    textura = new Texture(Gdx.files.internal(GestorImagen.URL_PANTALLA_ASESINO));
    musica = Gdx.audio.newMusic(Gdx.files.internal("Musica/Tension.mp3"));

    musica.setLooping(true);
    musica.play();

    for(int i = 0; i < asesinos.size; ++i){
        asesinos.get(i).setTouchable(Touchable.enabled);
        stage.addActor(asesinos.get(i));
    }
}
项目:ProjectRiddle    文件:Habitacion.java   
/**
 * Constructor de la clase Habitacion.
 * @param game
 */

public Habitacion(TheHouseOfCrimes game, Cursor c) {
    estado = EstadoHabitacion.NORMAL;
    stage = new Stage(new FillViewport(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()));
    camara = new OrthographicCamera();
    batch = new SpriteBatch();

    // Música
    /*if (MyGdxGame.SUSPENSE_MUSICA)
        musica = Gdx.audio.newMusic(Gdx.files.internal("Musica/pasillo.mp3"));
    else*/

    musica = Gdx.audio.newMusic(Gdx.files.internal("Musica/TemaSinSuspense.mp3"));
    musica.setLooping(true);

    // instanciamos la cámara
    camara.position.set(TheHouseOfCrimes.WIDTH / 2f, TheHouseOfCrimes.HEIGHT / 2f, 0);
    viewport = new FillViewport(TheHouseOfCrimes.WIDTH, TheHouseOfCrimes.HEIGHT, camara);

    Gdx.input.setInputProcessor(stage);

    // Actores
    botonConversacion = new BotonConversacion(game);
    botonConversacion.setTouchable(Touchable.enabled);

    botonInvestigar = new BotonInvestigar(game);
    botonInvestigar.setTouchable(Touchable.enabled);

    botonPuerta = new BotonPuertaHabitacion(game);
    botonPuerta.setTouchable(Touchable.enabled);

    cuadroTexto = new CuadroDialogo(Habitacion.game);

    cuadrosEleccion = new Array<CuadroEleccion>(4); //Hay cuatro posibles elecciones

    for(int i = 0; i < 4; ++i){
        cuadrosEleccion.add(new CuadroEleccion(game));
        cuadrosEleccion.get(i).setTouchable(Touchable.enabled);
    }
}
项目:crabox    文件:GameScreen.java   
@Override
public void show() {

    //----------------------------------------------DEBUG TRUE----------------------------------------------------------------------------------||
/*  ||*/  debug = false;                                                                                                                       //|| 
    //------------------------------------------------------------------------------------------------------------------------------------------||

    camera = new OrthographicCamera(Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2); 

    camera.position.set(1, 6, 0);
    camera.update();

    batch = new SpriteBatch();
    shape = new ShapeRenderer();
    world = new World(new Vector2(0, -16f), true);

    // El jugador
    player = new Player(1, 2.6f, 3, 3, 1.65f, 0f, 0f, Cbx.getResources().player, world); // Mide 3x3 METROS.

    // Creamos la luz
    createLight();

    // Iniciamos el listener de choque de cuerpos.
    initContactListener(); // Para las colisiones de objetos.

    // InputListener y log.
    setLogLevel();

    //Generate map
    beginGenerate();

    /*
     * ---------------------------- STAGE UI ------------------------------------------------
     */

    // Creamos el stage
    hud = new HUD(new FillViewport(1440, 1024), batch, this);

    //InputProcessor
    InputMultiplexer plexer = new InputMultiplexer();
    plexer.addProcessor(this);
    plexer.addProcessor(hud);
    Gdx.input.setInputProcessor(plexer);

    // A�adimos el controlador al administrador. �ste se encarga de cuando el juego cambie de estado, ahorramos en c�digo.
    Cbx.getController().addController(this);
    Cbx.getController().notReady();
}
项目:craft    文件:TitleScreen.java   
@Override
protected Viewport createViewport() {
  return new FillViewport(Sizes.worldWidth(), Sizes.worldHeight());
}
项目:craft    文件:LoadingScreen.java   
@Override
protected Viewport createViewport() {
  return new FillViewport(Sizes.worldWidth(), Sizes.worldHeight());
}
项目:craft    文件:ProfessionScreen.java   
@Override
protected Viewport createViewport() {
  return new FillViewport(Sizes.worldWidth(), Sizes.worldHeight());
}
项目:craft    文件:IngameScreen.java   
@Override
protected Viewport createViewport() {
  return new FillViewport(Sizes.worldWidth(), Sizes.worldHeight());
}
项目:ZombieGame    文件:GameScreen.java   
public GameScreen(ZombieGame game, Level level) {
    this.game = game;
    this.level = level;

    Gdx.input.setInputProcessor(null);

    // Set the cursor
    Texture cursorTexture = game.assets.get("textures/cursor.png", Texture.class);
    cursorTexture.getTextureData().prepare();
    Pixmap cursorPixmap = cursorTexture.getTextureData().consumePixmap();
    Gdx.graphics.setCursor(Gdx.graphics.newCursor(cursorPixmap, cursorPixmap.getWidth()/2, cursorPixmap.getHeight()/2));

    camera = new OrthographicCamera();

    viewport = new FillViewport(WORLD_WIDTH, WORLD_HEIGHT, camera);
    viewport.apply();

    camera.position.set(camera.viewportWidth/2,camera.viewportHeight/2,0);

    entityManager = new EntityManager();

    // Create the world
    world = new World(new Vector2(0, 0), true);
    debugRenderer = new Box2DDebugRenderer();

    batch = new SpriteBatch();

    level.load(world);
    mapRenderer = new OrthogonalTiledMapRenderer(level.getMap(), 1/Units.PPU);

    Vector2 playerStartPos = new Vector2(level.getSpawnPosition().x, level.getSpawnPosition().y);

    player = new Player(this, playerStartPos);
    entityManager.add(player);

    hud = new Hud(this);
}