Ejemplo n.º 1
0
def scene():
    blt.set(f"window.title='{textutils.lucynest}: in a dream'")

    world = World()

    width = blt.state(blt.TK_WIDTH)
    height = blt.state(blt.TK_HEIGHT)
    parts = 6
    left = width // 6
    right = width * (parts - 1) // parts
    middle = height // 2
    padding = 1

    story = [
        "Hi! I'm Avatar, actually me is who You are in this World",
        "Lets find out what we've got here in lucid dream",
        "Open Your mind and enter this evershining mental landscape",
    ]
    story_point = 0
    while True:
        blt.clear()

        blt.color("light gray")
        for y in range(height - 1):
            blt.put(left, y, bltutils.box_upper_half)
            blt.put(right, y, bltutils.box_upper_half)
        for x in range(left + 1, right):
            blt.put(x, middle, bltutils.box_whole)

        blt.color("white")
        # blt.put_ext(view_width * 4 + 1, 0, margin, margin, 0xE100)
        avatar_symbol = "@:"
        left_avatar = left + 1 + padding
        left_avatar_text = left_avatar + len(avatar_symbol) + 1

        blt.puts(left_avatar, middle // 5,
                 bltutils.colored(avatar_symbol, "orange"))
        blt.puts(left_avatar_text, middle // 5, story[story_point],
                 right - 1 - padding - left_avatar_text,
                 middle - 1 - padding - middle // 5, blt.TK_ALIGN_LEFT)

        line = 1
        for element in world.avatar.elements:
            blt.puts(
                0, line,
                bltutils.colored(element.scale.current_value, element.name))
            line += 1

        blt.refresh()

        key = blt.read()

        if key in (blt.TK_CLOSE, blt.TK_ESCAPE):
            break
        elif key == blt.TK_ENTER:
            story_point += 1 if story_point < len(story) - 1 else 0
Ejemplo n.º 2
0
def keys_footer():
    height = blt.state(blt.TK_HEIGHT) - 1
    keys = (("ESC", "Exit"), ("Enter", "Next"), ("PGUP", "Log up"),
            ("PGDN", "Log Down"))
    offset = 0
    for (key, info) in keys:
        key_info = bltutils.colored(key, 'yellow') + ' ' + bltutils.colored(
            info, 'black')
        blt.puts(offset, height, bltutils.bkcolored(key_info, 'grey'))
        offset += 2 + len(key) + len(info)
Ejemplo n.º 3
0
def main():
    version = "v0.1.0"

    blt.open()

    menu_entries = (("Fall asleep", game.scene), ("Help", help.scene),
                    ("About", about.scene), ("Quit", quit))

    width = blt.state(blt.TK_WIDTH)
    height = blt.state(blt.TK_HEIGHT)

    cw = blt.state(blt.TK_CELL_WIDTH)
    ch = blt.state(blt.TK_CELL_HEIGHT)
    blt.set("U+E001: resources/logo.png, resize=" + str(cw * 70) + "x" +
            str(ch * 8) + ", resize-filter=bilinear")

    reset()
    menu_index = 0
    menu_count = len(menu_entries)
    while True:
        blt.clear()

        blt.put(5, 5, 0xE001)
        blt.puts(60, 11, bltutils.colored(version, "orange"))

        for (i, entry) in enumerate(menu_entries):
            bkcolor = "gray" if i == menu_index else "black"
            item_ypos = ((height // 3) * 3) + i + 3
            blt.puts(0, i, bltutils.bkcolored(entry[0], bkcolor), width,
                     item_ypos, bltutils.align_center)

        blt.refresh()

        key = blt.read()

        if key in (blt.TK_ESCAPE, blt.TK_CLOSE):
            break
        elif key in (blt.TK_UP, blt.TK_DOWN):
            menu_index = utils.circulate(menu_count, menu_index,
                                         key == blt.TK_DOWN)

        elif key == blt.TK_ENTER:
            menu_entries[menu_index][1]()
            reset()

    blt.close()
Ejemplo n.º 4
0
# coding=utf-8

from common import utils
from bearlibterminal import bltutils

styled_L = "\u258F[+]\u2581"
styled_T = "\u2594[+]\u2595"
__button_colored_fmt = "[color=orange]%s[/color] %s"


def styled(text):
    return styled_L + text + styled_T


def button_styled():
    pass


lucynest = "LucynesꞀ"
lucynest_styled = styled("ucynes")
lucynest_colored = bltutils.colored(lucynest_styled, "orange")