Package com.pointcliki.ui

Examples of com.pointcliki.ui.Button


      createLogicEditor();
      return;
    }
   
    // Add settings
    Button create = new Button(new Minion<SelectionEvent>() {
      @Override
      public long run(Dispatcher<SelectionEvent> dispatcher, String type, SelectionEvent event) {
        Map map = scene(EditorScene.class).map();
        for (Logic l: map.selectedLogics()) map.deselectLogic(l);
        return Minion.CONTINUE;
      }
    }, "new logic");
    create.resize(new Vector2f(155, 24));
    addChild(create, 2);
   
    Button delete = new Button(new Minion<SelectionEvent>() {
      @Override
      public long run(Dispatcher<SelectionEvent> dispatcher, String type, SelectionEvent event) {
        l.cleanup();
        return Minion.CONTINUE;
      }
    }, "delete logic");
    delete.resize(new Vector2f(155, 24));
    delete.position(new Vector2f(0, 26));
    addChild(delete, 3);
   
    TextEntity name = new TextEntity(l.name(), TextEntity.ALIGN_LEFT, EditorScene.LargeFont(), Color.darkGray);
    name.position(new Vector2f(0, 64));
    addChild(name, 4);
View Full Code Here


    fog.select(scene(EditorScene.class).map().fog());
    fog.resize(new Vector2f(155, 24));
    fog.position(new Vector2f(0, 156));
    addChild(fog, 2);
   
    Button play = new Button(new Minion<SelectionEvent>() {
     
      @Override
      public long run(Dispatcher<SelectionEvent> dispatcher, String type, SelectionEvent event) {
        scene(EditorScene.class).playLevel();
        return Minion.CONTINUE;
      }
     
    }, "play");
    play.resize(new Vector2f(155, 24));
    play.position(new Vector2f(0, 182));
    addChild(play, 1);
   
    Button create = new Button(new Minion<SelectionEvent>() {
      @Override
      public long run(Dispatcher<SelectionEvent> dispatcher, String type, SelectionEvent event) {
        // Get the world
        JFrame frame = new JFrame();
        frame.setVisible(true);
        frame.setLocationRelativeTo(null);
        frame.setAlwaysOnTop(true);
        String w = (String) JOptionPane.showInputDialog(frame, "Choose the world of the level", "New Level", JOptionPane.INFORMATION_MESSAGE, null, Map.WORLDS, "Rocky Roadz");
        frame.dispose();
        if (w == null) return Minion.CONTINUE;
       
        // Get the dimensions
        frame = new JFrame();
        frame.setVisible(true);
        frame.setLocationRelativeTo(null);
        frame.setAlwaysOnTop(true);
        String s = (String) JOptionPane.showInputDialog(frame, "Enter the dimensions of the level in tiles: x y", "New Level", JOptionPane.INFORMATION_MESSAGE);
        frame.dispose();
        if (s == null) return Minion.CONTINUE;
        String[] d = s.split(" ");
        try {
          int x = Integer.parseInt(d[0]);
          int y = Integer.parseInt(d[1]);
         
          scene(EditorScene.class).newLevel(w, x, y);
         
        } catch (Exception e) {
          System.err.println("Bad dimensions!");
        }
        return Minion.CONTINUE;
      }
    }, "new level");
    create.resize(new Vector2f(155, 24));
    create.position(new Vector2f(0, 208));
    addChild(create, 1);
   
    Button open = new Button(new Minion<SelectionEvent>() {
   
      @Override
      public long run(Dispatcher<  SelectionEvent> dispatcher, String type,   SelectionEvent event) {
       
        JFileChooser loader = new JFileChooser();
        loader.setAcceptAllFileFilterUsed(false);
        loader.addChoosableFileFilter(new FileNameExtensionFilter("Dizgruntled Maps (*.map)", "map"));
        loader.addChoosableFileFilter(new FileNameExtensionFilter("Wap World Maps (*.wwd)", "wwd"));
        loader.addChoosableFileFilter(new FileNameExtensionFilter("All Maps", "wwd", "map"));
        loader.setDialogTitle("Open Dizgruntled Map");
        JFrame frame = new JFrame();
        frame.setVisible(true);
        frame.setLocationRelativeTo(null);
        frame.setAlwaysOnTop(true);
        int r = loader.showOpenDialog(frame);
        frame.dispose();
        if (r == JFileChooser.APPROVE_OPTION) scene(EditorScene.class).loadLevel(loader.getSelectedFile());
        return Minion.CONTINUE;
      }
     
    }, "open level");
    open.resize(new Vector2f(155, 24));
    open.position(new Vector2f(0, 234));
    addChild(open, 1);
   
    Button save = new Button(new Minion<SelectionEvent>() {
      @Override
      public long run(Dispatcher<SelectionEvent> dispatcher, String type, SelectionEvent event) {
        scene(EditorScene.class).mapManager().saveAs();
        return Minion.CONTINUE;
      }     
    }, "save level as");
    save.resize(new Vector2f(155, 24));
    save.position(new Vector2f(0, 260));
    addChild(save, 1);
   
    Button imp = new Button(new Minion<SelectionEvent>() {
      @Override
      public long run(Dispatcher<SelectionEvent> dispatcher, String type, SelectionEvent event) {
        JFrame frame = new JFrame();
        frame.setVisible(true);
        frame.setLocationRelativeTo(null);
        frame.setAlwaysOnTop(true);
        String s = (String) JOptionPane.showInputDialog(frame, "Choose a level from the original game to import", "Import Level", JOptionPane.INFORMATION_MESSAGE, null, IMPORTS, "AREA1/TRAINING1");
        frame.dispose();
        if (s == null) return Minion.CONTINUE;
        String[] opt = s.split("/");
        s = opt[0] + "/WORLDZ/" + opt[1];
        scene(EditorScene.class).importLevel(s);
        return Minion.CONTINUE;
      }     
    }, "import level");
    imp.resize(new Vector2f(155, 24));
    imp.position(new Vector2f(0, 286));
    addChild(imp, 1);

    Button exit = new Button(new Minion<SelectionEvent>() {
      @Override
      public long run(Dispatcher<SelectionEvent> dispatcher, String type, SelectionEvent event) {
        System.exit(0);
        return Minion.CONTINUE;
      }     
    }, "exit");
    exit.resize(new Vector2f(155, 24));
    exit.position(new Vector2f(0, 312));
    addChild(exit, 1);
  }
View Full Code Here

TOP

Related Classes of com.pointcliki.ui.Button

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.