use of com.watabou.utils.PointF in project pixel-dungeon by watabou.
the class CellEmitter method get.
public static Emitter get(int cell) {
PointF p = DungeonTilemap.tileToWorld(cell);
Emitter emitter = GameScene.emitter();
emitter.pos(p.x, p.y, DungeonTilemap.SIZE, DungeonTilemap.SIZE);
return emitter;
}
use of com.watabou.utils.PointF in project pixel-dungeon by watabou.
the class CellEmitter method bottom.
public static Emitter bottom(int cell) {
PointF p = DungeonTilemap.tileToWorld(cell);
Emitter emitter = GameScene.emitter();
emitter.pos(p.x, p.y + DungeonTilemap.SIZE, DungeonTilemap.SIZE, 0);
return emitter;
}
use of com.watabou.utils.PointF in project pixel-dungeon by watabou.
the class CellEmitter method center.
public static Emitter center(int cell) {
PointF p = DungeonTilemap.tileToWorld(cell);
Emitter emitter = GameScene.emitter();
emitter.pos(p.x + DungeonTilemap.SIZE / 2, p.y + DungeonTilemap.SIZE / 2);
return emitter;
}
use of com.watabou.utils.PointF in project PD-classes by watabou.
the class BitmapTextMultiline method updateVertices.
@Override
protected void updateVertices() {
if (text == null) {
text = "";
}
quads = Quad.createSet(text.length());
realLength = 0;
// This object controls lines breaking
SymbolWriter writer = new SymbolWriter();
// Word size
PointF metrics = new PointF();
String[] paragraphs = PARAGRAPH.split(text);
// Current character (used in masking)
int pos = 0;
for (int i = 0; i < paragraphs.length; i++) {
String[] words = WORD.split(paragraphs[i]);
for (int j = 0; j < words.length; j++) {
String word = words[j];
if (word.length() == 0) {
// several spaces coming along
continue;
}
getWordMetrics(word, metrics);
writer.addSymbol(metrics.x, metrics.y);
int length = word.length();
// Position in pixels relative to the beginning of the word
float shift = 0;
for (int k = 0; k < length; k++) {
RectF rect = font.get(word.charAt(k));
float w = font.width(rect);
float h = font.height(rect);
if (mask == null || mask[pos]) {
vertices[0] = writer.x + shift;
vertices[1] = writer.y;
vertices[2] = rect.left;
vertices[3] = rect.top;
vertices[4] = writer.x + shift + w;
vertices[5] = writer.y;
vertices[6] = rect.right;
vertices[7] = rect.top;
vertices[8] = writer.x + shift + w;
vertices[9] = writer.y + h;
vertices[10] = rect.right;
vertices[11] = rect.bottom;
vertices[12] = writer.x + shift;
vertices[13] = writer.y + h;
vertices[14] = rect.left;
vertices[15] = rect.bottom;
quads.put(vertices);
realLength++;
}
shift += w + font.tracking;
pos++;
}
writer.addSpace(spaceSize);
}
writer.newLine(0, font.lineHeight);
}
nLines = writer.nLines();
dirty = false;
}
use of com.watabou.utils.PointF in project pixel-dungeon by watabou.
the class CharSprite method bloodBurstA.
public void bloodBurstA(PointF from, int damage) {
if (visible) {
PointF c = center();
int n = (int) Math.min(9 * Math.sqrt((double) damage / ch.HT), 9);
Splash.at(c, PointF.angle(from, c), 3.1415926f / 2, blood(), n);
}
}
Aggregations