void drawBoard(Board *theBoard, Game *theGame ) { int mx1 = BOARD_POSITION - (BLOCK_SIZE * (BOARD_WIDTH / 2)); int mx2 = BOARD_POSITION + (BLOCK_SIZE * (BOARD_WIDTH / 2)); int my = SCREEN_HEIGHT - (BLOCK_SIZE * BOARD_HEIGHT); drawRectangle(mx1 - BOARD_LINE_WIDTH, my, mx1, SCREEN_HEIGHT - 1, "blue"); drawRectangle(mx2, my, mx2 + BOARD_LINE_WIDTH, SCREEN_HEIGHT - 1, "blue"); for(int i = BOARD_POSITION - (BOARD_WIDTH / 2) - 1; i < BOARD_POSITION + (BOARD_WIDTH / 2)+1; i++){ terminal_color(color_from_name("blue")); terminal_put(i, 24, 0x2588); } //mx1 += 1; for (int i = 0; i < BOARD_WIDTH; i++){ for(int j = 0; j < BOARD_HEIGHT; j++){ if (!isFreeBlock(theBoard, i, j)){ terminal_color(color_from_name("red")); terminal_put(mx1 + i, my+ j-1, 0x2588); } } } }
void BasicOutput() { terminal_options("title=BearLibTerminal demo: output facilities"); terminal_options("font.name=default; font.supplement=Media/Omni/supplement-runic.png"); terminal_blending(BLENDING_ADDITIVE); terminal_color(COLOR_WHITE); terminal_clear(); // Simple output with postformatting terminal_printf(1, 1, "[color=gray]1. Most basic:[/color] ABC abc"); // Wide color range int n = terminal_printf(1, 3, "[color=gray]2. Colors: "); const char long_word[] = "Antidisestablishmentarianism"; const size_t long_word_length = sizeof(long_word)-1; for ( size_t i = 0; i < long_word_length; i++ ) { float factor = float(i)/long_word_length; int red = (1.0f - factor) * 255; int green = factor * 255; terminal_color(color_from_argb(255, red, green, 0)); terminal_put(n+1+i, 3, long_word[i]); } terminal_color(color_from_name("white")); // Tile backgrounds terminal_printf(1, 5, "[color=gray]3. Backgrounds: [color=black][bkcolor=gray] grey [/bkcolor] [bkcolor=red] red "); // Simple unicode output terminal_printf(1, 7, "[color=gray]4. Unicode:[/color] Latin Русский Ελληνικά"); // Composite (overlay) tiles n = terminal_printf(1, 9, "[color=gray]5. Tile overlay: "); terminal_printf(n+1, 9, "a+ = a, a+ = a, a vs. [color=red]ä"); terminal_printf(n+1, 9, "[color=red] / / ▔ ▔ [/color]a"); // Unicode Box Drawing characters terminal_printf(1, 11, "[color=gray]6. Box drawing:"); const char* box_lines[] = { " ┌──┬───┐ ╔═════╗ ", " ┌───┬─┘ │ ├──┐ ╟──┐ ║ ", " └─┐ └─┐ ├───┘ │ ║ └──╢ ", " └───┴──┴──────┘ ╚═════╝ " }; for ( size_t i = 0; i < sizeof(box_lines)/sizeof(box_lines[i]); i++ ) { terminal_printf(1, 12+i, "%s", box_lines[i]); } // Box drawing + overlay application terminal_printf(1, 17, "[color=gray]7. Box drawing + overlay:"); terminal_color(0xFF006000); for ( int y = 0; y < 6; y++ ) { for ( int x = 0; x < 19; x++ ) { terminal_put(1+x, 18+y, 'A'+(x+y)%26); } } DrawOverlayRectangle(3, 19, 15, 4, 0xFFFFFFFF, 0xA0909090); terminal_printf(4, 20, "[color=white]Itym:\nHeavy draggon"); terminal_printf(40, 17, "[color=gray]8. Font supplement:"); terminal_printf(40, 19, "fire ([color=red][uE001][/color]) - water ([color=lighter blue][uE004][/color]) - earth ([color=dark green][uE00F][/color])"); terminal_printf(40, 20, "\uE001\uE002\uE003, \uE004\uE005\uE006\uE007\uE008! \uE009\uE00A\uE00B \uE00C \uE00D\uE00E\uE00F\uE010."); terminal_refresh(); int key = 0; do { key = terminal_get(); } while ( key != VK_CLOSE && key != VK_ESCAPE ); }