Android Open Source - NotATop Draw Score






From Project

Back to project page NotATop.

License

The source code is released under:

GNU General Public License

If you think the Android project NotATop listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.gg.module;
//  ww  w.  j  a  v  a 2 s .co m
import javax.microedition.khronos.opengles.GL10;

import com.gg.util.TextureRect;
import com.gg.view.ClassicGameSurfaceView;
import com.gg.view.TimeGameSurfaceView;

public class DrawScore {

  ClassicGameSurfaceView mv;
  TimeGameSurfaceView tv;
  TextureRect[] numbers=new TextureRect[10];
  
  private int score;
  private float numberSize = 0.2f;
  private float adjaceney = 0.20f; // ???
  
  public DrawScore(int texId,ClassicGameSurfaceView mv)
  {
    this.mv=mv;
    
    //????0-9???????????????
    for(int i=0;i<10;i++)
    {
      numbers[i]=new TextureRect
            (
                
                numberSize,numberSize,0,
                texId,
                new float[]//??????????
                 {
                   0.1f*i,0, 0.1f*i,1, 0.1f*(i+1),1,
                   0.1f*(i+1),1, 0.1f*(i+1),0,  0.1f*i,0
                 }
             ); 
    }
  }
  
  public DrawScore(int texId,TimeGameSurfaceView mv) {
    // TODO Auto-generated constructor stub
    
    this.tv = mv;
    
    //????0-9???????????????
    for(int i=0;i<10;i++)
    {
      numbers[i]=new TextureRect
            (
                
                numberSize,numberSize,0,
                texId,
                new float[]//??????????
                 {
                   0.1f*i,0, 0.1f*i,1, 0.1f*(i+1),1,
                   0.1f*(i+1),1, 0.1f*(i+1),0,  0.1f*i,0
                 }
             ); 
    }
  }

  public void drawSelf(GL10 gl)//?????
  {    
    String scoreStr=score+"";
    for(int i=0;i<scoreStr.length();i++)
    {//????????????????????
      char c=scoreStr.charAt(i);
      gl.glPushMatrix();
      gl.glTranslatef(i*adjaceney, 0, 0);
      numbers[c-'0'].drawSelf(gl);
      gl.glPopMatrix();
    }
    //System.out.println("score = "+scoreStr);
  }

  

  public int getScore() {
    return score;
  }

  public void setScore(int score) {
    this.score = score;
  }
  
  
  
}




Java Source Code List

com.gg.game.ClassicGame.java
com.gg.game.ClassicGame.java
com.gg.game.GameFrame.java
com.gg.game.GameFrame.java
com.gg.game.TimeGame.java
com.gg.game.TimeGame.java
com.gg.module.DrawBackground.java
com.gg.module.DrawBackground.java
com.gg.module.DrawScore.java
com.gg.module.DrawScore.java
com.gg.module.DrawTrack.java
com.gg.module.DrawTrack.java
com.gg.module.SelectControl.java
com.gg.module.SelectControl.java
com.gg.module.SoundControl.java
com.gg.module.SoundControl.java
com.gg.module.VoiceControl.java
com.gg.module.VoiceControl.java
com.gg.top.BasicTop.java
com.gg.top.BasicTop.java
com.gg.top.DrawCircle.java
com.gg.top.DrawCircle.java
com.gg.top.DrawCone.java
com.gg.top.DrawCone.java
com.gg.top.DrawCylinder.java
com.gg.top.DrawCylinder.java
com.gg.top.DrawTop.java
com.gg.top.DrawTop.java
com.gg.util.Circle.java
com.gg.util.Circle.java
com.gg.util.Constant.java
com.gg.util.Constant.java
com.gg.util.DateUtil.java
com.gg.util.DateUtil.java
com.gg.util.Direction.java
com.gg.util.Direction.java
com.gg.util.Line.java
com.gg.util.Line.java
com.gg.util.Point.java
com.gg.util.Point.java
com.gg.util.TextureRect.java
com.gg.util.TextureRect.java
com.gg.util.TrackPoint.java
com.gg.util.TrackPoint.java
com.gg.util.Track.java
com.gg.util.Track.java
com.gg.util.Utils.java
com.gg.util.Utils.java
com.gg.view.ClassicGameSurfaceView.java
com.gg.view.ClassicGameSurfaceView.java
com.gg.view.EndSurfaceView.java
com.gg.view.EndSurfaceView.java
com.gg.view.FirstTimeSurfaceView.java
com.gg.view.FirstTimeSurfaceView.java
com.gg.view.GameModeSurfaceView.java
com.gg.view.GameModeSurfaceView.java
com.gg.view.HelpSurfaceView.java
com.gg.view.HelpSurfaceView.java
com.gg.view.MainActivity.java
com.gg.view.MainActivity.java
com.gg.view.MainMenuSurfaceView.java
com.gg.view.MainMenuSurfaceView.java
com.gg.view.ScoreSurfaceView.java
com.gg.view.ScoreSurfaceView.java
com.gg.view.SelectSurfaceView.java
com.gg.view.SelectSurfaceView.java
com.gg.view.SurfaceViewFactory.java
com.gg.view.SurfaceViewFactory.java
com.gg.view.TimeGameSurfaceView.java
com.gg.view.TimeGameSurfaceView.java
com.gg.view.WelcomeSurfaceView.java
com.gg.view.WelcomeSurfaceView.java