public Scene onCreateScene() {
    this.mEngine.registerUpdateHandler(new FPSLogger());

    final Scene scene = new Scene();
    scene.setBackground(new Background(0.09804f, 0.6274f, 0.8784f));

    boton =
        new ButtonSprite(
            100,
            100,
            this.mBotonTextureRegion,
            this.getVertexBufferObjectManager(),
            new OnClickListener() {

              public void onClick(
                  ButtonSprite pButtonSprite, float pTouchAreaLocalX, float pTouchAreaLocalY) {
                boton.setPosition(boton.getX() + 20, boton.getY() + 20);
              }
            });

    scene.attachChild(boton);
    scene.registerTouchArea(boton);

    return scene;
  }
Пример #2
0
  @Override
  public Scene onCreateScene() {
    mScene = new Scene();
    mScene.setBackground(new Background(0.09804f, 0.6274f, 0.8784f));
    initControl();

    return mScene;
  }
  @Override
  public Scene onCreateSceneAsync(final IProgressListener pProgressListener) throws Exception {
    this.mEngine.registerUpdateHandler(new FPSLogger());

    final Scene scene = new Scene();
    scene.setBackground(new Background(0.09804f, 0.6274f, 0.8784f));

    return scene;
  }
Пример #4
0
  @Override
  public void onCreateScene(OnCreateSceneCallback pOnCreateSceneCallback) throws Exception {
    this.mEngine.registerUpdateHandler(new FPSLogger());

    scene = new Scene();
    scene.setBackground(new Background(0.09804f, 0.6274f, 0.8784f));

    final float centerX = (CAMERA_WIDTH - this.mFaceTextureRegion.getWidth()) / 2;
    final float centerY = (CAMERA_HEIGHT - this.mFaceTextureRegion.getHeight()) / 2;
    final Sprite face =
        new Sprite(centerX, centerY, this.mFaceTextureRegion, this.getVertexBufferObjectManager());
    final PhysicsHandler physicsHandler = new PhysicsHandler(face);
    face.registerUpdateHandler(physicsHandler);

    scene.attachChild(face);

    final AnalogOnScreenControl analogOnScreenControl =
        new AnalogOnScreenControl(
            0,
            CAMERA_HEIGHT - this.mOnScreenControlBaseTextureRegion.getHeight(),
            this.mCamera,
            this.mOnScreenControlBaseTextureRegion,
            this.mOnScreenControlKnobTextureRegion,
            0.1f,
            200,
            this.getVertexBufferObjectManager(),
            new IAnalogOnScreenControlListener() {
              @Override
              public void onControlChange(
                  final BaseOnScreenControl pBaseOnScreenControl,
                  final float pValueX,
                  final float pValueY) {
                physicsHandler.setVelocity(pValueX * 100, pValueY * 100);
              }

              @Override
              public void onControlClick(final AnalogOnScreenControl pAnalogOnScreenControl) {
                face.registerEntityModifier(
                    new SequenceEntityModifier(
                        new ScaleModifier(0.25f, 1, 1.5f), new ScaleModifier(0.25f, 1.5f, 1)));
              }
            });
    analogOnScreenControl
        .getControlBase()
        .setBlendFunction(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);
    analogOnScreenControl.getControlBase().setAlpha(0.5f);
    analogOnScreenControl.getControlBase().setScaleCenter(0, 128);
    analogOnScreenControl.getControlBase().setScale(1.25f);
    analogOnScreenControl.getControlKnob().setScale(1.25f);
    analogOnScreenControl.refreshControlKnobPosition();

    scene.setChildScene(analogOnScreenControl);

    pOnCreateSceneCallback.onCreateSceneFinished(scene);
  }
  @Override
  public Scene onCreateScene() {
    this.mEngine.registerUpdateHandler(new FPSLogger());

    final Scene scene = new Scene();
    scene.setBackground(new Background(0, 0, 0));

    for (int i = 0; i < COUNT; i++) {
      final float tension = MathUtils.random(-0.5f, 0.5f);
      this.addRectangleWithTension(scene, tension, MathUtils.random(0, DURATION * 2f));
    }

    return scene;
  }
  @Override
  public Scene onCreateScene() {
    this.mEngine.registerUpdateHandler(new FPSLogger());

    final Scene scene = new Scene();
    scene.setBackground(new Background(0.09804f, 0.6274f, 0.8784f));

    final VertexBufferObjectManager vertexBufferObjectManager = this.getVertexBufferObjectManager();
    this.mText =
        new Text(
            50,
            40,
            this.mFont,
            "",
            1000,
            new TextOptions(true, AUTOWRAP_WIDTH, Text.LEADING_DEFAULT, HorizontalAlign.CENTER),
            vertexBufferObjectManager);
    scene.attachChild(this.mText);

    this.mLeft =
        new Line(0, 0, 0, TextBreakExample.CAMERA_HEIGHT, this.getVertexBufferObjectManager());
    this.mRight =
        new Line(0, 0, 0, TextBreakExample.CAMERA_HEIGHT, this.getVertexBufferObjectManager());

    this.mText.attachChild(this.mLeft);
    this.mText.attachChild(this.mRight);

    final Line leftBreakLine =
        new Line(0, 0, 0, TextBreakExample.CAMERA_HEIGHT, this.getVertexBufferObjectManager());
    leftBreakLine.setLineWidth(2);
    leftBreakLine.setColor(Color.RED);
    this.mText.attachChild(leftBreakLine);
    final Line rightBreakLine =
        new Line(
            AUTOWRAP_WIDTH,
            0,
            AUTOWRAP_WIDTH,
            TextBreakExample.CAMERA_HEIGHT,
            this.getVertexBufferObjectManager());
    rightBreakLine.setLineWidth(2);
    rightBreakLine.setColor(Color.RED);
    this.mText.attachChild(rightBreakLine);

    this.updateText();

    return scene;
  }
Пример #7
0
  @Override
  public Scene onCreateScene() {
    // Set FPSlogger and physics World
    this.mEngine.registerUpdateHandler(new FPSLogger());
    this.mPhysicsWorld = new PhysicsWorld(new Vector2(0, SensorManager.GRAVITY_EARTH), false);

    // Create new Scene
    this.mScene = new Scene();
    mScene.setBackground(new Background(0, 0, 0));

    // Initialize the physical boundary
    final VertexBufferObjectManager vertexBufferObjectManager = this.getVertexBufferObjectManager();
    final Rectangle ground =
        new Rectangle(0, CAMERA_HEIGHT - 2, CAMERA_WIDTH, 2, vertexBufferObjectManager);
    final Rectangle roof = new Rectangle(0, 0, CAMERA_WIDTH, 2, vertexBufferObjectManager);
    final Rectangle left = new Rectangle(0, 0, 2, CAMERA_HEIGHT, vertexBufferObjectManager);
    final Rectangle right =
        new Rectangle(CAMERA_WIDTH - 2, 0, 2, CAMERA_HEIGHT, vertexBufferObjectManager);

    // Create the physical body of boundary
    final FixtureDef wallFixtureDef = PhysicsFactory.createFixtureDef(0, 0.5f, 0.5f);
    PhysicsFactory.createBoxBody(this.mPhysicsWorld, ground, BodyType.StaticBody, wallFixtureDef);
    PhysicsFactory.createBoxBody(this.mPhysicsWorld, roof, BodyType.StaticBody, wallFixtureDef);
    PhysicsFactory.createBoxBody(this.mPhysicsWorld, left, BodyType.StaticBody, wallFixtureDef);
    PhysicsFactory.createBoxBody(this.mPhysicsWorld, right, BodyType.StaticBody, wallFixtureDef);

    // Add the bodies to the scene
    this.mScene.attachChild(ground);
    this.mScene.attachChild(roof);
    this.mScene.attachChild(left);
    this.mScene.attachChild(right);
    addMario(50, 50);

    //
    this.mScene.registerUpdateHandler(this.mPhysicsWorld);
    this.mScene.setOnSceneTouchListener(this);

    return mScene;
  }
Пример #8
0
  @Override
  protected Scene onCreateScene() {
    mEngine.registerUpdateHandler(new FPSLogger());

    Scene mainScene = new Scene();
    mainScene.setBackground(new Background(0.09804f, 0.6274f, 0.8784f));

    Universe universe = new Universe(this, mainScene);

    Sprite tjRun1Sprite = new Sprite(0, 0, assets.tjRun1TR, this.getVertexBufferObjectManager());
    Sprite tjRun2Sprite =
        new Sprite(200, 200, assets.tjRun2TR, this.getVertexBufferObjectManager());
    Sprite tjStandingSprite =
        new Sprite(400, 400, assets.tjStandingTR, this.getVertexBufferObjectManager());
    OneStateTextButton animationViewerButton =
        new OneStateTextButton(universe, assets.addElectricCityFont, "Animation");
    animationViewerButton.registerOnClickListener(
        new IBBOnClickListener() {
          @Override
          public void onClick() {
            long delayMillis = 200;
            handler.postDelayed(launchAnimationViewerActivity, delayMillis);
          }
        });
    animationViewerButton.setPosition(800, 100);

    OneStateTextButton storyBookButton =
        new OneStateTextButton(universe, assets.addElectricCityFont, "Story Book");
    storyBookButton.registerOnClickListener(
        new IBBOnClickListener() {
          @Override
          public void onClick() {
            long delayMillis = 200;
            handler.postDelayed(launchStorybookActivity, delayMillis);
          }
        });
    storyBookButton.setPosition(800, 300);

    OneStateTextButton tamagotchiButton =
        new OneStateTextButton(universe, assets.addElectricCityFont, "Tamagotchi");
    tamagotchiButton.registerOnClickListener(
        new IBBOnClickListener() {
          @Override
          public void onClick() {
            long delayMillis = 200;
            handler.postDelayed(launchTamagotchiActivity, delayMillis);
          }
        });
    tamagotchiButton.setPosition(800, 500);

    universe.attachChild(tjRun1Sprite);
    universe.attachChild(tjRun2Sprite);
    universe.attachChild(tjStandingSprite);
    universe.attachChild(animationViewerButton);
    universe.attachChild(storyBookButton);
    universe.attachChild(tamagotchiButton);
    universe.registerTouchArea(animationViewerButton.getTouchArea());
    universe.registerTouchArea(storyBookButton.getTouchArea());
    universe.registerTouchArea(tamagotchiButton.getTouchArea());

    return mainScene;
  }
 // ====================================================
 // CREATE SCENE
 // ====================================================
 @Override
 public void onCreateScene(OnCreateSceneCallback pOnCreateSceneCallback) {
   mScene = new Scene();
   mScene.setBackground(new Background(0.9f, 0.9f, 0.9f));
   pOnCreateSceneCallback.onCreateSceneFinished(mScene);
 }