add ascii.py
This commit is contained in:
parent
fc97cb0c76
commit
1e5937a621
6 changed files with 11 additions and 18 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -2,6 +2,9 @@
|
||||||
from os import get_terminal_size
|
from os import get_terminal_size
|
||||||
tx,ty = get_terminal_size().columns ,get_terminal_size().lines-2
|
tx,ty = get_terminal_size().columns ,get_terminal_size().lines-2
|
||||||
|
|
||||||
|
def clear():
|
||||||
|
print('\033c', end='')
|
||||||
|
|
||||||
class tengine():
|
class tengine():
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
self.screen = [[' ' for _ in range(tx)] for _ in range(ty+2)]
|
self.screen = [[' ' for _ in range(tx)] for _ in range(ty+2)]
|
||||||
|
@ -24,7 +27,6 @@ class tengine():
|
||||||
back += line[:tx] + "\n"
|
back += line[:tx] + "\n"
|
||||||
return back.lstrip('\n').rstrip('\n')
|
return back.lstrip('\n').rstrip('\n')
|
||||||
|
|
||||||
|
|
||||||
def set_char(self, character, position):
|
def set_char(self, character, position):
|
||||||
self.screen[position[0]][position[1]] = character
|
self.screen[position[0]][position[1]] = character
|
||||||
|
|
||||||
|
@ -38,8 +40,7 @@ class tengine():
|
||||||
pposition = [pposition[0], pposition[1] + 1]
|
pposition = [pposition[0], pposition[1] + 1]
|
||||||
self.screen[pposition[0]][pposition[1]] = zeichen
|
self.screen[pposition[0]][pposition[1]] = zeichen
|
||||||
|
|
||||||
def clear(self):
|
|
||||||
print('\033c', end='')
|
|
||||||
|
|
||||||
def draw_border(self, border_char='+'):
|
def draw_border(self, border_char='+'):
|
||||||
for i in range(len(self.screen)):
|
for i in range(len(self.screen)):
|
||||||
|
|
10
v1.py
10
v1.py
|
@ -1,17 +1,9 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
import os
|
import os
|
||||||
from forgejo.cowyeet_terminal.tengine.main import ty,tx,clear
|
from tengine.main import ty,tx,clear
|
||||||
from pynput import keyboard
|
from pynput import keyboard
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
|
|
||||||
#def clear():
|
|
||||||
# if os.name == "nt":
|
|
||||||
# os.system("cls")
|
|
||||||
# else:
|
|
||||||
# os.system("clear")
|
|
||||||
|
|
||||||
|
|
||||||
def on_press(key):
|
def on_press(key):
|
||||||
global running
|
global running
|
||||||
if key == keyboard.Key.space:
|
if key == keyboard.Key.space:
|
||||||
|
|
12
v2.py
12
v2.py
|
@ -44,7 +44,7 @@ if __name__ == "__main__" and running == True:
|
||||||
scene.set_block(ascii.start_screen_text,[ty,int(tx/2-5)])
|
scene.set_block(ascii.start_screen_text,[ty,int(tx/2-5)])
|
||||||
scene.print()
|
scene.print()
|
||||||
sleep(0.2)
|
sleep(0.2)
|
||||||
scene.clear()
|
clear()
|
||||||
if key_space == True:
|
if key_space == True:
|
||||||
while not key_space == False:
|
while not key_space == False:
|
||||||
startscreen = False
|
startscreen = False
|
||||||
|
@ -52,7 +52,7 @@ if __name__ == "__main__" and running == True:
|
||||||
scene.viereck([ty,int(tx/2-4)],11,1," ")
|
scene.viereck([ty,int(tx/2-4)],11,1," ")
|
||||||
scene.print()
|
scene.print()
|
||||||
sleep(0.2)
|
sleep(0.2)
|
||||||
scene.clear()
|
clear()
|
||||||
if key_space == True:
|
if key_space == True:
|
||||||
while not key_space == False:
|
while not key_space == False:
|
||||||
startscreen = False
|
startscreen = False
|
||||||
|
@ -62,7 +62,7 @@ if __name__ == "__main__" and running == True:
|
||||||
cows = "🐵🐒🦍🦧🐕🐯🦝🐩🐅🐴🐎🦄🦌🐗🐂🐃🐄🐪🐫🦙🦒🐹🦘🦡🐧🕊️ 🦅🦆🦉🐍🦎🐊🦜🦚🦩🐲🐉🦕"
|
cows = "🐵🐒🦍🦧🐕🐯🦝🐩🐅🐴🐎🦄🦌🐗🐂🐃🐄🐪🐫🦙🦒🐹🦘🦡🐧🕊️ 🦅🦆🦉🐍🦎🐊🦜🦚🦩🐲🐉🦕"
|
||||||
cowlistlength = len(cows)
|
cowlistlength = len(cows)
|
||||||
cow = "#" #cows[random.randint(0, cowlistlength - 1)]
|
cow = "#" #cows[random.randint(0, cowlistlength - 1)]
|
||||||
scene.clear()
|
clear()
|
||||||
#scene[ty][tx] ### 2zeichen kuhh mach probleme
|
#scene[ty][tx] ### 2zeichen kuhh mach probleme
|
||||||
while running == True:
|
while running == True:
|
||||||
wobl = "-" * (tx - wobble_pos - 5)
|
wobl = "-" * (tx - wobble_pos - 5)
|
||||||
|
@ -95,18 +95,18 @@ if __name__ == "__main__" and running == True:
|
||||||
wobble_way = "right"
|
wobble_way = "right"
|
||||||
|
|
||||||
sleep(wobble_speed)
|
sleep(wobble_speed)
|
||||||
scene.clear()
|
clear()
|
||||||
|
|
||||||
if key_space == True:
|
if key_space == True:
|
||||||
break
|
break
|
||||||
points_prozent = int((points/txhalb)*100)
|
points_prozent = int((points/txhalb)*100)
|
||||||
scene.clear()
|
clear()
|
||||||
for a in range(int(points*2)-2):
|
for a in range(int(points*2)-2):
|
||||||
scene.set_block("-"*a+cow,[0,0])#🐄️
|
scene.set_block("-"*a+cow,[0,0])#🐄️
|
||||||
scene.set_block(str(points_prozent)+"%",[1,int(tx/2-2)])
|
scene.set_block(str(points_prozent)+"%",[1,int(tx/2-2)])
|
||||||
scene.print()
|
scene.print()
|
||||||
sleep(0.01)
|
sleep(0.01)
|
||||||
scene.clear()
|
clear()
|
||||||
scene.print()
|
scene.print()
|
||||||
|
|
||||||
exit()
|
exit()
|
||||||
|
|
Loading…
Reference in a new issue