Java Code Examples for org.andengine.engine.camera.Camera#onDrawHUD()

The following examples show how to use org.andengine.engine.camera.Camera#onDrawHUD() . 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: Engine.java    From tilt-game-android with MIT License 5 votes vote down vote up
protected void onDrawScene(final GLState pGLState, final Camera pCamera) {
	if (this.mScene != null) {
		this.mScene.onDraw(pGLState, pCamera);
	}

	pCamera.onDrawHUD(pGLState);
}
 
Example 2
Source File: SingleSceneSplitScreenEngine.java    From tilt-game-android with MIT License 5 votes vote down vote up
@Override
protected void onDrawScene(final GLState pGLState, final Camera pFirstCamera) {
	if (super.mScene != null) {
		final Camera secondCamera = this.getSecondCamera();

		final int surfaceWidth = this.mSurfaceWidth;
		final int surfaceWidthHalf = surfaceWidth >> 1;

		final int surfaceHeight = this.mSurfaceHeight;

		pGLState.enableScissorTest();

		/* First Screen. With first camera, on the left half of the screens width. */
		{
			GLES20.glScissor(0, 0, surfaceWidthHalf, surfaceHeight);
			GLES20.glViewport(0, 0, surfaceWidthHalf, surfaceHeight);

			super.mScene.onDraw(pGLState, pFirstCamera);
			pFirstCamera.onDrawHUD(pGLState);
		}

		/* Second Screen. With second camera, on the right half of the screens width. */
		{
			GLES20.glScissor(surfaceWidthHalf, 0, surfaceWidthHalf, surfaceHeight);
			GLES20.glViewport(surfaceWidthHalf, 0, surfaceWidthHalf, surfaceHeight);

			super.mScene.onDraw(pGLState, secondCamera);
			secondCamera.onDrawHUD(pGLState);
		}

		pGLState.disableScissorTest();
	}
}
 
Example 3
Source File: DoubleSceneSplitScreenEngine.java    From tilt-game-android with MIT License 5 votes vote down vote up
@Override
protected void onDrawScene(final GLState pGLState, final Camera pFirstCamera) {
	final Camera secondCamera = this.getSecondCamera();

	final int surfaceWidth = this.mSurfaceWidth;
	final int surfaceWidthHalf = surfaceWidth >> 1;

	final int surfaceHeight = this.mSurfaceHeight;

	pGLState.enableScissorTest();

	/* First Screen. With first camera, on the left half of the screens width. */
	if (super.mScene != null) {
		GLES20.glScissor(0, 0, surfaceWidthHalf, surfaceHeight);
		GLES20.glViewport(0, 0, surfaceWidthHalf, surfaceHeight);

		super.mScene.onDraw(pGLState, pFirstCamera);
		pFirstCamera.onDrawHUD(pGLState);
	}

	/* Second Screen. With second camera, on the right half of the screens width. */
	if (this.mSecondScene != null) {
		GLES20.glScissor(surfaceWidthHalf, 0, surfaceWidthHalf, surfaceHeight);
		GLES20.glViewport(surfaceWidthHalf, 0, surfaceWidthHalf, surfaceHeight);

		this.mSecondScene.onDraw(pGLState, secondCamera);
		secondCamera.onDrawHUD(pGLState);
	}

	pGLState.disableScissorTest();
}
 
Example 4
Source File: Engine.java    From 30-android-libraries-in-30-days with Apache License 2.0 5 votes vote down vote up
protected void onDrawScene(final GLState pGLState, final Camera pCamera) {
	if(this.mScene != null) {
		this.mScene.onDraw(pGLState, pCamera);
	}

	pCamera.onDrawHUD(pGLState);
}
 
Example 5
Source File: SingleSceneSplitScreenEngine.java    From 30-android-libraries-in-30-days with Apache License 2.0 5 votes vote down vote up
@Override
protected void onDrawScene(final GLState pGLState, final Camera pFirstCamera) {
	if(super.mScene != null) {
		final Camera secondCamera = this.getSecondCamera();

		final int surfaceWidth = this.mSurfaceWidth;
		final int surfaceWidthHalf = surfaceWidth >> 1;

		final int surfaceHeight = this.mSurfaceHeight;

		pGLState.enableScissorTest();

		/* First Screen. With first camera, on the left half of the screens width. */
		{
			GLES20.glScissor(0, 0, surfaceWidthHalf, surfaceHeight);
			GLES20.glViewport(0, 0, surfaceWidthHalf, surfaceHeight);

			super.mScene.onDraw(pGLState, pFirstCamera);
			pFirstCamera.onDrawHUD(pGLState);
		}

		/* Second Screen. With second camera, on the right half of the screens width. */
		{
			GLES20.glScissor(surfaceWidthHalf, 0, surfaceWidthHalf, surfaceHeight);
			GLES20.glViewport(surfaceWidthHalf, 0, surfaceWidthHalf, surfaceHeight);

			super.mScene.onDraw(pGLState, secondCamera);
			secondCamera.onDrawHUD(pGLState);
		}

		pGLState.disableScissorTest();
	}
}
 
Example 6
Source File: DoubleSceneSplitScreenEngine.java    From 30-android-libraries-in-30-days with Apache License 2.0 5 votes vote down vote up
@Override
protected void onDrawScene(final GLState pGLState, final Camera pFirstCamera) {
	final Camera secondCamera = this.getSecondCamera();

	final int surfaceWidth = this.mSurfaceWidth;
	final int surfaceWidthHalf = surfaceWidth >> 1;

	final int surfaceHeight = this.mSurfaceHeight;

	pGLState.enableScissorTest();

	/* First Screen. With first camera, on the left half of the screens width. */
	if(super.mScene != null) {
		GLES20.glScissor(0, 0, surfaceWidthHalf, surfaceHeight);
		GLES20.glViewport(0, 0, surfaceWidthHalf, surfaceHeight);

		super.mScene.onDraw(pGLState, pFirstCamera);
		pFirstCamera.onDrawHUD(pGLState);
	}

	/* Second Screen. With second camera, on the right half of the screens width. */
	if(this.mSecondScene != null) {
		GLES20.glScissor(surfaceWidthHalf, 0, surfaceWidthHalf, surfaceHeight);
		GLES20.glViewport(surfaceWidthHalf, 0, surfaceWidthHalf, surfaceHeight);

		this.mSecondScene.onDraw(pGLState, secondCamera);
		secondCamera.onDrawHUD(pGLState);
	}

	pGLState.disableScissorTest();
}