本文整理汇总了Java中com.badlogic.gdx.utils.viewport.StretchViewport类的典型用法代码示例。如果您正苦于以下问题:Java StretchViewport类的具体用法?Java StretchViewport怎么用?Java StretchViewport使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StretchViewport类属于com.badlogic.gdx.utils.viewport包,在下文中一共展示了StretchViewport类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: show
import com.badlogic.gdx.utils.viewport.StretchViewport; //导入依赖的package包/类
@Override
public void show() {
stage = new Stage(new StretchViewport(Width,Height));
stage.addActor(tabContinue);
PerspectiveCamera camera2 = new PerspectiveCamera(40, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
camera2.position.set(0, -Width * 0.075f, Width * 0.135f);
camera2.lookAt(0, 0, 0);
camera2.far = Width*0.3f;
camera2.near = 1;
camera2.update();
controller = new CameraInputController(camera2);
CameraGroupStrategy cameraGroupStrategy = new CameraGroupStrategy(camera2);
batch = new DecalBatch(cameraGroupStrategy);
modelBatch = new ModelBatch();
InputMultiplexer in = new InputMultiplexer();
in.addProcessor(stage);
in.addProcessor(controller);
Gdx.input.setInputProcessor(in);
}
示例2: show
import com.badlogic.gdx.utils.viewport.StretchViewport; //导入依赖的package包/类
@Override
public void show() {
if(drawone){
addBackgroundExtension();
addPuls();
addimagebg();
addButtonBottom();
drawone = false;
}
cameraGroupStrategy = new CameraGroupStrategy(camera);
batch = new DecalBatch(cameraGroupStrategy);
stage = new Stage(new StretchViewport(Gdx.graphics.getWidth(),Gdx.graphics.getHeight()));
addtostage();
Gdx.input.setCatchBackKey(true);
inputmulti = new InputMultiplexer();
inputmulti.addProcessor(stage);
Gdx.input.setInputProcessor(inputmulti);
}
示例3: show
import com.badlogic.gdx.utils.viewport.StretchViewport; //导入依赖的package包/类
@Override
public void show() {
if(drawone){
addroomselect();
addButtonBottom();
addPuls();
addimagebg();
addbuildRoom();
addtimerbuildroom();
drawone = false;
}
cameraGroupStrategy = new CameraGroupStrategy(camera);
// CameraInputController controller = new CameraInputController(camera);
stage = new Stage(new StretchViewport(Gdx.graphics.getWidth(),Gdx.graphics.getHeight()));
batchsprite = new SpriteBatch();
addtostage();
batch = new DecalBatch(this.cameraGroupStrategy);
Gdx.input.setCatchBackKey(true);
InputMultiplexer inputmulti = new InputMultiplexer();
inputmulti.addProcessor(stage);
Gdx.input.setInputProcessor(inputmulti);
}
示例4: show
import com.badlogic.gdx.utils.viewport.StretchViewport; //导入依赖的package包/类
@Override
public void show() {
if(drawone){
addActiveRooms();
createBuildRoom();
createAddExtensionGroup();
addDescribeEnklave();
drawone = false;
}
backButton.setChecked(false);
Gdx.input.setCatchBackKey(true);
stage = new Stage(new StretchViewport(Gdx.graphics.getWidth(),Gdx.graphics.getHeight()));
addtoStage(stage);
stage.addActor(backButton);
Gdx.input.setInputProcessor(stage);
}
示例5: show
import com.badlogic.gdx.utils.viewport.StretchViewport; //导入依赖的package包/类
@Override
public void show() {
stage = new Stage(new StretchViewport(Gdx.graphics.getWidth(),Gdx.graphics.getHeight()));
if(drawone) {
initializeMenuTab();
manager.loadAssetsSettings();
manager.getAssetsSettings().finish();
addSettingTutorial();
addSettingPresentation();
addChangeFaction();
addKeepScreenOn();
addTestCombat();
drawone = false;
}
addtoStage();
checkButtons();
b5.setChecked(true);
sp.setScrollPercentX(100);
sp.updateVisualScroll();
backButton.setChecked(false);
Gdx.input.setCatchBackKey(true);
Gdx.input.setInputProcessor(stage);
}
示例6: initUtils
import com.badlogic.gdx.utils.viewport.StretchViewport; //导入依赖的package包/类
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);
}
示例7: MenuScreen
import com.badlogic.gdx.utils.viewport.StretchViewport; //导入依赖的package包/类
public MenuScreen(Game game) {
Box2D.init();
this.game = game;
world = new World(new Vector2(0, 0), false);
stage = new Stage(new StretchViewport(Constants.WIDTH, Constants.HEIGHT));
preferences = new GamePreferences();
audioManager = AudioManager.getInstance();
Gdx.input.setInputProcessor(stage);
FlappySpinner.gameManager.changeBackgroundColor("#4ec0ca");
setUpBackground();
setUpButtons();
setUpLogo();
}
示例8: MarketScreen
import com.badlogic.gdx.utils.viewport.StretchViewport; //导入依赖的package包/类
public MarketScreen(Game aGame) {
this.aGame = aGame;
audioManager = AudioManager.getInstance();
preferences = new GamePreferences();
stage = new Stage(new StretchViewport(Constants.WIDTH, Constants.HEIGHT));
Gdx.input.setInputProcessor(stage);
initSkins();
setUpBackground();
setUpHomeButton();
setUpSkinImages();
setUpNextButton();
setUpPreviousButton();
setUpUseButton();
setUpBuyButton();
setUpLabels();
changeShownSkin();
}
示例9: SettingsScreen
import com.badlogic.gdx.utils.viewport.StretchViewport; //导入依赖的package包/类
public SettingsScreen(Game game) {
this.aGame = game;
preferences = new GamePreferences();
audioManager = AudioManager.getInstance();
stage = new Stage(new StretchViewport(Constants.WIDTH, Constants.HEIGHT));
Gdx.input.setInputProcessor(stage);
setUpBackground();
setUpLabels();
setUpHomeButton();
setUpMusicButton();
setUpSoundButton();
setUpGitHubButton();
}
示例10: GameScreen
import com.badlogic.gdx.utils.viewport.StretchViewport; //导入依赖的package包/类
/**
* Constructor
* @param game
*/
public GameScreen(Game game, Client client, Server server)
{
super(game, client, server);
this.sendCommand = client.getSendCommand();
this.camera = new OrthographicCamera();
this.stage = new Stage(new StretchViewport(Constants.SCREENWIDTH, Constants.SCREENHEIGHT, camera));
this.mapManager = new MapLoader(camera, sendCommand);
this.entityManager = new EntityManager(camera, mapManager, sendCommand, inputHandler);
this.processData = new ClientProcessData(entityManager, mapManager);
this.mainPlayerHud = new MainPlayerHud(entityManager, game, server, client, mapManager, camera);
this.camera.zoom = Constants.DEFAULTZOOM;
// Controls
if(Constants.ISRUNNINGONSMARTPHONE)
{
Gdx.input.setInputProcessor(mainPlayerHud.stage);
camera.zoom = Constants.SMARTPHONEZOOM;
}else
{
inputHandler.setInputSource(mainPlayerHud.stage);
Gdx.input.setCursorCatched(true);
}
}
示例11: show
import com.badlogic.gdx.utils.viewport.StretchViewport; //导入依赖的package包/类
@Override
public void show() {
_roomManager = new RoomManager();
_flagManager = new FlagManager();
SlideTransition.setTransitionSpeed(SlideTransition.DEFAULT_SPEED);
PlayerInventory inventory = new PlayerInventory();
_batch = new SpriteBatch();
_shapeRenderer = new ShapeRenderer();
_camera = new OrthographicCamera();
_camera.translate(GAME_WIDTH / 2, GAME_HEIGHT / 2);
_viewport = new StretchViewport(GAME_WIDTH, GAME_HEIGHT, _camera);
_player = new Player(this, inventory);
_player.startGame(RoomId.CAR);
Gdx.input.setInputProcessor(_player);
}
示例12: show
import com.badlogic.gdx.utils.viewport.StretchViewport; //导入依赖的package包/类
@Override
public void show() {
_camera = new OrthographicCamera(SPLASH_WIDTH, SPLASH_HEIGHT);
_camera.translate(SPLASH_WIDTH / 2, SPLASH_HEIGHT / 2);
_viewport = new StretchViewport(SPLASH_WIDTH, SPLASH_HEIGHT, _camera);
_batch = new SpriteBatch();
_shapeRenderer = new ShapeRenderer();
_splash = new Sprite(new Texture("splash.png"));
_splash.setSize(SPLASH_HEIGHT, SPLASH_HEIGHT);
_splash.setPosition(140, 0);
_fade = 1.0f;
_delay = 1.25f;
_fadeIn = true;
_fadeOut = false;
AudioManager.playMusic(MusicId.MAIN_MENU);
Gdx.input.setInputProcessor(this);
}
示例13: show
import com.badlogic.gdx.utils.viewport.StretchViewport; //导入依赖的package包/类
@Override
public void show() {
super.show();
layout = new GlyphLayout();
font = new NativeFont(new NativeFontPaint(25));
font.appendText("正在加载...0123456789%");
font.setColor(Color.BLACK);
layout.setText(font, "正在加载...100%");
stage = new Stage(new StretchViewport(1280, 720));
assetManager = new AssetManager();
assetManager.setLogger(new Logger("log", Logger.DEBUG));
assetManager.setLoader(CocosScene.class, new CocosLoader(new InternalFileHandleResolver()));
assetManager.load("mainscene/MenuScene.json", CocosScene.class);
}
示例14: GameHud
import com.badlogic.gdx.utils.viewport.StretchViewport; //导入依赖的package包/类
public GameHud(GameScreen gameScreen, World world) {
this.gameScreen = gameScreen;
this.world = world;
stageSb = new SpriteBatch();
sb = new SpriteBatch();
stage = new Stage(new StretchViewport(Settings.getWidth(), Settings.getHeight()), stageSb);
moveControl = new JoystickControl(ResourceManager.getInstance().getTexture("joystickBg"), ResourceManager.getInstance().getTexture("joystickKnob"), 10, 20, 20, 200, 200);
actionControl = new JoystickControl(ResourceManager.getInstance().getTexture("joystickBg"), ResourceManager.getInstance().getTexture("joystickKnob"), 10, 550, 20, 200, 200);
stage.addActor(moveControl.getTouchpad());
stage.addActor(actionControl.getTouchpad());
stage.act(Gdx.graphics.getDeltaTime());
camera = new OrthoCamera();
InputController.getInstance().addInputProcessor(stage);
bg = ResourceManager.getInstance().getTexture("bg");
for (int i = 0; i < inventoryBoxes.length; i++) {
inventoryBoxes[i] = new InventoryBox(world.getPlayer().getInventory().getItemStack(i, 0), 20 + (i * (InventoryBox.bg.getWidth() + 7)), Settings.getHeight() - InventoryBox.bg.getHeight() - 10);
}
inventoryBoxes[0].setSelected(true);
}
示例15: create
import com.badlogic.gdx.utils.viewport.StretchViewport; //导入依赖的package包/类
@Override
public void create() {
useNativeResolution = client.properties().getBoolean(PrefStore.Keys.use_native_resolution, true);
fullScreenSize.updateFrom(getMaxScreenSize());
lastResize.updateFrom(fullScreenSize);
uiSize.updateFrom(getScreenSize());
lastScreenSize.updateFrom(uiSize);
scale.setScale(uiSize, fullScreenSize);
log.debug("CREATE: UI SIZE: {}, SCREEN SIZE: {}", uiSize, fullScreenSize);
camera = new OrthographicCamera();
viewport = new StretchViewport(uiSize.getWidth(), uiSize.getHeight(), camera);
stage = new Stage(viewport);
batch = stage.getBatch();
camera.update();
batch.setProjectionMatrix(camera.combined);
shapeRenderer = new SageShapeRenderer();
Gdx.graphics.setContinuousRendering(false);
}