// =========================================================== // Getter & Setter // =========================================================== // =========================================================== // Methods for/from SuperClass/Interfaces // =========================================================== // =========================================================== // Methods // =========================================================== //public synchronized void update(final float pWidth, final float pHeight) { public void Update(float pWidth, float pHeight) { lock (_methodLock) { int x = FLOAT_TO_RAW_INT_BITS_ZERO; int y = FLOAT_TO_RAW_INT_BITS_ZERO; int x2 = Float.FloatToRawIntBits(pWidth); int y2 = Float.FloatToRawIntBits(pHeight); int[] bufferData = this.mBufferData; bufferData[0] = x; bufferData[1] = y; bufferData[2] = x; bufferData[3] = y2; bufferData[4] = x2; bufferData[5] = y; bufferData[6] = x2; bufferData[7] = y2; FastFloatBuffer buffer = this.GetFloatBuffer(); buffer.Position(0); buffer.Put(bufferData); buffer.Position(0); base.SetHardwareBufferNeedsUpdate(); } }
// =========================================================== // Getter & Setter // =========================================================== // =========================================================== // Methods for/from SuperClass/Interfaces // =========================================================== // =========================================================== // Methods // =========================================================== public void update(Font pFont, String[] pLines) { lock (_methodLock) { FastFloatBuffer textureFloatBuffer = this.GetFloatBuffer(); textureFloatBuffer.Position(0); Font font = pFont; String[] lines = pLines; int lineCount = lines.Length; for (int i = 0; i < lineCount; i++) { String line = lines[i]; int lineLength = line.Length(); for (int j = 0; j < lineLength; j++) { Letter letter = font.GetLetter(line.CharAt(j)); float letterTextureX = letter.mTextureX; float letterTextureY = letter.mTextureY; float letterTextureX2 = letterTextureX + letter.mTextureWidth; float letterTextureY2 = letterTextureY + letter.mTextureHeight; textureFloatBuffer.Put(letterTextureX); textureFloatBuffer.Put(letterTextureY); textureFloatBuffer.Put(letterTextureX); textureFloatBuffer.Put(letterTextureY2); textureFloatBuffer.Put(letterTextureX2); textureFloatBuffer.Put(letterTextureY2); textureFloatBuffer.Put(letterTextureX2); textureFloatBuffer.Put(letterTextureY2); textureFloatBuffer.Put(letterTextureX2); textureFloatBuffer.Put(letterTextureY); textureFloatBuffer.Put(letterTextureX); textureFloatBuffer.Put(letterTextureY); } } textureFloatBuffer.Position(0); this.SetHardwareBufferNeedsUpdate(); } }
// =========================================================== // Methods // =========================================================== //public synchronized void update() { public void Update() { lock (_methodLock) { BaseTextureRegion textureRegion = this.mTextureRegion; Texture texture = textureRegion.GetTexture(); if (texture == null) { return; } int x1 = Float.FloatToRawIntBits(this.GetX1()); int y1 = Float.FloatToRawIntBits(this.GetY1()); int x2 = Float.FloatToRawIntBits(this.GetX2()); int y2 = Float.FloatToRawIntBits(this.GetY2()); int[] bufferData = this.mBufferData; if (this.mFlippedVertical) { if (this.mFlippedHorizontal) { bufferData[0] = x2; bufferData[1] = y2; bufferData[2] = x2; bufferData[3] = y1; bufferData[4] = x1; bufferData[5] = y2; bufferData[6] = x1; bufferData[7] = y1; } else { bufferData[0] = x1; bufferData[1] = y2; bufferData[2] = x1; bufferData[3] = y1; bufferData[4] = x2; bufferData[5] = y2; bufferData[6] = x2; bufferData[7] = y1; } } else { if (this.mFlippedHorizontal) { bufferData[0] = x2; bufferData[1] = y1; bufferData[2] = x2; bufferData[3] = y2; bufferData[4] = x1; bufferData[5] = y1; bufferData[6] = x1; bufferData[7] = y2; } else { bufferData[0] = x1; bufferData[1] = y1; bufferData[2] = x1; bufferData[3] = y2; bufferData[4] = x2; bufferData[5] = y1; bufferData[6] = x2; bufferData[7] = y2; } } FastFloatBuffer buffer = this.GetFloatBuffer(); buffer.Position(0); buffer.Put(bufferData); buffer.Position(0); base.SetHardwareBufferNeedsUpdate(); } }