Java Code Examples for org.andengine.util.debug.Debug#w()
The following examples show how to use
org.andengine.util.debug.Debug#w() .
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: ButtonSprite.java From tilt-game-android with MIT License | 6 votes |
public ButtonSprite(final float pX, final float pY, final ITiledTextureRegion pTiledTextureRegion, final VertexBufferObjectManager pVertexBufferObjectManager, final OnClickListener pOnClickListener) { super(pX, pY, pTiledTextureRegion, pVertexBufferObjectManager); this.mOnClickListener = pOnClickListener; this.mStateCount = pTiledTextureRegion.getTileCount(); switch (this.mStateCount) { case 1: Debug.w("No " + ITextureRegion.class.getSimpleName() + " supplied for " + State.class.getSimpleName() + "." + State.PRESSED + "."); case 2: Debug.w("No " + ITextureRegion.class.getSimpleName() + " supplied for " + State.class.getSimpleName() + "." + State.DISABLED + "."); break; case 3: break; default: throw new IllegalArgumentException("The supplied " + ITiledTextureRegion.class.getSimpleName() + " has an unexpected amount of states: '" + this.mStateCount + "'."); } this.changeState(State.NORMAL); }
Example 2
Source File: Engine.java From tilt-game-android with MIT License | 6 votes |
public void onDestroy() { if (mDestroyed) return; this.mEngineLock.lock(); try { this.mDestroyed = true; this.mEngineLock.notifyCanUpdate(); } finally { this.mEngineLock.unlock(); } try { this.mUpdateThread.join(); } catch (final InterruptedException e) { Debug.e("Could not join UpdateThread.", e); Debug.w("Trying to manually interrupt UpdateThread."); this.mUpdateThread.interrupt(); } this.releaseDefaultDisplay(); this.mVertexBufferObjectManager.onDestroy(); this.mTextureManager.onDestroy(); this.mFontManager.onDestroy(); this.mShaderProgramManager.onDestroy(); }
Example 3
Source File: ShaderProgramManager.java From tilt-game-android with MIT License | 6 votes |
public synchronized void loadShaderProgram(final ShaderProgram pShaderProgram) { if (pShaderProgram == null) { throw new IllegalArgumentException("pShaderProgram must not be null!"); } if (pShaderProgram.isCompiled()) { Debug.w("Loading an already compiled " + ShaderProgram.class.getSimpleName() + ": '" + pShaderProgram.getClass().getSimpleName() + "'. '" + pShaderProgram.getClass().getSimpleName() + "' will be recompiled."); pShaderProgram.setCompiled(false); } if (this.mShaderProgramsManaged.contains(pShaderProgram)) { Debug.w("Loading an already loaded " + ShaderProgram.class.getSimpleName() + ": '" + pShaderProgram.getClass().getSimpleName() + "'."); } else { this.mShaderProgramsManaged.add(pShaderProgram); } }
Example 4
Source File: ShaderProgramManager.java From 30-android-libraries-in-30-days with Apache License 2.0 | 6 votes |
public synchronized void loadShaderProgram(final ShaderProgram pShaderProgram) { if(pShaderProgram == null) { throw new IllegalArgumentException("pShaderProgram must not be null!"); } if(pShaderProgram.isCompiled()) { Debug.w("Loading an already compiled " + ShaderProgram.class.getSimpleName() + ": '" + pShaderProgram.getClass().getSimpleName() + "'. '" + pShaderProgram.getClass().getSimpleName() + "' will be recompiled."); pShaderProgram.setCompiled(false); } if(this.mShaderProgramsManaged.contains(pShaderProgram)) { Debug.w("Loading an already loaded " + ShaderProgram.class.getSimpleName() + ": '" + pShaderProgram.getClass().getSimpleName() + "'."); } else { this.mShaderProgramsManaged.add(pShaderProgram); } }
Example 5
Source File: ETC1Texture.java From tilt-game-android with MIT License | 6 votes |
public ETC1Texture(final TextureManager pTextureManager, final TextureOptions pTextureOptions, final ITextureStateListener pTextureStateListener) throws IOException { super(pTextureManager, PixelFormat.RGB_565, pTextureOptions, pTextureStateListener); InputStream inputStream = null; try { inputStream = this.getInputStream(); this.mETC1TextureHeader = new ETC1TextureHeader(StreamUtils.streamToBytes(inputStream, ETC1.ETC_PKM_HEADER_SIZE)); if (BuildConfig.DEBUG) { if (!(MathUtils.isPowerOfTwo(this.mETC1TextureHeader.mWidth) && MathUtils.isPowerOfTwo(this.mETC1TextureHeader.mHeight))) { Debug.w("ETC1 textures with NPOT sizes can cause a crash on PowerVR GPUs!"); } } } finally { StreamUtils.close(inputStream); } }
Example 6
Source File: Engine.java From 30-android-libraries-in-30-days with Apache License 2.0 | 6 votes |
public void onDestroy() { this.mEngineLock.lock(); try { this.mDestroyed = true; this.mEngineLock.notifyCanUpdate(); } finally { this.mEngineLock.unlock(); } try { this.mUpdateThread.join(); } catch (final InterruptedException e) { Debug.e("Could not join UpdateThread.", e); Debug.w("Trying to manually interrupt UpdateThread."); this.mUpdateThread.interrupt(); } this.mVertexBufferObjectManager.onDestroy(); this.mTextureManager.onDestroy(); this.mFontManager.onDestroy(); this.mShaderProgramManager.onDestroy(); }
Example 7
Source File: PVRTexture.java From 30-android-libraries-in-30-days with Apache License 2.0 | 5 votes |
@Override protected void writeTextureToHardware(final GLState pGLState) throws IOException { final IPVRTexturePixelBufferStrategyBufferManager pvrTextureLoadStrategyManager = this.mPVRTexturePixelBufferStrategy.newPVRTexturePixelBufferStrategyManager(this); int width = this.getWidth(); int height = this.getHeight(); final int dataLength = this.mPVRTextureHeader.getDataLength(); final int bytesPerPixel = this.mPVRTextureHeader.getBitsPerPixel() / DataConstants.BITS_PER_BYTE; /* Adjust unpack alignment. */ GLES20.glPixelStorei(GLES20.GL_UNPACK_ALIGNMENT, 1); int currentLevel = 0; int currentPixelDataOffset = 0; while (currentPixelDataOffset < dataLength) { if (currentLevel > 0 && (width != height || MathUtils.nextPowerOfTwo(width) != width)) { Debug.w("Mipmap level '" + currentLevel + "' is not squared. Width: '" + width + "', height: '" + height + "'. Texture won't render correctly."); } final int currentPixelDataSize = height * width * bytesPerPixel; /* Load the current level. */ this.mPVRTexturePixelBufferStrategy.loadPVRTextureData(pvrTextureLoadStrategyManager, width, height, bytesPerPixel, this.mPixelFormat, currentLevel, currentPixelDataOffset, currentPixelDataSize); currentPixelDataOffset += currentPixelDataSize; /* Prepare next mipmap level. */ width = Math.max(width / 2, 1); height = Math.max(height / 2, 1); currentLevel++; } /* Restore default unpack alignment. */ GLES20.glPixelStorei(GLES20.GL_UNPACK_ALIGNMENT, GLState.GL_UNPACK_ALIGNMENT_DEFAULT); }
Example 8
Source File: ParallaxBackground.java From tilt-game-android with MIT License | 5 votes |
public ParallaxEntity(final float pParallaxFactor, final IEntity pEntity) { this.mParallaxFactor = pParallaxFactor; this.mEntity = pEntity; // TODO Adjust onDraw calculations, so that these assumptions aren't necessary. if (this.mEntity.getX() != 0) { Debug.w("The X position of a " + this.getClass().getSimpleName() + " is expected to be 0."); } if (this.mEntity.getOffsetCenterX() != 0) { Debug.w("The OffsetCenterXposition of a " + this.getClass().getSimpleName() + " is expected to be 0."); } }
Example 9
Source File: PVRTexture.java From 30-android-libraries-in-30-days with Apache License 2.0 | 5 votes |
public PVRTexture(final TextureManager pTextureManager, final PVRTextureFormat pPVRTextureFormat, final IPVRTexturePixelBufferStrategy pPVRTexturePixelBufferStrategy, final TextureOptions pTextureOptions, final ITextureStateListener pTextureStateListener) throws IllegalArgumentException, IOException { super(pTextureManager, pPVRTextureFormat.getPixelFormat(), pTextureOptions, pTextureStateListener); this.mPVRTexturePixelBufferStrategy = pPVRTexturePixelBufferStrategy; InputStream inputStream = null; try { inputStream = this.getInputStream(); this.mPVRTextureHeader = new PVRTextureHeader(StreamUtils.streamToBytes(inputStream, PVRTextureHeader.SIZE)); } finally { StreamUtils.close(inputStream); } if(this.mPVRTextureHeader.getPVRTextureFormat().getPixelFormat() != pPVRTextureFormat.getPixelFormat()) { throw new IllegalArgumentException("Other PVRTextureFormat: '" + this.mPVRTextureHeader.getPVRTextureFormat().getPixelFormat() + "' found than expected: '" + pPVRTextureFormat.getPixelFormat() + "'."); } if(this.mPVRTextureHeader.getPVRTextureFormat().isCompressed()) { // TODO && ! GLHELPER_EXTENSION_PVRTC] ) { throw new IllegalArgumentException("Invalid PVRTextureFormat: '" + this.mPVRTextureHeader.getPVRTextureFormat() + "'."); } if(this.hasMipMaps()) { switch(pTextureOptions.mMinFilter){ case GLES20.GL_NEAREST_MIPMAP_NEAREST: case GLES20.GL_NEAREST_MIPMAP_LINEAR: case GLES20.GL_LINEAR_MIPMAP_NEAREST: case GLES20.GL_LINEAR_MIPMAP_LINEAR: break; default: if(BuildConfig.DEBUG) { Debug.w("This '" + this.getClass().getSimpleName() + "' contains mipmaps, but the provided '" + pTextureOptions.getClass().getSimpleName() + "' don't have MipMaps enabled on the MinFilter!"); } } } this.mUpdateOnHardwareNeeded = true; }
Example 10
Source File: BaseGameActivity.java From 30-android-libraries-in-30-days with Apache License 2.0 | 5 votes |
private void applyEngineOptions() { final EngineOptions engineOptions = this.mEngine.getEngineOptions(); if(engineOptions.isFullscreen()) { ActivityUtils.requestFullscreen(this); } if(engineOptions.getAudioOptions().needsMusic() || engineOptions.getAudioOptions().needsSound()) { this.setVolumeControlStream(AudioManager.STREAM_MUSIC); } switch(engineOptions.getScreenOrientation()) { case LANDSCAPE_FIXED: this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); break; case LANDSCAPE_SENSOR: if(SystemUtils.SDK_VERSION_GINGERBREAD_OR_LATER) { this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); } else { Debug.w(ScreenOrientation.class.getSimpleName() + "." + ScreenOrientation.LANDSCAPE_SENSOR + " is not supported on this device. Falling back to " + ScreenOrientation.class.getSimpleName() + "." + ScreenOrientation.LANDSCAPE_FIXED); this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } break; case PORTRAIT_FIXED: this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); break; case PORTRAIT_SENSOR: if(SystemUtils.SDK_VERSION_GINGERBREAD_OR_LATER) { this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); } else { Debug.w(ScreenOrientation.class.getSimpleName() + "." + ScreenOrientation.PORTRAIT_SENSOR + " is not supported on this device. Falling back to " + ScreenOrientation.class.getSimpleName() + "." + ScreenOrientation.PORTRAIT_FIXED); this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } break; } }
Example 11
Source File: ButtonSprite.java From 30-android-libraries-in-30-days with Apache License 2.0 | 5 votes |
private void changeState(final State pState) { if(pState == this.mState) { return; } this.mState = pState; final int stateTiledTextureRegionIndex = this.mState.getTiledTextureRegionIndex(); if(stateTiledTextureRegionIndex >= this.mStateCount) { this.setCurrentTileIndex(0); Debug.w(this.getClass().getSimpleName() + " changed its " + State.class.getSimpleName() + " to " + pState.toString() + ", which doesn't have a " + ITextureRegion.class.getSimpleName() + " supplied. Applying default " + ITextureRegion.class.getSimpleName() + "."); } else { this.setCurrentTileIndex(stateTiledTextureRegionIndex); } }
Example 12
Source File: QuadTree.java From 30-android-libraries-in-30-days with Apache License 2.0 | 5 votes |
@Deprecated public synchronized void add(final T pItem, final B pBounds) { if(!this.mRoot.contains(pBounds)) { Debug.w("pBounds are out of the bounds of this " + this.getClass().getSimpleName() + "."); this.mRoot.addItemSafe(pItem); return; } this.mRoot.add(pItem, pBounds); }
Example 13
Source File: QuadTree.java From tilt-game-android with MIT License | 5 votes |
@Deprecated public synchronized void add(final T pItem, final B pBounds) { if (!this.mRoot.contains(pBounds)) { Debug.w("pBounds are out of the bounds of this " + this.getClass().getSimpleName() + "."); this.mRoot.addItemSafe(pItem); return; } this.mRoot.add(pItem, pBounds); }
Example 14
Source File: ColorSwapBitmapTextureAtlasSourceDecorator.java From tilt-game-android with MIT License | 5 votes |
public ColorSwapBitmapTextureAtlasSourceDecorator(final IBitmapTextureAtlasSource pBitmapTextureAtlasSource, final IBitmapTextureAtlasSourceDecoratorShape pBitmapTextureAtlasSourceDecoratorShape, final int pColorKeyColorARGBPackedInt, final int pTolerance, final int pColorSwapColorARGBPackedInt, final TextureAtlasSourceDecoratorOptions pTextureAtlasSourceDecoratorOptions) { super(pBitmapTextureAtlasSource, pBitmapTextureAtlasSourceDecoratorShape, pTextureAtlasSourceDecoratorOptions); this.mColorKeyColorARGBPackedInt = pColorKeyColorARGBPackedInt; this.mTolerance = pTolerance; this.mColorSwapColorARGBPackedInt = pColorSwapColorARGBPackedInt; this.mPaint.setXfermode(new AvoidXfermode(pColorKeyColorARGBPackedInt, pTolerance, Mode.TARGET)); this.mPaint.setColor(pColorSwapColorARGBPackedInt); if (SystemUtils.isAndroidVersionOrHigher(Build.VERSION_CODES.JELLY_BEAN)) { Debug.w("The class " + ColorSwapBitmapTextureAtlasSourceDecorator.class.getSimpleName() + " is deprecated for Android API Level: '" + Build.VERSION_CODES.JELLY_BEAN + "' and higher, since the class " + AvoidXfermode.class.getSimpleName() + " is deprecated since then."); } }
Example 15
Source File: ColorSwapBitmapTextureAtlasSource.java From tilt-game-android with MIT License | 5 votes |
protected Bitmap swapColor(final Bitmap pBitmap) { final Config config = pBitmap.getConfig(); switch (config) { case ARGB_8888: return ColorSwapBitmapTextureAtlasSource.swapColorARGB_8888(pBitmap, this.mColorKeyColorARGBPackedInt, this.mTolerance, this.mColorSwapColorARGBPackedInt); default: Debug.w("Unexpected " + Bitmap.Config.class.getSimpleName() + ": '" + config + "'."); return pBitmap; } }
Example 16
Source File: PVRTexture.java From tilt-game-android with MIT License | 5 votes |
@Override protected void writeTextureToHardware(final GLState pGLState) throws IOException { final IPVRTexturePixelBufferStrategyBufferManager pvrTextureLoadStrategyManager = this.mPVRTexturePixelBufferStrategy.newPVRTexturePixelBufferStrategyManager(this); int width = this.getWidth(); int height = this.getHeight(); final int dataLength = this.mPVRTextureHeader.getDataLength(); final int bytesPerPixel = this.mPVRTextureHeader.getBitsPerPixel() / DataConstants.BITS_PER_BYTE; /* Adjust unpack alignment. */ GLES20.glPixelStorei(GLES20.GL_UNPACK_ALIGNMENT, 1); int currentLevel = 0; int currentPixelDataOffset = 0; while (currentPixelDataOffset < dataLength) { if (currentLevel > 0 && (width != height || MathUtils.nextPowerOfTwo(width) != width)) { Debug.w("Mipmap level '" + currentLevel + "' is not squared. Width: '" + width + "', height: '" + height + "'. Texture won't render correctly."); } final int currentPixelDataSize = height * width * bytesPerPixel; /* Load the current level. */ this.mPVRTexturePixelBufferStrategy.loadPVRTextureData(pvrTextureLoadStrategyManager, width, height, bytesPerPixel, this.mPixelFormat, currentLevel, currentPixelDataOffset, currentPixelDataSize); currentPixelDataOffset += currentPixelDataSize; /* Prepare next mipmap level. */ width = Math.max(width / 2, 1); height = Math.max(height / 2, 1); currentLevel++; } /* Restore default unpack alignment. */ GLES20.glPixelStorei(GLES20.GL_UNPACK_ALIGNMENT, GLState.GL_UNPACK_ALIGNMENT_DEFAULT); }
Example 17
Source File: PVRTexture.java From tilt-game-android with MIT License | 5 votes |
public PVRTexture(final TextureManager pTextureManager, final PVRTextureFormat pPVRTextureFormat, final IPVRTexturePixelBufferStrategy pPVRTexturePixelBufferStrategy, final TextureOptions pTextureOptions, final ITextureStateListener pTextureStateListener) throws IllegalArgumentException, IOException { super(pTextureManager, pPVRTextureFormat.getPixelFormat(), pTextureOptions, pTextureStateListener); this.mPVRTexturePixelBufferStrategy = pPVRTexturePixelBufferStrategy; InputStream inputStream = null; try { inputStream = this.getInputStream(); this.mPVRTextureHeader = new PVRTextureHeader(StreamUtils.streamToBytes(inputStream, PVRTextureHeader.SIZE)); } finally { StreamUtils.close(inputStream); } if (this.mPVRTextureHeader.getPVRTextureFormat().getPixelFormat() != pPVRTextureFormat.getPixelFormat()) { throw new IllegalArgumentException("Other PVRTextureFormat: '" + this.mPVRTextureHeader.getPVRTextureFormat().getPixelFormat() + "' found than expected: '" + pPVRTextureFormat.getPixelFormat() + "'."); } if (this.mPVRTextureHeader.getPVRTextureFormat().isCompressed()) { // TODO && ! GLHELPER_EXTENSION_PVRTC] ) { throw new IllegalArgumentException("Invalid PVRTextureFormat: '" + this.mPVRTextureHeader.getPVRTextureFormat() + "'."); } if (this.hasMipMaps()) { switch (pTextureOptions.mMinFilter) { case GLES20.GL_NEAREST_MIPMAP_NEAREST: case GLES20.GL_NEAREST_MIPMAP_LINEAR: case GLES20.GL_LINEAR_MIPMAP_NEAREST: case GLES20.GL_LINEAR_MIPMAP_LINEAR: break; default: if (BuildConfig.DEBUG) { Debug.w("This '" + this.getClass().getSimpleName() + "' contains mipmaps, but the provided '" + pTextureOptions.getClass().getSimpleName() + "' don't have MipMaps enabled on the MinFilter!"); } } } this.mUpdateOnHardwareNeeded = true; }
Example 18
Source File: BaseGameActivity.java From tilt-game-android with MIT License | 5 votes |
private void applyEngineOptions() { final EngineOptions engineOptions = this.mEngine.getEngineOptions(); if (engineOptions.isFullscreen()) { ActivityUtils.requestFullscreen(this); } if (engineOptions.getAudioOptions().needsMusic() || engineOptions.getAudioOptions().needsSound()) { this.setVolumeControlStream(AudioManager.STREAM_MUSIC); } switch (engineOptions.getScreenOrientation()) { case LANDSCAPE_FIXED: this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); break; case LANDSCAPE_SENSOR: if (SystemUtils.SDK_VERSION_GINGERBREAD_OR_LATER) { this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); } else { Debug.w(ScreenOrientation.class.getSimpleName() + "." + ScreenOrientation.LANDSCAPE_SENSOR + " is not supported on this device. Falling back to " + ScreenOrientation.class.getSimpleName() + "." + ScreenOrientation.LANDSCAPE_FIXED); this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } break; case PORTRAIT_FIXED: this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); break; case PORTRAIT_SENSOR: if (SystemUtils.SDK_VERSION_GINGERBREAD_OR_LATER) { this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); } else { Debug.w(ScreenOrientation.class.getSimpleName() + "." + ScreenOrientation.PORTRAIT_SENSOR + " is not supported on this device. Falling back to " + ScreenOrientation.class.getSimpleName() + "." + ScreenOrientation.PORTRAIT_FIXED); this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } break; } }
Example 19
Source File: ButtonSprite.java From tilt-game-android with MIT License | 5 votes |
private void changeState(final State pState) { if (pState == this.mState) { return; } this.mState = pState; final int stateTiledTextureRegionIndex = this.mState.getTiledTextureRegionIndex(); if (stateTiledTextureRegionIndex >= this.mStateCount) { this.setCurrentTileIndex(0); Debug.w(this.getClass().getSimpleName() + " changed its " + State.class.getSimpleName() + " to " + pState.toString() + ", which doesn't have a " + ITextureRegion.class.getSimpleName() + " supplied. Applying default " + ITextureRegion.class.getSimpleName() + "."); } else { this.setCurrentTileIndex(stateTiledTextureRegionIndex); } }
Example 20
Source File: LevelLoaderContentHandler.java From tilt-game-android with MIT License | 4 votes |
@Override public void startElement(final String pUri, final String pLocalName, final String pQualifiedName, final Attributes pAttributes) throws SAXException, LevelLoaderException { final String entityName = pLocalName; final IEntity parent = (this.mParentEntityStack.isEmpty()) ? null : this.mParentEntityStack.getLast(); IEntityLoader<T> entityLoader = this.mEntityLoaders.get(entityName); if (entityLoader == null) { if (this.mDefaultEntityLoader == null) { throw new LevelLoaderException("Unexpected tag: '" + entityName + "'."); } else { entityLoader = this.mDefaultEntityLoader; } } final IEntity entity; try { entity = entityLoader.onLoadEntity(entityName, parent, pAttributes, this.mEntityLoaderData); } catch (final IOException e) { throw new LevelLoaderException("Exception when loading entity: '" + entityName + "'.", e); } if (entity == null) { if (BuildConfig.DEBUG) { Debug.w("No '" + IEntity.class.getSimpleName() + "' created for entity name: '" + entityName + "'."); } } else { if (parent == null) { if (this.mRootEntity == null) { this.mRootEntity = entity; } } else { parent.attachChild(entity); } if (this.mEntityLoaderListener != null) { this.mEntityLoaderListener.onEntityLoaded(entity, pAttributes); } } this.mParentEntityStack.addLast(entity); }