@Test public void testResize () { int width = 800; int height = 600; CameraHelper camera = new CameraHelper(width, height); int newWidth = 1280; int newHeight = 912; camera.resize(newWidth, newHeight); assertEquals(newWidth, camera.getViewportWidth()); assertEquals(newHeight, camera.getViewportHeight()); camera.update(GameTime.getInstance()); assertEquals(newWidth, camera.getViewportWidth()); assertEquals(newHeight, camera.getViewportHeight()); }
public void resize (int width, int height) { Gdx.app.debug("CameraHelper", "resize, new width: " + width + ", new height: " + height); this.width = width; this.height = height; this.calculateOffset(); this.resizeListeners.stream().forEach(consumer -> consumer.onResize(width, height)); }
CameraHelper implements ModificationFinishedListener { public void resize (int width, int height) { Gdx.app.debug("CameraHelper", "resize, new width: " + width + ", new height: " + height); this.width = width; this.height = height; this.calculateOffset(); this.resizeListeners.stream().forEach(consumer -> consumer.onResize(width, height)); } }
CameraHelper implements ModificationFinishedListener { public void resize (int width, int height) { Gdx.app.debug("CameraHelper", "resize, new width: " + width + ", new height: " + height); this.width = width; this.height = height; this.calculateOffset(); this.resizeListeners.stream().forEach(consumer -> consumer.onResize(width, height)); } CameraHelper(int width, int height); }
CameraHelper implements ModificationFinishedListener { public void resize (int width, int height) { Gdx.app.debug("CameraHelper", "resize, new width: " + width + ", new height: " + height); this.width = width; this.height = height; this.calculateOffset(); this.resizeListeners.stream().forEach(consumer -> consumer.onResize(width, height)); } CameraHelper(int width, int height); void calculateOffset(); void translate(float x, float y, float zoom); float getX(); float getY(); float getZoom(); void setZoom(float zoom); Viewport getViewport(); int getViewportWidth(); int getViewportHeight(); void resize(int width, int height); void addResizeListener(ResizeListener listener); void removeResizeListener(ResizeListener listener); void update(GameTime time); CameraMode getMode(); void setMode(CameraMode mode); float getTargetX(); void setTargetX(float targetX); float getTargetY(); void setTargetY(float targetY); void setTargetPos(float targetX, float targetY); void forcePos(float x, float y); void forcePos(); void setTargetMiddlePos(float targetX, float targetY); float getOffsetX(); float getOffsetY(); boolean canScrollX(float deltaX); boolean canScrollY(float deltaY); void setXBounds(float minX, float maxX); void setYBounds(float minY, float maxY); void setBounds(float minX, float maxX, float minY, float maxY); void resetPosition(); void resetBounds(); void reset(); Matrix4 getCombined(); Matrix4 getViewMatrix(); Matrix4 getProjectionMatrix(); Frustum getFrustum(); Vector3 getMousePosition(); @Override void onModificationFinished(T mod, Class<T> cls); void registerMod(T mod, Class<T> cls); void removeMod(Class<T> cls); T getMod(Class<T> cls); void activateMod(Class<T> cls); void deactivateMod(Class<T> cls); OrthographicCamera getOriginalCamera(); int countActiveMods(); @Override String toString(); }
CameraHelper implements ModificationFinishedListener { public void resize (int width, int height) { Gdx.app.debug("CameraHelper", "resize, new width: " + width + ", new height: " + height); this.width = width; this.height = height; this.calculateOffset(); this.resizeListeners.stream().forEach(consumer -> consumer.onResize(width, height)); } CameraHelper(int width, int height); void calculateOffset(); void translate(float x, float y, float zoom); float getX(); float getY(); float getZoom(); void setZoom(float zoom); Viewport getViewport(); int getViewportWidth(); int getViewportHeight(); void resize(int width, int height); void addResizeListener(ResizeListener listener); void removeResizeListener(ResizeListener listener); void update(GameTime time); CameraMode getMode(); void setMode(CameraMode mode); float getTargetX(); void setTargetX(float targetX); float getTargetY(); void setTargetY(float targetY); void setTargetPos(float targetX, float targetY); void forcePos(float x, float y); void forcePos(); void setTargetMiddlePos(float targetX, float targetY); float getOffsetX(); float getOffsetY(); boolean canScrollX(float deltaX); boolean canScrollY(float deltaY); void setXBounds(float minX, float maxX); void setYBounds(float minY, float maxY); void setBounds(float minX, float maxX, float minY, float maxY); void resetPosition(); void resetBounds(); void reset(); Matrix4 getCombined(); Matrix4 getViewMatrix(); Matrix4 getProjectionMatrix(); Frustum getFrustum(); Vector3 getMousePosition(); @Override void onModificationFinished(T mod, Class<T> cls); void registerMod(T mod, Class<T> cls); void removeMod(Class<T> cls); T getMod(Class<T> cls); void activateMod(Class<T> cls); void deactivateMod(Class<T> cls); OrthographicCamera getOriginalCamera(); int countActiveMods(); @Override String toString();  }