Package utils

Examples of utils.Timer


    network.addEdge( n1, n2 );
    network.addEdge( n1, n4 );
    //network.addEdge( n2, n3 );
    //network.addEdge( n4, n3 );
   
    Timer timer = new Timer();
    int frames = 0, prevFrames = 0;
    int timePassed = 0;
    timer.start();
    while( true ) {
      kb.poll();
      if( kb.keyDown( KeyEvent.VK_Q ) ) {
        break;
      }
      if( kb.keyDown( KeyEvent.VK_A ) ) {
        Point2D tempPoint = new Point2D( rand.nextInt( window.getWidth() ), rand.nextInt( window.getHeight() ) );
        Size2D tempSize = new Size2D( rand.nextInt( 30 ) + 21, rand.nextInt( 30 ) + 21 );
        GraphicsObject obj2 = new JavaSprite( "fenceright",
            tempPoint, tempSize );
        objList2.add( obj2 );
      }
      window.clear();
     
      for( GraphicsObject go : objList2 ) {
        go.draw( JavaWindow.getGraphics2D(), 0 );
      }
      //obj.draw( Window.getGraphics2D() );
      //cur.draw( window.getDrawGraphics() );
      //elp1.draw( window.getDrawGraphics() );
      //elp2.draw( window.getDrawGraphics() );
      //network.draw( Window.getGraphics2D() );
     
      JavaWindow.getGraphics2D().setColor( Color.black );
      JavaWindow.getGraphics2D().drawString( String.valueOf( objList2.size() ), 0, 10 );
      JavaWindow.getGraphics2D().drawString( String.valueOf( prevFrames ), 0, 20 );
      window.update();
     
      frames++;
      timePassed += (int)timer.get();
      //System.out.println( timePassed );
      if( timePassed >= 1000 ) {
        prevFrames = frames;
        frames = 0;
        timePassed = 0;
View Full Code Here

TOP

Related Classes of utils.Timer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.