static {
   if (Spout.getPlatform() == Platform.CLIENT) {
     DEFAULT_FONT =
         (Font) Spout.getFileSystem().getResource("font://Spout/fonts/ubuntu/Ubuntu-M.ttf");
     GUI_COLOR =
         (RenderMaterial)
             FILE_SYSTEM.getResource("material://Spout/materials/GUIColorMaterial.smt");
   } else {
     DEFAULT_FONT = null;
     GUI_COLOR = null;
   }
 }
Example #2
0
  private static Animation loadObj(InputStream stream) {
    final Yaml yaml = new Yaml();
    final Map<? extends String, ?> resourceProperties =
        checkerMapStringObject.check(yaml.load(stream));

    Skeleton skeleton =
        Spout.getFileSystem().getResource((String) resourceProperties.get("Skeleton"));

    int frames = (Integer) resourceProperties.get("frames");
    float delay = ((Double) resourceProperties.get("delay")).floatValue();

    Animation animation = new Animation(skeleton, frames, delay);

    Map<? extends String, ?> bones_data =
        (Map<? extends String, ?>) resourceProperties.get("bones_data");

    for (Entry<? extends String, ?> entry : bones_data.entrySet()) {

      Bone bone = skeleton.getBoneByName(entry.getKey());
      if (bone == null)
        throw new IllegalStateException("Animation file mapped with the bad Skeleton file");

      Map<? extends Integer, String> value = (Map<? extends Integer, String>) entry.getValue();

      int i = 0;
      for (Entry<? extends Integer, String> entryBone : value.entrySet()) {
        int frame = entryBone.getKey() - 1; // Start at 1

        BoneTransform boneTransform = new BoneTransform(loadFloatList(entryBone.getValue()));

        animation.setBoneTransform(bone.getId(), i /*frame*/, boneTransform);

        i++;
      }
    }

    // System.out.println("Animation loaded : (org.spout.engine.resources.loader.AnimationLoader
    // line 77)");
    // animation.dumbAnimation(" ");

    return animation;
  }
public class SpoutRenderMaterials {
  public static final FileSystem FILE_SYSTEM = Spout.getFileSystem();
  public static final Font DEFAULT_FONT;
  public static final RenderMaterial GUI_COLOR;

  static {
    if (Spout.getPlatform() == Platform.CLIENT) {
      DEFAULT_FONT =
          (Font) Spout.getFileSystem().getResource("font://Spout/fonts/ubuntu/Ubuntu-M.ttf");
      GUI_COLOR =
          (RenderMaterial)
              FILE_SYSTEM.getResource("material://Spout/materials/GUIColorMaterial.smt");
    } else {
      DEFAULT_FONT = null;
      GUI_COLOR = null;
    }
  }

  private SpoutRenderMaterials() {}
}