public static Camera reset() { return reset( createFullscreen( 1 ) ); }
public void zoom( float value, float fx, float fy ) { zoom = value; width = (int)(screenWidth / zoom); height = (int)(screenHeight / zoom); focusOn( fx, fy ); }
maxZoom = defaultZoom * 2; Camera.reset( new PixelCamera( defaultZoom ) ); uiCamera = Camera.createFullscreen( uiZoom ); Camera.add( uiCamera );
float vy = align((h - SKY_HEIGHT - BUTTON_HEIGHT) / 2f); Point s = Camera.main.cameraToScreen( vx, vy ); viewport = new Camera( s.x, s.y, SKY_WIDTH, SKY_HEIGHT, defaultZoom ); Camera.add( viewport );
@Override protected void onTouchUp( NoosaInputProcessor.Touch touch ) { if (dragging) { dragging = false; thumb.am = THUMB_ALPHA; } else { PointF p = content.camera.screenToCamera( (int)touch.current.x, (int)touch.current.y ); ScrollPane.this.onClick( p.x, p.y ); } }
public void zoom( float value ) { zoom( value, scroll.x + width / 2, scroll.y + height / 2 ); }
@Override public void update() { super.update(); if (target != null) { focusOn( target.x + target.width / 2, target.y + target.height / 2 ); } if ((shakeTime -= Game.elapsed) > 0) { float damping = shakeTime / shakeDuration; shakeX = Random.Float( -shakeMagX, +shakeMagX ) * damping; shakeY = Random.Float( -shakeMagY, +shakeMagY ) * damping; } else { shakeX = 0; shakeY = 0; } updateMatrix(); }
public void reset( Item item, int cell, float endX, float endY ) { view( item ); active = visible = true; PointF tile = DungeonTerrainTilemap.raisedTileCenterToWorld(cell); Point screen = Camera.main.cameraToScreen(tile.x, tile.y); PointF start = camera().screenToCamera(screen.x, screen.y); x = this.startX = start.x - ItemSprite.SIZE / 2; y = this.startY = start.y - ItemSprite.SIZE / 2; this.endX = endX - ItemSprite.SIZE / 2; this.endY = endY - ItemSprite.SIZE / 2; left = DURATION; scale.set( startScale = Camera.main.zoom / camera().zoom ); }
protected void switchScene() { Camera.reset(); if (scene != null) { scene.destroy(); } scene = requestedScene; scene.create(); Game.elapsed = 0f; Game.timeScale = 1f; }
public static Camera createFullscreen( float zoom ) { int w = (int)Math.ceil( Game.width / zoom ); int h = (int)Math.ceil( Game.height / zoom ); Camera c = new Camera( (int)(Game.width - w * zoom) / 2, (int)(Game.height - h * zoom) / 2, w, h, zoom ); c.fullScreen = true; return c; }
@Override protected void layout() { content.setPos( 0, 0 ); controller.x = x; controller.y = y; controller.width = width; controller.height = height; Point p = camera().cameraToScreen( x, y ); Camera cs = content.camera; cs.x = p.x; cs.y = p.y; cs.resize( (int)width, (int)height ); thumb.visible = height < content.height(); if (thumb.visible) { thumb.scale.set( 2, height * height / content.height() ); thumb.x = right() - thumb.width(); thumb.y = y; } }
@Override public void update() { super.update(); if (!visible) { visible = Dungeon.level.visited[cell] || Dungeon.level.mapped[cell]; } if (visible) { PointF scroll = Camera.main.scroll; if (!scroll.equals( lastScroll )) { lastScroll.set( scroll ); PointF center = Camera.main.center().offset( scroll ); angle = (float)Math.atan2( cellCenter.x - center.x, center.y - cellCenter.y ) * RAD_2_G; } } } }
final int inputTop = (int)(camera.cameraToScreen(0, txtTitle.bottom() + MARGIN).y * (Game.dispWidth / (float)Game.width));
maxZoom = defaultZoom * 2; Camera.reset( new PixelCamera( defaultZoom ) ); uiCamera = Camera.createFullscreen( uiZoom ); Camera.add( uiCamera );
float vy = align((h - SKY_HEIGHT - BUTTON_HEIGHT) / 2f); Point s = Camera.main.cameraToScreen( vx, vy ); viewport = new Camera( s.x, s.y, SKY_WIDTH, SKY_HEIGHT, defaultZoom ); Camera.add( viewport );
@Override protected void onTouchUp( Touch touch ) { if (dragging) { dragging = false; thumb.am = THUMB_ALPHA; } else { PointF p = content.camera.screenToCamera( (int)touch.current.x, (int)touch.current.y ); ScrollPane.this.onClick( p.x, p.y ); } }
public void zoom( float value ) { zoom( value, scroll.x + width / 2, scroll.y + height / 2 ); }