@Override public void run(Options opts) { splitSep = opts.get("splitSep", "\\s+"); joinSep = opts.get("joinSep", "\t"); inputFile = opts.getFile("inputFile", null); reverseCut = opts.has("reverseCut"); final Set<Integer> cutIndexes = new HashSet<Integer>(); for (String arg : opts.getArgs()) { cutIndexes.add(Integer.parseInt(arg)); } debug(">> cutIndexes " + cutIndexes); InputStream ins = getInputStream(inputFile, System.in); eachLine( ins, new LineAction() { @Override public void onLine(String line) { List<String> result = new ArrayList<String>(); String[] words = line.split(splitSep); int wordLen = words.length; debug(">> wordLen " + wordLen); for (int i = 0; i < wordLen; i++) { String word = words[i]; debug(">> Checking column " + i + ", word=" + word); boolean keep = !cutIndexes.contains(i); debug(" keep? " + keep); if (keep) { // Try negative index search keep = !cutIndexes.contains(i - wordLen); debug(" negative index keep? " + keep); } if (reverseCut) { keep = !keep; debug(" reversing keep value!"); } if (keep) { result.add(word); } } String first = result.remove(0); print(first); for (String word : result) { print(joinSep); print(word); } println(""); } }); }
@Override public void init() { super.init(); Util.telemetry("init", ""); dashboard = new DSDashboard(telemetry); menu = new DSMenu("Menu Title", this); for (int i = 0; i < Options.count(); i++) { menu.addChoice(Options.get(i).name(), Options.get(i)); } }
private synchronized void render(Graphics g) { if (level != null) { int xScroll = (int) (player.pos.x - screen.w / 2); int yScroll = (int) (player.pos.y - (screen.h - 24) / 2); soundPlayer.setListenerPosition((float) player.pos.x, (float) player.pos.y); level.render(screen, xScroll, yScroll); } if (!menuStack.isEmpty()) { menuStack.peek().render(screen); } boolean drawFPS = Options.get("drawFPS") != null && Options.get("drawFPS").equals("true"); if (drawFPS) { Font.draw(screen, texts.FPS(fps), 10, 10); } if (player != null && menuStack.size() == 0) { Font.draw(screen, texts.health(player.health, player.maxHealth), 340, screen.h - 16); Font.draw(screen, texts.money(player.score), 340, screen.h - 27); Font.draw(screen, texts.nextLevel((int) player.getNextLevel()), 340, screen.h - 38); Font.draw(screen, texts.playerExp((int) player.pexp), 340, screen.h - 49); Font.draw(screen, texts.playerLevel(player.plevel), 340, screen.h - 60); } g.setColor(Color.BLACK); g.fillRect(0, 0, getWidth(), getHeight()); g.translate((getWidth() - GAME_WIDTH * SCALE) / 2, (getHeight() - GAME_HEIGHT * SCALE) / 2); g.clipRect(0, 0, GAME_WIDTH * SCALE, GAME_HEIGHT * SCALE); if (!menuStack.isEmpty() || level != null) { // render mouse renderMouse(screen, mouseButtons); g.drawImage(screen.image, 0, 0, GAME_WIDTH * SCALE, GAME_HEIGHT * SCALE, null); } }
public static void main(String[] args) { MojamComponent mc = new MojamComponent(); guiFrame = new JFrame(); JPanel panel = new JPanel(new BorderLayout()); panel.add(mc); guiFrame.setContentPane(panel); guiFrame.pack(); guiFrame.setResizable(false); guiFrame.setLocationRelativeTo(null); guiFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); guiFrame.setVisible(true); Options.loadProperties(); setFullscreen(Boolean.parseBoolean(Options.get("fullscreen"))); mc.start(); }
public static void main(String[] args) { MojamComponent mc = new MojamComponent(); guiFrame = new JFrame(GAME_TITLE); JPanel panel = new JPanel(new BorderLayout()); panel.add(mc); guiFrame.setContentPane(panel); guiFrame.pack(); guiFrame.setResizable(false); guiFrame.setLocationRelativeTo(null); guiFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); ArrayList<BufferedImage> icoList = new ArrayList<BufferedImage>(); icoList.add(Art.icon32); icoList.add(Art.icon64); guiFrame.setIconImages(icoList); guiFrame.setVisible(true); Options.loadProperties(); setFullscreen(Boolean.parseBoolean(Options.get(Options.FULLSCREEN, Options.VALUE_FALSE))); mc.start(); }
public MojamComponent() { String localeString = Options.get(Options.LOCALE, "en"); setLocale(new Locale(localeString)); this.setPreferredSize(new Dimension(GAME_WIDTH * SCALE, GAME_HEIGHT * SCALE)); this.setMinimumSize(new Dimension(GAME_WIDTH * SCALE, GAME_HEIGHT * SCALE)); this.setMaximumSize(new Dimension(GAME_WIDTH * SCALE, GAME_HEIGHT * SCALE)); this.addMouseMotionListener(this); this.addMouseListener(this); TitleMenu menu = new TitleMenu(GAME_WIDTH, GAME_HEIGHT); addMenu(menu); addKeyListener(this); addKeyListener(chat); instance = this; LevelList.createLevelList(); }
/** * Checkbox. * * @param mn min value * @param mx max value * @param opt option * @param opts options * @param win parent window */ public BaseXSlider( final int mn, final int mx, final NumberOption opt, final Options opts, final Window win) { this(mn, mx, opts.get(opt), win); options = opts; option = opt; }