Package server.sprite

Examples of server.sprite.Sprite


  {
   
    //if(game.getMap().isInMap(position)&&game.getMap().isPassable(IUnit.TYPE_LAND, position))
    {
      //TODO playerID anpassen
      Sprite s = new MovableSprite(game, name, ref, Math.screenToWorld(sc_position, game.getViewport()), speed, game.getPlayer(0));
      //Sprite s = new MovableSprite(game, ref, Math.mapToWorld(new Vector2f(10, 10),game.map.getTilesize()), speed);
      synchronized(sprites)
      {
        this.sprites.add(s);
        s.start();
      }
      return true;
    }
    //else
    //{
View Full Code Here


   
    for(Thread t:threads)
    {
      try
      {
        Sprite s = (Sprite)t;
        Rectangle col = Math.worldToScreen(s.getCollisionRectangle(),game.getViewport());
        if(col.isInside(sc_coords))
        {
          this.selectedSprite = s;
          System.out.println(s.toString());
          return true;
        }
      }catch (Exception e) {
        //No Sprite
      }
View Full Code Here

    Display.destroy();
  }
 
  public void drawSprite(int id)
  {
    Sprite s = unitManager.getSprite(id);
    Texture tex = s.getTexture();
    Vector2f wc_position = s.getPosition();
    float rotation = s.getRotation();
   
    if(map.isInMap(Math.worldToMap(wc_position, map.getTilesize())) && viewport.scale_cpy(1.1f).isInside(wc_position))
    {
      glEnableClientState(GL_VERTEX_ARRAY);
      glEnableClientState(GL_TEXTURE_COORD_ARRAY);
      glEnable(GL_TEXTURE_2D);
     
      glPushMatrix();
     
      tex.bind();   
     
      glTranslatef(Math.worldToScreen(wc_position.x(),viewport.getLeft()), Math.worldToScreen(wc_position.y(),viewport.getTop()), 0f);
     
      glRotatef(rotation, 0, 0, 1.0f);
      //glTranslatef(-texture.getImageWidth()/2, -texture.getImageHeight()/2, 0);
     
      glVertexPointer(2, 0, s.getVertexBuffer());
      glTexCoordPointer(2, 0, s.getTextureBuffer());
     
      glDrawArrays(GL_QUADS, 0, 4);
     
      glPopMatrix();
     
View Full Code Here

TOP

Related Classes of server.sprite.Sprite

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.