v0.7.4b: Initial LibGDX commit! more details below:
Large sections of game logic are now working through libgdx instead of android libraries. There is still work to do but this is the first major step. Big changes include: - Graphics code is now through LibGDX (except for text rendering) - Initialization and screen-handling logic is now mostly through LibGDX - Audio is now through LibGDX - Input handling is now through LibGDX - Most misc functions are now through LibGDX
This commit is contained in:
@@ -21,8 +21,7 @@
|
||||
|
||||
package com.watabou.noosa;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
|
||||
import com.badlogic.gdx.graphics.Pixmap;
|
||||
import com.watabou.gltextures.SmartTexture;
|
||||
import com.watabou.gltextures.TextureCache;
|
||||
import com.watabou.glwrap.Matrix;
|
||||
@@ -264,8 +263,8 @@ public class BitmapText extends Visual {
|
||||
lineHeight = baseLine = height;
|
||||
}
|
||||
|
||||
protected void splitBy( Bitmap bitmap, int height, int color, String chars ) {
|
||||
|
||||
protected void splitBy( Pixmap bitmap, int height, int color, String chars ) {
|
||||
|
||||
int length = chars.length();
|
||||
|
||||
int width = bitmap.getWidth();
|
||||
@@ -302,7 +301,7 @@ public class BitmapText extends Visual {
|
||||
}
|
||||
found = false;
|
||||
for (int j=line; j < line + height; j++) {
|
||||
if (bitmap.getPixel( separator, j ) != color) {
|
||||
if (colorNotMatch( bitmap, separator, j, color)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
@@ -320,7 +319,7 @@ public class BitmapText extends Visual {
|
||||
}
|
||||
found = true;
|
||||
for (int j=line; j < line + height; j++) {
|
||||
if (bitmap.getPixel( separator, j ) != color) {
|
||||
if (colorNotMatch( bitmap, separator, j, color)) {
|
||||
found = false;
|
||||
break;
|
||||
}
|
||||
@@ -335,13 +334,22 @@ public class BitmapText extends Visual {
|
||||
lineHeight = baseLine = height( frames.get( chars.charAt( 0 ) ) );
|
||||
}
|
||||
|
||||
public static Font colorMarked( Bitmap bmp, int color, String chars ) {
|
||||
//FIXME
|
||||
private boolean colorNotMatch(Pixmap pixmap, int x, int y, int color) {
|
||||
int pixel = pixmap.getPixel(x, y);
|
||||
if ((pixel & 0xFF) == 0) {
|
||||
return color != 0;
|
||||
}
|
||||
return pixel != color;
|
||||
}
|
||||
|
||||
public static Font colorMarked( Pixmap bmp, int color, String chars ) {
|
||||
Font font = new Font( TextureCache.get( bmp ) );
|
||||
font.splitBy( bmp, bmp.getHeight(), color, chars );
|
||||
return font;
|
||||
}
|
||||
|
||||
public static Font colorMarked( Bitmap bmp, int height, int color, String chars ) {
|
||||
public static Font colorMarked( Pixmap bmp, int height, int color, String chars ) {
|
||||
Font font = new Font( TextureCache.get( bmp ) );
|
||||
font.splitBy( bmp, height, color, chars );
|
||||
return font;
|
||||
|
||||
Reference in New Issue
Block a user