Exemple #1
0
  public GameScreen(MainWindow game, String levelName, boolean activateLights) {
    this.game = game;

    this.levelName = levelName;

    showGameOverScreen = false;

    this.activateLights = activateLights;

    Gdx.app.setLogLevel(Application.LOG_DEBUG);

    debugRenderer = new Box2DDebugRenderer();

    worldLoader = new WorldLoader(game, this);

    camera = new Cameras(game, worldLoader, game.getBatch());

    multiplexer = new InputMultiplexer();

    multiplexer.addProcessor(camera.getHudStage());
    multiplexer.addProcessor(worldLoader.getControls());

    Gdx.input.setInputProcessor(multiplexer);

    gameMiddleground = null;

    chooseBackground();
  }
Exemple #2
0
  Menu(TwoD game) {
    this.game = game;
    batch = new SpriteBatch();
    font = new BitmapFont();
    font.setColor(Color.WHITE);
    camera = new OrthographicCamera();
    viewport = new FitViewport(1024, 786, camera);
    viewport.apply();
    stage = new Stage(viewport, batch);

    stage.setDebugAll(true);

    gearScreen = new GearScreen();
    gearScreen.setBounds(512, 0, 512, 786);

    inventoryScreen = new InventoryScreen();
    inventoryScreen.setBounds(0, 0, 512, 786);

    stage.addActor(gearScreen);
    stage.addActor(inventoryScreen);
    dnd = new DragAndDrop();

    inputMultiplexer = new InputMultiplexer();
    inputMultiplexer.addProcessor(this);
    inputMultiplexer.addProcessor(stage);
  }
Exemple #3
0
  @Override
  public void create() {
    font = new BitmapFont();
    font.setColor(1f, 0f, 0.05f, 1f);
    font.setScale(1.2f);

    project = ProjectManager.getInstance().getCurrentProject();
    pathForScreenshot = Utils.buildProjectPath(project.getName()) + "/";

    virtualWidth = project.getXmlHeader().virtualScreenWidth;
    virtualHeight = project.getXmlHeader().virtualScreenHeight;

    virtualWidthHalf = virtualWidth / 2;
    virtualHeightHalf = virtualHeight / 2;

    stage = new Stage(virtualWidth, virtualHeight, true);
    batch = stage.getSpriteBatch();

    Gdx.gl.glViewport(0, 0, ScreenValues.SCREEN_WIDTH, ScreenValues.SCREEN_HEIGHT);
    initScreenMode();

    sprites = project.getSpriteList();
    for (Sprite sprite : sprites) {
      sprite.resetSprite();
      sprite.look.createBrightnessContrastShader();
      stage.addActor(sprite.look);
      sprite.resume();
    }

    passepartout =
        new Passepartout(
            ScreenValues.SCREEN_WIDTH,
            ScreenValues.SCREEN_HEIGHT,
            maximizeViewPortWidth,
            maximizeViewPortHeight,
            virtualWidth,
            virtualHeight);
    stage.addActor(passepartout);

    if (DEBUG) {
      OrthoCamController camController = new OrthoCamController(camera);
      InputMultiplexer multiplexer = new InputMultiplexer();
      multiplexer.addProcessor(camController);
      multiplexer.addProcessor(stage);
      Gdx.input.setInputProcessor(multiplexer);
      fpsLogger = new FPSLogger();
    } else {
      Gdx.input.setInputProcessor(stage);
    }

    axes = new Texture(Gdx.files.internal("stage/red_pixel.bmp"));
    skipFirstFrameForAutomaticScreenshot = true;
    if (checkIfAutomaticScreenshotShouldBeTaken) {
      makeAutomaticScreenshot = project.manualScreenshotExists(SCREENSHOT_MANUAL_FILE_NAME);
    }
  }
 @Override
 public void show() {
   this.incodr.menu.isSelectGameModeMenu = false;
   stage.addActor(GameAsset.GAMEPLAY_BACKGROUND);
   stage.addActor(incodr.gameUI.mazeLevelStat());
   stage.addActor(gameWorld);
   InputMultiplexer im = new InputMultiplexer();
   im.addProcessor(incodr.backCatcher);
   im.addProcessor(stage);
   Gdx.input.setInputProcessor(im);
 }
 public void addLayer(Layer layer) {
   layer.width = this.width;
   layer.height = this.height;
   _mNodes.add(layer);
   _mInputMPlexer.addProcessor(layer);
   super.addActor(layer);
 }
  @Override
  public void show() {

    stage = new DemoStage();

    InputMultiplexer inputMultiplexer = new InputMultiplexer();
    inputMultiplexer.addProcessor(stage);
    Gdx.input.setInputProcessor(inputMultiplexer);
  }
Exemple #7
0
 public void unpauseOverlay() {
   if (inOverlay) {
     paused = false;
     inOverlay = false;
     overlayMenu.clearChildren();
     inMux.removeProcessor(overlayStage);
     inMux.addProcessor(stage);
   }
 }
Exemple #8
0
 public void doMenu() {
   if (!inOverlay && !sheepGame.isLosing() && !sheepGame.isWinning()) {
     overlayMenu.clearChildren();
     inOverlay = true;
     paused = true;
     addResumeButton(overlayMenu);
     addRetryButtons(overlayMenu);
     inMux.addProcessor(overlayStage);
     inMux.removeProcessor(stage);
   }
 }
Exemple #9
0
  public GameScreen(NinjaGamePrototype game) {

    this.game = game;
    new WorldController();

    WorldModel.get().addObserver(SoundSystem.get());
    WorldModel.get().getNinja().addObserver(SoundSystem.get());

    InputMultiplexer multiplexer = new InputMultiplexer();
    multiplexer.addProcessor(new SongController());
    multiplexer.addProcessor(new NinjaController());
    Gdx.input.setInputProcessor(multiplexer);

    @SuppressWarnings("rawtypes")
    Iterator it;
    it = WorldModel.get().getEnemies().iterator();

    while (it.hasNext()) {
      EnemyModel enemy = (EnemyModel) it.next();
      enemy.addObserver(SoundSystem.get());
    }
  }
Exemple #10
0
  public GameOverlay() {
    batch = new SpriteBatch();
    stage = new Stage();
    inMux = new InputMultiplexer();
    inMux.addProcessor(stage);
    overlayStage = new Stage();

    topMenu = new Table();
    topMenu.setFillParent(true);
    topMenu.top();
    topMenu.left();
    stage.addActor(topMenu);

    bottomMenu = new Table();
    bottomMenu.setFillParent(true);
    bottomMenu.bottom();
    stage.addActor(bottomMenu);

    overlayMenu = new Table();
    overlayMenu.setFillParent(true);
    overlayMenu.center();
    overlayStage.addActor(overlayMenu);
  }
  void changeTest(int behaviorIndex) {
    // Remove the old behavior and its window
    testsTable.clear();
    if (currentTest != null) {
      if (currentTest.getDetailWindow() != null) currentTest.getDetailWindow().remove();
      currentTest.dispose();
    }

    // Add the new behavior and its window
    currentTest = tests[behaviorIndex];
    Gdx.app.log("BehaviorTreeTests", "***********************************************");
    Gdx.app.log("BehaviorTreeTests", "Starting test " + currentTest.getClass().getSimpleName());
    Gdx.app.log("BehaviorTreeTests", "***********************************************");
    String description = currentTest.getDescription();
    if (description != null) {
      Gdx.app.log("BehaviorTreeTests", description);
      Gdx.app.log("BehaviorTreeTests", "***********************************************");
    }
    currentTest.create(testsTable);
    InputMultiplexer im = (InputMultiplexer) Gdx.input.getInputProcessor();
    if (im.size() > 1) im.removeProcessor(1);
    if (currentTest.getInputProcessor() != null) im.addProcessor(currentTest.getInputProcessor());
    if (currentTest.getDetailWindow() != null) stage.addActor(currentTest.getDetailWindow());
  }
 public InputMultiplexer setCommonInputHandler(InputProcessor inputProcessor) {
   InputMultiplexer inputMultiplexer = new InputMultiplexer();
   inputMultiplexer.addProcessor(inputProcessor);
   inputMultiplexer.addProcessor(stage);
   return inputMultiplexer;
 }
Exemple #13
0
  public Controller(Editor p_editor, View p_view) {
    editor = p_editor;
    stage = p_view.get_stage();
    cam = stage.getCamera();

    view = p_view;

    input_multiplexer = new InputMultiplexer(this);
    input_multiplexer.addProcessor(stage);
    Gdx.input.setInputProcessor(input_multiplexer);

    //		try
    //		{
    //			////
    //			// loads the default project
    //
    //			load_project ();
    //		}
    //		catch (Exception e)
    //		{
    ////
    // in case of a load failure, most likely to occur after a change is made to the Scene or
    // Project class,
    // recreate the default project

    System.out.println(
        ">>>> NOTE: couldn't load project, probably incompatible version, reverting to default project");

    Scene default_scene = new Scene();
    default_scene.set_name("project_default_scene");

    Background bg_01 = new Background("data/backgrounds/bg_workshop_l010_a01.png");
    bg_01.set_name("bg_l1");
    bg_01.set_z(0f);
    Background bg_02 = new Background("data/backgrounds/bg_workshop_l020_a01.png");
    bg_02.set_name("bg_l2");
    bg_02.set_z(10f);

    Hotspot hotspot_01 =
        new Hotspot("data/sprites/woodrow_a01_talk_anim_a01.png", "say_anim", 4, 110, 190, 2, 2, 4);
    hotspot_01.new_animation(
        "data/sprites/woodrow_a01_idle_anim_a01.png", "idle_anim", 2, 110, 190, 2, 1, 4);
    hotspot_01.set_name("char");
    hotspot_01.set_z(5f);
    hotspot_01.set_position(200f, 50f);
    //			hotspot_01.set_scale_x (0.45f);
    //			hotspot_01.set_scale_y (0.45f);

    default_scene.add_background(bg_01);
    default_scene.add_background(bg_02);
    default_scene.add_hotspot(hotspot_01);

    current_project.add_scene(default_scene);

    current_project.current_scene = default_scene;

    change_scene(current_project.current_scene);

    editor.get_properties_editor().set_current_project(current_project);
    //		}
  }