v0.4.2: reintroduced scissoring, now only used when its needed
This commit is contained in:
parent
275dcf8863
commit
23ac0135f3
|
@ -37,6 +37,8 @@ public class Camera extends Gizmo {
|
||||||
|
|
||||||
public static Camera main;
|
public static Camera main;
|
||||||
|
|
||||||
|
public boolean fullScreen;
|
||||||
|
|
||||||
public float zoom;
|
public float zoom;
|
||||||
|
|
||||||
public int x;
|
public int x;
|
||||||
|
@ -101,10 +103,12 @@ public class Camera extends Gizmo {
|
||||||
public static Camera createFullscreen( float zoom ) {
|
public static Camera createFullscreen( float zoom ) {
|
||||||
int w = (int)Math.ceil( Game.width / zoom );
|
int w = (int)Math.ceil( Game.width / zoom );
|
||||||
int h = (int)Math.ceil( Game.height / zoom );
|
int h = (int)Math.ceil( Game.height / zoom );
|
||||||
return new Camera(
|
Camera c = new Camera(
|
||||||
(int)(Game.width - w * zoom) / 2,
|
(int)(Game.width - w * zoom) / 2,
|
||||||
(int)(Game.height - h * zoom) / 2,
|
(int)(Game.height - h * zoom) / 2,
|
||||||
w, h, zoom );
|
w, h, zoom );
|
||||||
|
c.fullScreen = true;
|
||||||
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Camera( int x, int y, int width, int height, float zoom ) {
|
public Camera( int x, int y, int width, int height, float zoom ) {
|
||||||
|
|
|
@ -217,6 +217,7 @@ public class Game extends Activity implements GLSurfaceView.Renderer, View.OnTou
|
||||||
|
|
||||||
NoosaScript.get().resetCamera();
|
NoosaScript.get().resetCamera();
|
||||||
NoosaScriptNoLighting.get().resetCamera();
|
NoosaScriptNoLighting.get().resetCamera();
|
||||||
|
GLES20.glDisable( GLES20.GL_SCISSOR_TEST );
|
||||||
GLES20.glClear( GLES20.GL_COLOR_BUFFER_BIT );
|
GLES20.glClear( GLES20.GL_COLOR_BUFFER_BIT );
|
||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,6 +179,17 @@ public class NoosaScript extends Script {
|
||||||
if (camera != lastCamera && camera.matrix != null) {
|
if (camera != lastCamera && camera.matrix != null) {
|
||||||
lastCamera = camera;
|
lastCamera = camera;
|
||||||
uCamera.valueM4( camera.matrix );
|
uCamera.valueM4( camera.matrix );
|
||||||
|
|
||||||
|
if (!camera.fullScreen) {
|
||||||
|
GLES20.glEnable( GLES20.GL_SCISSOR_TEST );
|
||||||
|
GLES20.glScissor(
|
||||||
|
camera.x,
|
||||||
|
Game.height - camera.screenHeight - camera.y,
|
||||||
|
camera.screenWidth,
|
||||||
|
camera.screenHeight);
|
||||||
|
} else {
|
||||||
|
GLES20.glDisable( GLES20.GL_SCISSOR_TEST );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -305,6 +305,7 @@ public class PixelScene extends Scene {
|
||||||
(int)(Game.height - Math.ceil( Game.height / zoom ) * zoom) / 2,
|
(int)(Game.height - Math.ceil( Game.height / zoom ) * zoom) / 2,
|
||||||
(int)Math.ceil( Game.width / zoom ),
|
(int)Math.ceil( Game.width / zoom ),
|
||||||
(int)Math.ceil( Game.height / zoom ), zoom );
|
(int)Math.ceil( Game.height / zoom ), zoom );
|
||||||
|
fullScreen = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue
Block a user