FrameData.java :  » UnTagged » hentaymaster » SpriteEditor » Android Open Source

Android Open Source » UnTagged » hentaymaster 
hentaymaster » SpriteEditor » FrameData.java
package SpriteEditor;

import GameUtils.ResourceReader;

public class FrameData 
{
  public static class FramePoint
  {
    public int m_x;
    public int m_y;
  }
  public static class FrameRect
  {
    public int m_x;
    public int m_y;
    public int m_w;
    public int m_h;
  }
  public static class FrameModule
  {
    public int m_flags;
    public int m_mouleIndex;
    public int m_offsetX;
    public int m_offsetY;
  }
  
  public int         m_flags;
  public FrameRect[]    m_rects = null;
  public FramePoint[]    m_points = null;
  public FrameModule[]   m_modules = null;
  
  //--------------------------------------------------------------------------
  // Constructor
  //--------------------------------------------------------------------------
  public FrameData (ResourceReader res)
  {
    Load(res);
  }
  
  //--------------------------------------------------------------------------
  // Load data from a resource reader object
  //--------------------------------------------------------------------------
  public void Load (ResourceReader res)
  {
    m_flags = res.GetInt();
    
    int numRects = res.GetInt();
    m_rects = new FrameRect [numRects];
    for(int i = 0; i < numRects; i++)
    {
      m_rects[i] = new FrameRect();
      m_rects[i].m_x = res.GetInt();
      m_rects[i].m_y = res.GetInt();
      m_rects[i].m_w = res.GetInt();
      m_rects[i].m_h = res.GetInt();
    }
    
    int numPoints = res.GetInt();
    m_points = new FramePoint [numPoints];
    for(int i = 0; i < numPoints; i++)
    {
      m_points[i] = new FramePoint();
      m_points[i].m_x = res.GetInt();
      m_points[i].m_y = res.GetInt();
    }
    
    int numModules = res.GetInt();
    m_modules = new FrameModule [numModules];
    for(int i = 0; i < numModules; i++)
    {
      m_modules[i] = new FrameModule();
      m_modules[i].m_flags     = res.GetInt();
      m_modules[i].m_mouleIndex   = res.GetInt();
      m_modules[i].m_offsetX     = res.GetInt();
      m_modules[i].m_offsetY     = res.GetInt();
    }
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.