!7 sbool showHelpOnStart; static JFrame mainFrame; static LL gridComponents; static int gridRows = 8, gridCols = 8; sbool showLocations = true; static int smartyX, smartyY; sS locationLetters = charRange('A', 'Z') + "[\\]^_`" + charRange('a', 'q'); sS smartyUnicode = basicUnicodeSmiley(); sclass JCell > JComponent { int x, y; bool obstacle; *(int *x, int *y) {} public void paint(Graphics _g) { Graphics2D g = cast _g; int w = getWidth(), h = getHeight(); fillRect(g, 0, 0, w, h, obstacle ? colorFromHex("4169e1") : Color.white); if (showLocations) drawTextWithTopLeftCornerAt(g, substringWithLength(locationLetters, x+y*gridRows, 1), Pt(0, 0), Color.black); if (smartyX == x && smartyY == y) drawCenteredText(g, 0, 0, w, h, smartyUnicode); } } p { autoRestart(5.0); mainFrame = showFrame("Smarty"); addMenu(mainFrame, "Worlds", "New... (Ctrl+N)", r {}, "Retrieve... (Ctrl+R)", r {}, "Save... (Ctrl+S)", r {}, "---", "Exit", rThread killVM); registerCtrlKey(mainFrame, KeyEvent.VK_N, "New world", r { print("new") }); registerCtrlKey(mainFrame, KeyEvent.VK_R, "Retrieve world", r {}); registerCtrlKey(mainFrame, KeyEvent.VK_S, "Save world", r {}); addMenu(mainFrame, "View", "Locations (Ctrl+L)", r {}); registerCtrlKey(mainFrame, KeyEvent.VK_L, "Locations", r {}); JMenuBar menuBar = getMenuBar(mainFrame); JMenuItem helpItem = jMenuItem("Help F1", rThread showHelp); /*print(minSize := getMinimumSize(helpItem)); print(preferredSize := getPreferredSize(helpItem));*/ addMenuItem(menuBar, jPreferredWidthToMaxWidth(helpItem)); addAndRevalidate(menuBar, jHorizontalGlue()); // spacer registerFunctionKey(mainFrame, 1, rThread showHelp); gridComponents = map(iotaZeroList(gridRows), y -> map(iotaZeroList(gridCols), x -> new JCell(x, y))); //gridComponents = repF_2d(8, 8, lambda0 newSingleComponentPanel); second(second(gridComponents)).obstacle = true; //first(first(gridComponents)).setComponent(fontSize(50, jcenteredlabel(basicUnicodeSmiley()))); setFrameContents(mainFrame, westAndCenter( jvstack(jFixedSize(500, setBackground(Color.black, hvgrid(gridComponents, 1)))), jCenteredLabel("TODO"))); centerPackFrame(mainFrame); if (showHelpOnStart) showHelp(); //hideConsole(); } svoid showHelp() { S text = loadSnippet(#1031105); S heading = firstLine(text); trim(dropFirstLine(text)); showFrame(heading, fontSizePlus(4, makeUneditableWithTextColor(Color.black, wordWrapTextArea(text)))); }