From d8c5c87462a5d11d93c0f5bb4d04fdf0e4367cf6 Mon Sep 17 00:00:00 2001 From: crunk Date: Sun, 21 Feb 2021 22:29:43 +0100 Subject: [PATCH] Added glitterslikegold and changed the test file --- glitterslikegold.py | 110 ++++++++++++++++++++++++++++++++++++++++++++ test | 38 ++++++++++----- variawelcome80.txt | 27 +++++++++++ 3 files changed, 163 insertions(+), 12 deletions(-) create mode 100644 glitterslikegold.py create mode 100644 variawelcome80.txt diff --git a/glitterslikegold.py b/glitterslikegold.py new file mode 100644 index 0000000..0174a00 --- /dev/null +++ b/glitterslikegold.py @@ -0,0 +1,110 @@ +"""Copy of tomb of doom not scrolling but glittering""" +import curses +import time +import random + +# Using readlines() +file1 = open("test", "r") +lines = file1.readlines() +debug_text = False + + +def show_debug_text(stdscr, width, height, start_x_file): + """debug text for the tomb of doom""" + whstr = "Width: {}, Height: {}".format(width, height) + stdscr.addstr(0, 0, whstr, curses.color_pair(1)) + file_string = "X position of text: {}".format(start_x_file) + stdscr.addstr(1, 0, file_string, curses.color_pair(1)) + + +def draw_glitter(stdscr): + # Clear and refresh the screen for a blank screen + # Set delay to no, to not wait for keyboard press + stdscr.nodelay(1) + stdscr.clear() + stdscr.refresh() + glitter_increase = 1 + rotation = 1 + # Start colors in curses + curses.start_color() + curses.init_pair(1, curses.COLOR_CYAN, curses.COLOR_BLACK) + curses.init_pair(2, curses.COLOR_RED, curses.COLOR_BLACK) + curses.init_pair(3, curses.COLOR_GREEN, curses.COLOR_BLACK) + curses.init_pair(4, curses.COLOR_BLUE, curses.COLOR_BLACK) + curses.init_pair(5, curses.COLOR_MAGENTA, curses.COLOR_BLACK) + curses.init_pair(6, curses.COLOR_YELLOW, curses.COLOR_BLACK) + + while True: + # Loop where k is the last character pressed + stdscr.clear() + height, width = stdscr.getmaxyx() + + # Declaration of strings + title = "Curses from the Tomb of Doom, glitter like gold"[: width - 1] + subtitle = "Crunk Varia"[: width - 1] + + hwidth = width // 2 + # Centering calculations + start_x_title = int((hwidth) - (len(title) // 2) - len(title) % 2) + start_x_subtitle = int( + (hwidth) - (len(subtitle) // 2) - len(subtitle) % 2 + ) + start_y = int((height) - 2) + if debug_text: + show_debug_text(stdscr, width, height, glitter_increase) + + line_count = 0 + for line in lines: + ch_count = 0 + for character in line: + if ch_count < width and ch_count > 0: + if random.randint(glitter_increase, 100) > 90: + stdscr.addch( + line_count, + ch_count, + character, + curses.color_pair(rotation), + ) + ch_count += 1 + line_count += 1 + + # Turning on attributes for title + stdscr.attron(curses.color_pair(2)) + stdscr.attron(curses.A_BOLD) + + # Rendering title + stdscr.addstr(start_y, start_x_title, title) + + # Turning off attributes for title + stdscr.attroff(curses.color_pair(2)) + stdscr.attroff(curses.A_BOLD) + + stdscr.addstr(start_y + 1, start_x_subtitle, subtitle) + # Refresh the screen + stdscr.refresh() + time.sleep(1.0 / 30) + glitter_increase += 1 + if glitter_increase > 99: + glitter_increase = 1 + rotation += 1 + + if rotation > 6: + rotation = 1 + + key_pressed = stdscr.getch() != -1 + if key_pressed: + raise KeyboardInterrupt() + + +def main(): + curses.wrapper(draw_glitter) + + +if __name__ == "__main__": + try: + main() + except KeyboardInterrupt: + curses.endwin() + curses.curs_set(1) + curses.reset_shell_mode() + curses.echo() diff --git a/test b/test index d13d783..bc3777e 100644 --- a/test +++ b/test @@ -1,12 +1,26 @@ -███████████████████████████████████████████████████████████████████████████████ -██╔════════════╗█╔════════════╗█╔════════════╗█╔════════════╗█╔════════════╗███ -██║ ▄▄▄▄ ▄▄▄ ║█║ ▄▄▄▄▄▄▄▄▄▄ ║█║ ██████████ ║█║ ██████████ ║█║ ██████████ ║███ -██║ ████ ████ ║█║ ██████████ ║█║ ██████████ ║█║ ▀▀▀▀▀▀▀▀▀▀ ║█║ ██████████ ║███ -██║ ████ ████ ║█║ ███ ███ ║█║ ██ ███▀ ║█║ ▄▄▄▄▄▄▄▄▄▄ ║█║ ███ ███ ║███ -██║ ████ ████ ║█║ ██████████ ║█║ ████████ ║█║ ██████ ║█║ ██████████ ║███ -██║ ████ ████ ║█║ ████▌▐████ ║█║ █████████ ║█║ ██████ ║█║ ████▌▐████ ║███ -██║ ▓███ ▄████ ║█║ ▓███▌▐████ ║█║ ▓███▌▐███ ║█║ ██████ ║█║ ▓███▌▐████ ║███ -██║ ▒▓███████▀ ║█║ ▒▓██▌▐████ ║█║ ▒▓██▌▐███ ║█║ ▓█████ ║█║ ▒▓██▌▐████ ║███ -██║ ░▒▓█████▀ ║█║ ░▒▓█▌▐████ ║█║ ░▒▓█▌▐████ ║█║ ░▒▓█████▄▄ ║█║ ░▒▓█▌▐████ ║███ -██╚════════════╝█╚════════════╝█╚════════════╝█╚════════════╝█╚════════════╝███ -███████████████████████████████████████████████████████████████████████████████ + . . . . + . . . + ┌───┐ ┌───┐ ┌───────────┐ ┌─────────────┐ ┌──────────┐ ┌───────────┐ + │░░░│ │░░░│ │░░░░░░░░░░░│ │░░░░░░░░░░░░░│ │░░░░░░░░░░│ │░░░░░░░░░░░│ . + │░░░│ │░░░│ │░░░░░░░░░░░│ │░░░░░░░░░░░░░│ │░░░░░░░░░░│ │░░░░░░░░░░░│ + │░░░│ .│░░░│ │░░░░░░░░░░░│ │░░░░░░░░░░░░░│ │░░░░░░░░░░│ │░░░░░░░░░░░│ + │▒▒▒│ │▒▒▒│ │▒▒▒┌───┐▒▒▒│ │▒▒▒┌─────┐▒▒▒│ └──┐▒▒▒▒┌──┘ │▒▒▒┌───┐▒▒▒│ . + │▒▒▒│ │▒▒▒│ │▒▒▒│ │▒▒▒│ │▒▒▒│ . ┌┘▒▒▒│ . │▒▒▒▒│ │▒▒▒│ │▒▒▒│ + │▒▒▒│ │▒▒▒│ │▒▒▒└───┘▒▒▒│ │▒▒▒│ │▒▒▒▒│ │▒▒▒▒│ │▒▒▒└───┘▒▒▒│ + . │███│ │███│ │███████████│ │███└────┘████│ │████│ │███████████│ + │███│ │███│ │███████████│ │████████████┌┘ .│████│ │███████████│ + . │███│ │███│ │███████████│ │███████████ │ │████│ │███████████│ + │▓▓▓│ │▓▓▓│ │▓▓▓┌───┐▓▓▓│ │▓▓▓┌──┐▓▓▓▓▓│ . │▓▓▓▓│. │▓▓▓┌───┐▓▓▓│ + │▓▓▓│ │▓▓▓│.│▓▓▓│. │▓▓▓│ │▓▓▓│ └─┐▓▓▓│ │▓▓▓▓│ │▓▓▓│ │▓▓▓│ + . │▓▓▓│ │▓▓▓│ │▓▓▓│ │▓▓▓│ │▓▓▓│ │▓▓▓│ │▓▓▓▓│ │▓▓▓│ │▓▓▓│ + │▒▒▒│ │▒▒▒│ │▒▒▒│ │▒▒▒│ │▒▒▒│ │▒▒▒│ │▒▒▒▒│ . │▒▒▒│ . │▒▒▒│ . + │▒▒▒▓▓▓▓▒▒▒▓▓▓▓▒▒▒▓▓▓▓▓▒▒▒▓▓│▒▒▒│ │▒▒▒│ │▒▒▒▒│ │▒▒▒│ │▒▒▒│ + │▒▒▒▒▒▒▒▒▒▒░░░░▒▒▒▒▒▒▒▒▒▒▒▒▒▓▒▒▒▓▓▓▓█│▒▒▒└─┐┌──┘▒▒▒▒└──┐ │▒▒▒│ │▒▒▒│ + ▓░░░░░░░░░░ ░░░░░░░░░░░░░░░░░▒▒▒▒▓▓░░░░░▓▓░░░░░░░░░░│ │░░░│ │░░░│ + ▓▒░░░░░░░░░░▓▓▓▓░░░▓▓▓▓▓░░░▓▓▓░░░░░░░░░░░░░░░░░░░░░░░░░░▒▒▒▒░░░│ │░░░│ + ▓▒░░░░░░░░░░▓▓▓▓░░░▓▓▓▓▓░░░▓▓▓░░░░░░░▒▒░░░░░▒▒░░░░░░░░░░▓▓▓▓░░░│ │░░░│ + ▓▒▒░▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▓▓▓▓▓▓▓▓▓▓ + ▓▒░░▒▒▓▓▓▓███████ █████████████░░░░░░▒▒▒▒▒▒▒▒▒▒▒▒▒▒ +▓▒░░▒▒▓▓██████████ Welcome to the Varia House. ██████████████▒▒▒▒▒▒▒▒▒▒░░░░░░░░░ +▒░░███████████████ ████████████████▓▓▓▓▓▓▓▓▓▓▓▓░░░░░ + ░███████████████████████████████████████████████████████████████████████▓▓▓▓▓░░ diff --git a/variawelcome80.txt b/variawelcome80.txt new file mode 100644 index 0000000..9b0c219 --- /dev/null +++ b/variawelcome80.txt @@ -0,0 +1,27 @@ + + .... +... + ┌───┐  ┌───┐ ┌───────────┐ ┌─────────────┐ ┌──────────┐ ┌───────────┐  + │░░░│ │░░░│ │░░░░░░░░░░░│ │░░░░░░░░░░░░░│ │░░░░░░░░░░│ │░░░░░░░░░░░│ .  +  │░░░│ │░░░│ │░░░░░░░░░░░│ │░░░░░░░░░░░░░│ │░░░░░░░░░░│ │░░░░░░░░░░░│   +  │░░░│ .│░░░│ │░░░░░░░░░░░│ │░░░░░░░░░░░░░│ │░░░░░░░░░░│ │░░░░░░░░░░░│   +   │▒▒▒│ │▒▒▒│ │▒▒▒┌───┐▒▒▒│ │▒▒▒┌─────┐▒▒▒│ └──┐▒▒▒▒┌──┘ │▒▒▒┌───┐▒▒▒│ . +   │▒▒▒│ │▒▒▒│ │▒▒▒│ │▒▒▒│ │▒▒▒│ . ┌┘▒▒▒│ . │▒▒▒▒│ │▒▒▒│ │▒▒▒│    +   │▒▒▒│ │▒▒▒│ │▒▒▒└───┘▒▒▒│ │▒▒▒│ │▒▒▒▒│ │▒▒▒▒│ │▒▒▒└───┘▒▒▒│   + .   │███│ │███│ │███████████│ │███└────┘████│ │████│ │███████████│   +  │███│ │███│ │███████████│ │████████████┌┘ .│████│ │███████████│  + . │███│ │███│ │███████████│ │███████████ ││████│ │███████████│   + │▓▓▓│ │▓▓▓│ │▓▓▓┌───┐▓▓▓│ │▓▓▓┌──┐▓▓▓▓▓│ . │▓▓▓▓│. │▓▓▓┌───┐▓▓▓│   +│▓▓▓│ │▓▓▓│.│▓▓▓│. │▓▓▓│ │▓▓▓│ └─┐▓▓▓││▓▓▓▓│ │▓▓▓│ │▓▓▓│   + . │▓▓▓│ │▓▓▓│ │▓▓▓│ │▓▓▓│ │▓▓▓│ │▓▓▓││▓▓▓▓│ │▓▓▓│ │▓▓▓│  +│▒▒▒│ │▒▒▒│ │▒▒▒│ │▒▒▒│ │▒▒▒│ │▒▒▒││▒▒▒▒│ . │▒▒▒│ . │▒▒▒│ .  + │▒▒▒▓▓▓▓▒▒▒▓▓▓▓▒▒▒▓▓▓▓▓▒▒▒▓▓│▒▒▒│ │▒▒▒│ │▒▒▒▒│ │▒▒▒│ │▒▒▒│   + │▒▒▒▒▒▒▒▒▒▒░░░░▒▒▒▒▒▒▒▒▒▒▒▒▒▓▒▒▒▓▓▓▓█│▒▒▒└─┐┌──┘▒▒▒▒└──┐ │▒▒▒│ │▒▒▒│   + ▓░░░░░░░░░░ ░░░░░░░░░░░░░░░░░▒▒▒▒▓▓░░░░░▓▓░░░░░░░░░░│ │░░░│ │░░░│   + ▓▒░░░░░░░░░░▓▓▓▓░░░▓▓▓▓▓░░░▓▓▓░░░░░░░░░░░░░░░░░░░░░░░░░░▒▒▒▒░░░│ │░░░│   + ▓▒░░░░░░░░░░▓▓▓▓░░░▓▓▓▓▓░░░▓▓▓░░░░░░░▒▒░░░░░▒▒░░░░░░░░░░▓▓▓▓░░░│ │░░░│   + ▓▒▒░▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▓▓▓▓▓▓▓▓▓▓ + ▓▒░░▒▒▓▓▓▓███████__̴ı̴̴̡̡̡ ̡͌l̡̡̡ ̡͌l̡*̡̡ ̴̡ı̴̴̡ ̡̡͡|̲̲̲͡͡͡ ̲▫̲͡ ̲̲̲͡͡π̲̲͡͡ ̲̲͡▫̲̲͡͡ ̲|̡̡̡ ̡ ̴̡ı̴̡̡ ̡͌l̡̡̡̡.___█████████████░░░░░░▒▒▒▒▒▒▒▒▒▒▒▒▒▒ +▓▒░░▒▒▓▓██████████ Welcome to the Varia House. ██████████████▒▒▒▒▒▒▒▒▒▒░░░░░░░░░ +▒░░███████████████ CRUNK ████████████████▓▓▓▓▓▓▓▓▓▓▓▓░░░░░ + ░███████████████████████████████████████████████████████████████████████▓▓▓▓▓░░