com.badlogic.gdx.graphics.glutils.HdpiUtils Java Examples
The following examples show how to use
com.badlogic.gdx.graphics.glutils.HdpiUtils.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RetroSceneScreen.java From bladecoder-adventure-engine with Apache License 2.0 | 6 votes |
public RetroSceneScreen() { screenViewport = new SceneFitViewport(); worldViewport = new Viewport() { // This is the World Viewport. It is like a ScreenViewport but the // camera is the same that the screenViewport; @Override public void apply(boolean centerCamera) { HdpiUtils.glViewport(getScreenX(), getScreenY(), getScreenWidth(), getScreenHeight()); getCamera().viewportWidth = getScreenWidth(); getCamera().viewportHeight = getScreenHeight(); if (centerCamera) getCamera().position.set(getScreenWidth() / 2, getScreenHeight() / 2, 0); getCamera().update(); } }; worldViewport.setCamera(screenViewport.getCamera()); }
Example #2
Source File: SceneExtendViewport.java From bladecoder-adventure-engine with Apache License 2.0 | 5 votes |
@Override public void apply(boolean centerCamera) { HdpiUtils.glViewport(getScreenX(), getScreenY(), getScreenWidth(), getScreenHeight()); getCamera().viewportWidth = getScreenWidth(); getCamera().viewportHeight = getScreenHeight(); if (centerCamera) getCamera().position.set(getScreenWidth() / 2, getScreenHeight() / 2, 0); getCamera().update(); }
Example #3
Source File: SceneFitViewport.java From bladecoder-adventure-engine with Apache License 2.0 | 5 votes |
@Override public void apply (boolean centerCamera) { HdpiUtils.glViewport(getScreenX(), getScreenY(), getScreenWidth(), getScreenHeight()); getCamera().viewportWidth = getScreenWidth(); getCamera().viewportHeight = getScreenHeight(); if (centerCamera) getCamera().position.set(getScreenWidth() / 2, getScreenHeight() / 2, 0); getCamera().update(); }
Example #4
Source File: ViewportWidget.java From talos with Apache License 2.0 | 4 votes |
@Override public void draw(Batch batch, float parentAlpha) { batch.end(); localToScreenCoordinates(temp.set(0, 0)); int x = (int)temp.x; int y = (int)temp.y; localToScreenCoordinates(temp.set(getWidth(), getHeight())); int x2 = (int)temp.x; int y2 = (int)temp.y; int ssWidth = x2 - x; int ssHeight = y - y2; HdpiUtils.glViewport(x, Gdx.graphics.getHeight() - y, ssWidth, ssHeight); Gdx.gl.glClearColor(bgColor.r, bgColor.g, bgColor.b, 1f); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); float aspect = getWidth()/getHeight(); camera.viewportHeight = camera.viewportWidth / aspect; camera.update(); prevTransform.set(batch.getTransformMatrix()); prevProjection.set(batch.getProjectionMatrix()); batch.setProjectionMatrix(camera.combined); batch.setTransformMatrix(emptyTransform); batch.begin(); drawContent(batch, parentAlpha); batch.end(); HdpiUtils.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); batch.setProjectionMatrix(prevProjection); batch.setTransformMatrix(prevTransform); batch.begin(); super.draw(batch, parentAlpha); }
Example #5
Source File: BasePicker.java From Mundus with Apache License 2.0 | 4 votes |
protected void begin(Viewport viewport) { fbo.begin(); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT); HdpiUtils.glViewport(viewport.getScreenX(), viewport.getScreenY(), viewport.getScreenWidth(), viewport.getScreenHeight()); }