Skip to content
Snippets Groups Projects
Commit 982321d7 authored by leo's avatar leo
Browse files

~Cleaned up, removed pygame frontend

parent d5ff1648
No related branches found
No related tags found
No related merge requests found
Showing with 0 additions and 902 deletions
No preview for this file type
[
{
"question": "Nenne eine Programmiersprache:",
"answers": [
{
"answer": "python",
"score": 247
},
{
"answer": "c",
"score": 246
},
{
"answer": "c++",
"score": 104
},
{
"answer": "java",
"score": 87
},
{
"answer": "rust",
"score": 81
}
]
},
{
"question": "Nenne einen Compiler:",
"answers": [
{
"answer": "gcc",
"score": 750
},
{
"answer": "clang",
"score": 160
},
{
"answer": "llvm",
"score": 67
},
{
"answer": "javac",
"score": 45
},
{
"answer": "ghc",
"score": 34
}
]
},
{
"question": "Nenne eine Prozessorarchitektur:",
"answers": [
{
"answer": "arm",
"score": 375
},
{
"answer": "x86",
"score": 289
},
{
"answer": "risc",
"score": 78
},
{
"answer": "amd64",
"score": 76
},
{
"answer": "mips",
"score": 75
}
]
},
{
"question": "Nenne eine Zahl:",
"answers": [
{
"answer": "42",
"score": 468
},
{
"answer": "23",
"score": 218
},
{
"answer": "7",
"score": 78
},
{
"answer": "pi",
"score": 59
},
{
"answer": "1",
"score": 49
}
]
},
{
"question": "Nenne ein Netzwerkprotokoll:",
"answers": [
{
"answer": "tcp",
"score": 474
},
{
"answer": "udp",
"score": 155
},
{
"answer": "http",
"score": 104
},
{
"answer": "ip",
"score": 69
},
{
"answer": "ssh",
"score": 51
}
]
},
{
"question": "Nenne einen HTTP-Statuscode:",
"answers": [
{
"answer": "404",
"score": 486
},
{
"answer": "418",
"score": 212
},
{
"answer": "200",
"score": 178
},
{
"answer": "403",
"score": 90
},
{
"answer": "500",
"score": 67
}
]
},
{
"question": "Nenne einen Standard:",
"answers": [
{
"answer": "din a4",
"score": 68
},
{
"answer": "iso 8601",
"score": 38
},
{
"answer": "iso",
"score": 36
},
{
"answer": "iso 9001",
"score": 34
},
{
"answer": "din",
"score": 31
}
]
},
{
"question": "Nenne einen HTML-Tag:",
"answers": [
{
"answer": "html",
"score": 149
},
{
"answer": "blink",
"score": 140
},
{
"answer": "a",
"score": 130
},
{
"answer": "body",
"score": 125
},
{
"answer": "marquee",
"score": 109
}
]
},
{
"question": "Nenne einen Kernel:",
"answers": [
{
"answer": "linux",
"score": 494
},
{
"answer": "hurd",
"score": 72
},
{
"answer": "darwin",
"score": 56
},
{
"answer": "mach",
"score": 56
},
{
"answer": "xnu",
"score": 37
}
]
},
{
"question": "Nenne ein Getr\u00e4nk:",
"answers": [
{
"answer": "mate",
"score": 372
},
{
"answer": "wasser",
"score": 135
},
{
"answer": "bier",
"score": 105
},
{
"answer": "kaffee",
"score": 105
},
{
"answer": "cola",
"score": 99
}
]
},
{
"question": "Nenne ein Gesellschaftsspiel:",
"answers": [
{
"answer": "monopoly",
"score": 318
},
{
"answer": "risiko",
"score": 105
},
{
"answer": "mensch \u00e4rgere dich nicht",
"score": 96
},
{
"answer": "siedler von catan",
"score": 86
},
{
"answer": "cards against humanity",
"score": 40
}
]
},
{
"question": "Nenne einen Cocktail:",
"answers": [
{
"answer": "tschunk",
"score": 409
},
{
"answer": "white russian",
"score": 122
},
{
"answer": "sex on the beach",
"score": 79
},
{
"answer": "mojito",
"score": 61
},
{
"answer": "cuba libre",
"score": 47
}
]
},
{
"question": "Nenne eine Shell:",
"answers": [
{
"answer": "bash",
"score": 556
},
{
"answer": "zsh",
"score": 493
},
{
"answer": "fish",
"score": 99
},
{
"answer": "powershell",
"score": 29
},
{
"answer": "ksh",
"score": 23
}
]
},
{
"question": "Nenne eine Farbe:",
"answers": [
{
"answer": "blau",
"score": 292
},
{
"answer": "schwarz",
"score": 229
},
{
"answer": "gr\u00fcn",
"score": 197
},
{
"answer": "rot",
"score": 172
},
{
"answer": "gelb",
"score": 64
}
]
},
{
"question": "Nenne einen Film:",
"answers": [
{
"answer": "matrix",
"score": 209
},
{
"answer": "hackers",
"score": 119
},
{
"answer": "23",
"score": 56
},
{
"answer": "tron",
"score": 31
},
{
"answer": "pulp fiction",
"score": 31
}
]
},
{
"question": "Nenne eine Serie:",
"answers": [
{
"answer": "doctor who",
"score": 64
},
{
"answer": "it crowd",
"score": 63
},
{
"answer": "mr. robot",
"score": 59
},
{
"answer": "star trek",
"score": 49
},
{
"answer": "game of thrones",
"score": 48
}
]
},
{
"question": "Von welchem Hersteller ist dein Laptop?",
"answers": [
{
"answer": "lenovo",
"score": 644
},
{
"answer": "apple",
"score": 372
},
{
"answer": "dell",
"score": 110
},
{
"answer": "hp",
"score": 69
},
{
"answer": "acer",
"score": 50
}
]
},
{
"question": "Nenne ein Werkzeug:",
"answers": [
{
"answer": "hammer",
"score": 507
},
{
"answer": "schraubendreher",
"score": 90
},
{
"answer": "l\u00f6tkolben",
"score": 90
},
{
"answer": "schraubenzieher",
"score": 56
},
{
"answer": "phasenpr\u00fcfer",
"score": 52
}
]
},
{
"question": "Nenne den PIN deiner EC Karte:",
"answers": [
{
"answer": "1234",
"score": 264
},
{
"answer": "0000",
"score": 206
},
{
"answer": "1337",
"score": 173
},
{
"answer": "2342",
"score": 80
},
{
"answer": "nein",
"score": 64
}
]
}
]
\ No newline at end of file
src/frontend/ChaosWest.png

56.3 KiB

<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Ebene_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 322.2 396.6" style="enable-background:new 0 0 322.2 396.6;" xml:space="preserve">
<style type="text/css">
.st0{clip-path:url(#SVGID_2_);fill:url(#SVGID_3_);}
</style>
<g>
<defs>
<path id="SVGID_1_" d="M156.3,342.2c0,2.1,1.4,3.9,3.3,4.6v20.9c-1.9,0.6-3.3,2.4-3.3,4.6c0,2.7,2.2,4.8,4.8,4.8
c2.7,0,4.8-2.2,4.8-4.8c0-2.1-1.4-3.9-3.3-4.6v-20.9c1.9-0.6,3.3-2.4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,263.6c0-2.7,2.2-4.9,4.9-4.9
c2.7,0,4.9,2.2,4.9,4.9c0,2.7-2.2,4.9-4.9,4.9C147.5,268.5,145.3,266.3,145.3,263.6 M165.4,263.6c0-2.7,2.2-4.9,4.9-4.9
c2.7,0,4.9,2.2,4.9,4.9c0,2.7-2.2,4.9-4.9,4.9C167.6,268.5,165.4,266.3,165.4,263.6 M107.7,218.4c0-2.7,2.2-4.9,4.9-4.9
c2.7,0,4.9,2.2,4.9,4.9c0,2.7-2.2,4.9-4.9,4.9C109.9,223.3,107.7,221.1,107.7,218.4 M203,218.4c0-2.7,2.2-4.9,4.9-4.9
s4.9,2.2,4.9,4.9c0,2.7-2.2,4.9-4.9,4.9S203,221.1,203,218.4 M202,184.7c0-2.7,2.2-4.9,4.9-4.9c2.7,0,4.9,2.2,4.9,4.9
c0,2.7-2.2,4.9-4.9,4.9C204.2,189.6,202,187.4,202,184.7 M310,105.4l9.2,6.3v173.1l-9.2,6.3V105.4z M3,284.8V111.7l10-6.9v186.9
L3,284.8z M202,108.3c0-2.7,2.2-4.9,4.9-4.9c2.7,0,4.9,2.2,4.9,4.9c0,2.7-2.2,4.9-4.9,4.9C204.2,113.1,202,110.9,202,108.3
M131.9,74.7h58.8c0.8,1.6,2.4,2.8,4.3,2.8c0.8,0,1.6-0.2,2.2-0.6l41.7,24.9v115.7h-23.3c-0.5-3.8-3.8-6.8-7.8-6.8
c-4.3,0-7.9,3.5-7.9,7.9c0,3.8,2.7,7,6.3,7.7V284l-7.8,8.9h-17.5l-9.8-9v-12.5c3.9-0.5,6.9-3.8,6.9-7.8c0-4.3-3.5-7.9-7.9-7.9
c-3.6,0-6.7,2.5-7.6,5.9h-5c-0.9-3.4-3.9-5.9-7.6-5.9c-4.3,0-7.9,3.5-7.9,7.9c0,4,3,7.3,6.9,7.8v12.5l-9.8,9h-17.5l-7.8-8.9v-57.9
c3.6-0.7,6.3-3.9,6.3-7.7c0-4.3-3.5-7.9-7.9-7.9c-4.3,0-7.9,3.5-7.9,7.9c0,3.8,2.8,7,6.4,7.7v59l9.4,10.8h20l11.6-10.7v-14
c3-0.8,5.3-3.4,5.8-6.6h4.6c0.4,3.2,2.7,5.7,5.8,6.6v14l11.6,10.7h20l9.4-10.8v-59c3-0.6,5.4-2.8,6.2-5.7H239V342l-0.9-1.2
l-76.6,52.8h-0.8l-76.6-52.8V147h29.8v18.3l17.7,20.9h67.5V186c0.6,3.7,3.8,6.6,7.7,6.6c4.3,0,7.9-3.5,7.9-7.9
c0-4.3-3.5-7.9-7.9-7.9c-3.9,0-7.1,2.9-7.7,6.6v-0.3H133l-16.1-19v-34.6l16.1-19.7h66.1c0.7,3.6,3.9,6.3,7.7,6.3
c4.3,0,7.9-3.5,7.9-7.9c0-4.3-3.5-7.9-7.9-7.9c-3.9,0-7,2.8-7.7,6.4h-67.5l-17.7,21.6V144H84.1v-42l40.6-25.4
c0.8,0.6,1.8,0.9,2.8,0.9C129.5,77.5,131.1,76.3,131.9,74.7 M16,307.5v-219l65-45.6v310.2L16,307.5z M242,43l65,45.6v219l-65,45.6
V43z M84.1,41.1l39.2,29.3c-0.4,0.7-0.6,1.4-0.6,2.3c0,0.5,0.1,1,0.2,1.4L84.1,98.4V41.1z M199.4,74.7c0.3-0.6,0.5-1.3,0.5-2
c0-0.7-0.2-1.4-0.5-2L239,41v57.3L199.4,74.7z M97,46.9L160.7,3h0.8l64.1,44.2l-28.4,21.2c-0.7-0.4-1.4-0.6-2.3-0.6
c-2.3,0-4.3,1.7-4.7,3.9h-58c-0.4-2.2-2.4-3.9-4.7-3.9c-0.7,0-1.4,0.2-2,0.5L97,46.9z M159.8,0L94.4,45.1l-10.3-7.7v-0.1L13,87
v14.2l-13,9v176.2l13,9v13.7l71,49.8v-14.5l75.7,52.2h2.7l76.5-52.8v15.1l70.4-49.4l0.6-0.4v-14.3l12.2-8.4V110.2l-12.2-8.4V87
l-71-49.8v0.1l0,0l-10.8,8.1L162.4,0H159.8z"/>
</defs>
<clipPath id="SVGID_2_">
<use xlink:href="#SVGID_1_" style="overflow:visible;"/>
</clipPath>
<linearGradient id="SVGID_3_" gradientUnits="userSpaceOnUse" x1="9.466112e-08" y1="397.6167" x2="1" y2="397.6167" gradientTransform="matrix(322.2028 0 0 -322.2028 -3.049988e-05 128311.5078)">
<stop offset="0" style="stop-color:#0084B1"/>
<stop offset="1" style="stop-color:#00A356"/>
</linearGradient>
<rect x="0" y="0" class="st0" width="322.2" height="396.6"/>
</g>
</svg>
File deleted
File deleted
File deleted
File deleted
File deleted
File deleted
src/frontend/chaos_west_text.jpg

46.5 KiB

{
"state": "player_select",
"points": 0,
"current_teams": [
"warpzone",
"binary kitchen"
],
"current_team_logos": [
"halo/i/bims/1/pfad",
"static/teamlogos/binary kitchen.png"
],
"current_team_points": [
0,
0
],
"current_team_fails": [
0,
0
],
"answer_amount": 5,
"question": "Nenne eine Shell:",
"answers": [
{
"answer": "bash",
"numberOfPeople": 556,
"visible": false
},
{
"answer": "zsh",
"numberOfPeople": 493,
"visible": false
},
{
"answer": "fish",
"numberOfPeople": 99,
"visible": false
},
{
"answer": "powershell",
"numberOfPeople": 29,
"visible": false
},
{
"answer": "ksh",
"numberOfPeople": 23,
"visible": false
}
]
}
\ No newline at end of file
import pygame
import json
import os
import sys
import time
import logging
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
import cv2
pygame.font.init()
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
DARK_GRAY = (30, 30, 60)
LIGHT_GRAY = (150, 150, 150)
RED = (200, 50, 0)
CCC_GREEN = (0, 163, 86)
CCC_BLUE = (0, 132, 176)
BG_COLOR = BLACK # (59, 0, 112)
class LoggingEventHandler(FileSystemEventHandler):
"""Logs all the events captured."""
def __init__(self, callback, *args, **kwargs):
super(LoggingEventHandler, self).__init__(*args, **kwargs)
self.callback = callback
def on_moved(self, event):
super(LoggingEventHandler, self).on_moved(event)
what = 'directory' if event.is_directory else 'file'
logging.info("Moved %s: from %s to %s", what, event.src_path,
event.dest_path)
def on_created(self, event):
super(LoggingEventHandler, self).on_created(event)
what = 'directory' if event.is_directory else 'file'
logging.info("Created %s: %s", what, event.src_path)
def on_deleted(self, event):
super(LoggingEventHandler, self).on_deleted(event)
what = 'directory' if event.is_directory else 'file'
logging.info("Deleted %s: %s", what, event.src_path)
def on_modified(self, event):
super(LoggingEventHandler, self).on_modified(event)
# if not event.is_directory and event.src_path == "current_round.json":
self.callback()
what = 'directory' if event.is_directory else 'file'
logging.info("Modified %s: %s", what, event.src_path)
class Live(object):
def __init__(self, window_width=-1):
self.window_width = window_width
self.side_width = 768
self.height = 768
self.main_width = 2560
self.left_screen = pygame.surface.Surface((self.side_width, self.height))
self.main_screen = pygame.surface.Surface((self.main_width, self.height))
self.right_screen = pygame.surface.Surface((self.side_width, self.height))
#self.display = pygame.display.set_mode((self.side_width + self.side_width + self.main_width, self.height))
cv2.namedWindow("output")
_font = "PressStart2P-Regular.ttf"
self.font_xxl = pygame.font.Font(_font, 150)
self.font_xl = pygame.font.Font(_font, 75)
self.font_l = pygame.font.Font(_font, 40)
self.font_m = pygame.font.Font(_font, 30)
self.font_s = pygame.font.Font(_font, 20)
# intro_screen
# player_select
# running_round
# final_screen
self.state = "intro_screen"
self.current_player = -1 # -1 No Team, 0 Left Team, 1 Right Team
self.team_names = ["", ""]
self.team_points = [0, 0]
self.team_fails = [0, 0]
self.current_round = {}
self.not_animated = [1, 1, 1, 1, 1]
self.vis_questions = [0, 0, 0, 0, 0]
## PRE RENDERS '_pr'
self.debug_side_pr = pygame.surface.Surface((1080, 1080))
self.debug_side_pr.fill((0, 0, 30))
self.debug_middle_pr = pygame.surface.Surface((1920, 1080))
self.debug_middle_pr.fill((30, 0, 0))
self.header_pr = self.font_xl.render("Chaos-Familien-Duell", True, CCC_BLUE, BG_COLOR)
self.slogan_pr = self.font_m.render("Wir haben 1509 HackerInnen gefragt...", True, WHITE, BG_COLOR)
# self.final_slogan_pr = self.font_m.render("Vielen Dank an watterott.com für die tollen Preise!", True, WHITE, BG_COLOR)
self.final_slogan_pr = self.font_m.render("Die Entwicklung dieser Software wurde freundlicherweise unterstützt von", True, WHITE, BG_COLOR)
self.koffein = self.font_xxl.render("KOFFEIN", True, WHITE, BG_COLOR)
self.x_pr = self.font_xxl.render("X", True, RED, BG_COLOR)
self.x_small_pr = self.font_m.render("X", True, WHITE, DARK_GRAY)
self.chaos_west_pr = pygame.image.load("ChaosWest.png")
self.watterott_pr = pygame.image.load("watterott.png")
self.chaos_west_pr = pygame.transform.scale(self.chaos_west_pr, (400, 500))
self.chaos_west_text_pr = pygame.image.load("chaos_west_text.jpg")
self.gray_box_pr = pygame.surface.Surface((1200, 60))
self.gray_box_pr.fill(DARK_GRAY)
self.team_left_pr = None
self.team_right_pr = None
self.question_pr = None
self.logo_left_pr = None
self.logo_right_pr = None
self.answers_pr = [None, None, None, None, None]
self.answered_pr = [None, None, None, None, None]
self.file_changed()
logging.basicConfig(level=logging.INFO,
format='%(asctime)s - %(message)s',
datefmt='%Y-%m-%d %H:%M:%S')
path = '.'
event_handler = LoggingEventHandler(self.file_changed)
observer = Observer()
observer.schedule(event_handler, path, recursive=True)
observer.start()
def file_changed(self):
with open("current_round.json", 'r') as target:
self.current_round = json.load(target)
state = self.current_round["state"]
self.team_names = self.current_round["current_teams"]
self.team_points = self.current_round["current_team_points"]
self.team_fails = self.current_round["current_team_fails"]
self.round_points = self.current_round["points"]
self.current_player = -1
if len(self.team_names[0]) > 30:
_font_left = self.font_s
else:
_font_left = self.font_l
if len(self.team_names[1]) > 30:
_font_right = self.font_s
else:
_font_right = self.font_l
self.team_left_pr = _font_left.render(self.team_names[0], True, WHITE, BG_COLOR)
self.team_right_pr = _font_right.render(self.team_names[1], True, WHITE, BG_COLOR)
self.question_pr = self.font_l.render(self.current_round["question"], True, CCC_BLUE, BG_COLOR)
# _p1 = "../static/teamlogos" + str(self.current_round["current_teams_id"][0]) + ".png"
# _p2 = "data/logo_" + str(self.current_round["current_teams_id"][1]) + ".png"
_p1 = "../" + self.current_round["current_team_logos"][0]
_p2 = "../" + self.current_round["current_team_logos"][1]
if os.path.exists(_p1):
self.logo_left_pr = pygame.image.load(_p1)
if os.path.exists(_p2):
self.logo_right_pr = pygame.image.load(_p2)
for i in range(0, self.current_round["answer_amount"]):
self.vis_questions[i] = self.current_round["answers"][i]["visible"]
self.answers_pr[i] = self.font_m.render(self.current_round["answers"][i]["answer"], True, WHITE, DARK_GRAY)
self.answered_pr[i] = self.font_m.render(str(self.current_round["answers"][i]["numberOfPeople"]), True, WHITE, DARK_GRAY)
self.state = state
def update(self):
if self.state == "intro_screen":
pass
elif self.state == "player_select":
pass # TODO: Read input from hardware
elif self.state == "running_round":
pass # ....
elif self.state == "final_screen":
pass # ...
def draw(self):
self.main_screen.fill(BG_COLOR)
self.left_screen.fill(BG_COLOR)
self.right_screen.fill(BG_COLOR)
#self.left_screen.fill((255, 0, 0))
#self.right_screen.fill((0, 0, 255))
if self.state == "intro_screen":
self.main_screen.blit(self.chaos_west_text_pr, (((self.main_width / 2) - (self.chaos_west_text_pr.get_width() / 2)), 200))
self.main_screen.blit(self.header_pr, ((self.main_width / 2) - (self.header_pr.get_width() / 2), 20))
self.main_screen.blit(self.slogan_pr, ((self.main_width / 2) - (self.slogan_pr.get_width() / 2), 150))
self.left_screen.blit(self.chaos_west_pr, ((self.side_width / 2) - (self.chaos_west_pr.get_width() / 2), (self.height / 2) - (self.chaos_west_pr.get_height() / 2)))
self.right_screen.blit(self.chaos_west_pr, ((self.side_width / 2) - (self.chaos_west_pr.get_width() / 2), (self.height / 2) - (self.chaos_west_pr.get_height() / 2)))
elif self.state == "player_select":
self.main_screen.blit(self.header_pr, ((self.main_width / 2) - (self.header_pr.get_width() / 2), 20))
self.main_screen.blit(self.question_pr, (530, 250))
for i in range(0, self.current_round["answer_amount"]):
self.main_screen.blit(self.gray_box_pr, ((self.main_width / 2) - (self.gray_box_pr.get_width() / 2), 350 + (i * 70)))
if not self.vis_questions[i] and self.not_animated[i] <= 0:
self.not_animated[i] = 1
if self.vis_questions[i]:
self.main_screen.blit(self.answers_pr[i], (700, 364 + (i * 70)))
self.main_screen.blit(self.answered_pr[i], (1850 - self.answered_pr[i].get_width(), 363 + (i * 70)))
if self.vis_questions[i] and self.not_animated[i] > 0:
self.not_animated[i] -= 0.2
if (self.not_animated[i] <= 0):
self.not_animated[i] = 0.001
_tmp_sur = pygame.surface.Surface((self.gray_box_pr.get_width() * self.not_animated[i], self.gray_box_pr.get_height()))
_tmp_sur.fill(DARK_GRAY)
self.main_screen.blit(_tmp_sur, ((self.main_width / 2) - (self.gray_box_pr.get_width() / 2), 350 + (i * 70)))
_points_left = self.font_xxl.render(str(self.team_points[0]), True, CCC_GREEN, BG_COLOR)
_points_right = self.font_xxl.render(str(self.team_points[1]), True, CCC_GREEN, BG_COLOR)
self.main_screen.blit(_points_left, (0, (self.height/2) - (_points_left.get_height() / 2)))
self.main_screen.blit(_points_right, ((self.main_width - 0 - _points_right.get_width()), (self.height/2) - (_points_left.get_height() / 2)))
_round_points = self.font_xl.render(str(self.round_points), True, CCC_GREEN, BG_COLOR)
self.main_screen.blit(_round_points, (1200, 140))
self.left_screen.blit(self.team_left_pr, ((self.side_width/2) - (self.team_left_pr.get_width()/2), 60))
self.left_screen.blit(self.logo_left_pr, ((self.side_width/2) - (self.logo_left_pr.get_width()/2), self.height - self.logo_left_pr.get_height() - 20))
self.right_screen.blit(self.team_right_pr, ((self.side_width/2) - (self.team_right_pr.get_width()/2), 60))
self.right_screen.blit(self.logo_right_pr, ((self.side_width/2) - (self.logo_right_pr.get_width()/2), self.height - self.logo_right_pr.get_height() - 20))
for i in range(0, self.team_fails[0]):
self.main_screen.blit(self.x_pr, (60 + (i * 175), 600))
for i in range(0, self.team_fails[1]):
self.main_screen.blit(self.x_pr, (2530 - ((i+1) * 175), 600))
elif self.state == "final_screen":
# self.main_screen.blit(self.watterott_pr, ((self.main_width / 2) - (self.watterott_pr.get_width() / 2), -100))
self.main_screen.blit(self.final_slogan_pr, ((self.main_width / 2) - (self.final_slogan_pr.get_width() / 2), 150))
self.main_screen.blit(self.koffein, ((self.main_width / 2) - (self.koffein.get_width() / 2), 250))
# self.main_screen.blit(self.header_pr, ((self.main_width / 2) - (self.header_pr.get_width() / 2), 20))
self.output()
def output(self):
_tmp = pygame.surface.Surface((4096, 768))
_tmp.blit(self.left_screen, (0, 0))
_tmp.blit(self.main_screen, (self.side_width, 0))
_tmp.blit(self.right_screen, (self.side_width + self.main_width, 0))
out = pygame.surfarray.array3d(_tmp)
out = out.swapaxes(0, 1)
out = cv2.cvtColor(out, cv2.COLOR_BGR2RGB)
if self.window_width != -1:
out = cv2.resize(out, (self.window_width, int(self.height / ((self.side_width * 2 + self.main_width) / self.window_width))))
cv2.imshow("output", out)
key = cv2.waitKey(1)
if key == 27:
exit(0)
if key == ord("f"):
cv2.setWindowProperty("output", cv2.WND_PROP_FULLSCREEN, cv2.WINDOW_FULLSCREEN)
import live
import time
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--width", help="Breite des Fensters in Pixel (-1 Default)", default="-1", type=int)
args = parser.parse_args()
l = live.Live(args.width)
while 1:
l.update()
l.draw()
\ No newline at end of file
src/frontend/watterott.png

272 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment