Пример #1
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);
    //		}
  }