コード例 #1
0
ファイル: rl_2.py プロジェクト: NoahTheDuke/roguelike
 def initialize_blt(self):
     terminal.open()
     terminal.set(
         "window: size={}x{}, cellsize={}, title='Roguelike';"
         "font: default;"
         "input: filter=[keyboard+];"
         "".format(str(self.window_width), str(self.window_height), self.cellsize)
     )
     terminal.clear()
     terminal.refresh()
     terminal.color("white")
コード例 #2
0
    terminal.print_(11, 10, ': dark wall') # dark wall
    terminal.put(10, 11, 130) #
    terminal.print_(11, 11, ': light wall') # light wall
    terminal.put(10, 12, 136) #
    terminal.print_(11, 12, ': dark ground') # dark ground
    terminal.put(10, 13, 137) #
    terminal.print_(11, 13, ': light ground') # light ground
    #terminal.layer(2)
    terminal.put(10, 10, 389)



#############################
# Initialisation            #
#############################

terminal.open()

# !! set this \/ for ng
terminal.set("window: size=80x50; window.title='Caves of the Snailmen'; font: tilesets/tiles.png, size=16x16; input: filter=[keyboard, mouse_left]")


#############################
# Main Loop                 #
#############################

main_menu()
#new_game()
#play_game()

コード例 #3
0

class AtMan(MapChild):
    def __init__(self, x, y, parent_map):
        MapChild.__init__(self, x, y, '@', parent_map)
        eventhandler.register(self, *ARROW_EVENTS)

    def receive_event(self, event):
        if event == bl.TK_RIGHT: new_pos = (self.x + 1, self.y)
        elif event == bl.TK_LEFT: new_pos = (self.x - 1, self.y)
        elif event == bl.TK_UP: new_pos = (self.x, self.y - 1)
        elif event == bl.TK_DOWN: new_pos = (self.x, self.y + 1)
        self.parent_map.move(self, new_pos)


bl.open()
bl.refresh()
SCREEN_WIDTH = bl.state(bl.TK_WIDTH)
SCREEN_HEIGHT = bl.state(bl.TK_HEIGHT)

the_map = Map(SCREEN_WIDTH, SCREEN_HEIGHT, 3, 3, 9, 9)
at = AtMan(5, 5, the_map)
left_apostrophe = MapChild(0, 1, "'", the_map)
right_apostrophe = MapChild(2, 1, "'", the_map)
dud = MapChild(4, 4, "\u2193", the_map)
the_map.draw_view()
eventhandler.register(the_map, *ARROW_EVENTS + WASD_EVENTS)

menu = ui.Menu(60, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1)

paint(gridtools.hollow_rectangle(2, 2, 10, 10))
コード例 #4
0
    for w in xrange(width):
        for h in xrange(height):
            terminal.printf(x + w, y + h, "[U+2588]")



color1 = bltColor("red")

color2 = bltColor("#80905025")

color3 = bltColor("blue")




terminal.open()

terminal.set("window: size=80x25, cellsize=auto, title='Omni: menu';"
            "font: default;"
            "input: filter={keyboard}")

terminal.composition(True)

alphas = [16, 32, 64,80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240, 255, 240, 224, 208, 192, 176, 160, 144, 128, 112, 96, 80, 64, 32]
_alphas = cycle(alphas)

terminal.color(terminal.color_from_argb(128, 255,30,30))
drawRect(5,5,10,10)

color10 = bltColor('blue')