コード例 #1
0
ファイル: VisibilityTest.java プロジェクト: prashanth-u/ead
  @Test
  public void testVisibility() {
    reset();

    ModelEntity entity = new ModelEntity();
    Visibility visibility = new Visibility();
    visibility.setCondition("(eq $" + variableDef + " i1)");
    entity.getComponents().add(visibility);

    entitiesLoader.toEngineEntity(entity);
    IntMap<Entity> entityIntMap =
        gameLoop.getEntitiesFor(Family.getFamilyFor(VisibilityComponent.class));
    EngineEntity engineEntity = (EngineEntity) entityIntMap.entries().next().value;
    assertTrue(engineEntity.getGroup().isVisible());

    gameLoop.update(1);
    assertFalse(engineEntity.getGroup().isVisible());

    variablesManager.setVarToExpression(variableDef, "i1");
    gameLoop.update(1);
    assertTrue(engineEntity.getGroup().isVisible());

    variablesManager.setVarToExpression(variableDef, "i0");
    gameLoop.update(1);
    assertFalse(engineEntity.getGroup().isVisible());
  }
コード例 #2
0
ファイル: KeyBehaviorTest.java プロジェクト: jtorrente/ead
 private EngineEntity createModelEntityWithKeyboardInteraction(
     int keycode, boolean shift, boolean control, boolean alt, String condition) {
   ModelEntity modelEntity = new ModelEntity();
   Behavior behavior = new Behavior();
   key.setKeycode(keycode);
   key.setShift(shift);
   key.setCtrl(control);
   key.setAlt(alt);
   behavior.setEvent(key);
   behavior.getEffects().add(new MockEffect(this));
   modelEntity.getComponents().add(behavior);
   return addEntity(modelEntity);
 }
コード例 #3
0
ファイル: ShadersDemo.java プロジェクト: jtorrente/ead
  @Override
  protected void doBuild() {
    ModelEntity scene = singleSceneGame(null, 800, 600).getLastScene();

    ModelEntity rectangle = new ModelEntity();
    rectangle.getComponents().add(rectangle(400, 300));
    scene.getChildren().add(rectangle);

    Shader shader = new Shader();
    shader.setUri("gradient.fragment");

    shader.getUniforms().add(param("point1", "f0,f0"));
    shader.getUniforms().add(param("point2", "f1,f1"));
    shader.getUniforms().add(param("color1", "f1,f1,f1,f1"));
    shader.getUniforms().add(param("color2", "f0,f0,f0,f1"));

    rectangle.getComponents().add(shader);

    rectangle = new ModelEntity();
    rectangle.getComponents().add(rectangle(400, 300));
    rectangle.setX(400);

    shader = new Shader();
    shader.setUri("gradient.fragment");

    shader.getUniforms().add(param("point1", "f0,f0"));
    shader.getUniforms().add(param("point2", "f1,f1"));
    shader.getUniforms().add(param("color1", "f1,f1,f1,f1"));
    shader.getUniforms().add(param("color2", "f0,f0,f0,f1"));

    rectangle.getComponents().add(shader);

    scene.getChildren().add(rectangle);

    rectangle = new ModelEntity();
    rectangle.getComponents().add(rectangle(400, 300));
    rectangle.setY(300);

    shader = new Shader();
    shader.setUri("gradient.fragment");

    shader.getUniforms().add(param("point1", "f0.25,f0.25"));
    shader.getUniforms().add(param("point2", "f0.75,f0.75"));
    shader.getUniforms().add(param("color1", "f1,f0,f0,f1"));
    shader.getUniforms().add(param("color2", "f0,f1,f0,f1"));

    rectangle.getComponents().add(shader);

    scene.getChildren().add(rectangle);

    rectangle = new ModelEntity();
    rectangle.getComponents().add(rectangle(400, 300));
    rectangle.setX(400);
    rectangle.setY(300);

    shader = new Shader();
    shader.setUri("gradient.fragment");

    shader.getUniforms().add(param("point1", "f0,f0"));
    shader.getUniforms().add(param("point2", "f0,f1"));
    shader.getUniforms().add(param("color1", "f0,f1,f1,f1"));
    shader.getUniforms().add(param("color2", "f1,f0,f1,f1"));

    rectangle.getComponents().add(shader);

    scene.getChildren().add(rectangle);
  }