示例#1
0
文件: LFont.java 项目: dayt888/LGame
 @Override
 public void drawString(GLEx g, String string, float tx, float ty, float angle, LColor c) {
   if (c == null || c.a <= 0.01) {
     return;
   }
   if (StringUtils.isEmpty(string)) {
     return;
   }
   LSTRDictionary.drawString(g, this, string, _offset.x + tx, _offset.y + ty, angle, c);
 }
示例#2
0
 /**
  * 设定选择器的基本构成(背景图,文字信息,信息连接顺序,字体,坐标)
  *
  * @param image
  * @param messages
  * @param joint
  * @param font
  * @param x
  * @param y
  */
 public void set(LTexture image, String[][] messages, int[] joint, LFont font, int x, int y) {
   super.exist = true;
   super.cancelflag = false;
   StringBuffer sbr = new StringBuffer(100);
   for (int j = 0; j < messages.length; j++) {
     for (int i = 0; i < messages[j].length; i++) {
       sbr.append(messages[j][i]);
     }
   }
   LSTRDictionary.bind(font, sbr.toString());
   this.dialogImage = image;
   this.defFont = font;
   this.choice = messages;
   this.joint = joint;
   this.posX = x;
   this.posY = y;
   this.tab = 10;
   this.mesList = new int[messages[0].length];
   for (int i = 0; i < mesList.length; i++) {
     mesList[i] = 0;
   }
   for (int i = 0; i < messages.length; i++) {
     for (int j = 0; j < messages[i].length; j++) {
       int width = defFont.stringWidth(messages[i][j]);
       if (mesList[j] < width) {
         mesList[j] = width;
       }
     }
   }
   // 单独一行高度
   this.height = defFont.getHeight();
   // 获得默认的上下文间隔大小
   this.space = height + defFont.getSize() / 2;
   this.width = getWidthTotal(mesList, tab);
   // 颜色集合(用以改变指定行选项颜色)
   this.colors = new LColor[messages.length];
   for (int i = 0; i < colors.length; i++) {
     colors[i] = null;
   }
   this.view = 0;
   this.maxSize = choice.length;
   this.select = 0;
   this.visible = true;
 }