You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
988 B
41 lines
988 B
3 years ago
|
from __future__ import annotations
|
||
|
|
||
|
from dataclasses import dataclass
|
||
|
import pygame
|
||
|
|
||
|
from config import HEIGHT, WIDTH
|
||
|
import degeon_core as dc
|
||
|
|
||
|
|
||
|
@dataclass
|
||
|
class ActiveChat:
|
||
|
"""
|
||
|
The widget with the current chat
|
||
|
|
||
|
Attributes:
|
||
|
:param chat (dc.Chat): the chat (Rust Chat type)
|
||
|
"""
|
||
|
chat: dc.Chat
|
||
|
height: int = HEIGHT
|
||
|
width: int = 3 * (WIDTH // 4)
|
||
|
|
||
|
@classmethod
|
||
|
def new(cls, chat: 'dc.Chat', **kwargs) -> ActiveChat:
|
||
|
return cls(chat=chat, **kwargs)
|
||
|
|
||
|
def render(self) -> pygame.Surface:
|
||
|
"""
|
||
|
Creates a pygame surface and draws the chat on it
|
||
|
:return: the surface with the chat on it
|
||
|
"""
|
||
|
surface: pygame.Surface = pygame.Surface((self.width, self.height))
|
||
|
|
||
|
return surface
|
||
|
|
||
|
def process_event(self, event: pygame.event.Event):
|
||
|
"""
|
||
|
Process a click: select the necessary chat if this click is in the widget
|
||
|
:param event: a pygame event
|
||
|
"""
|
||
|
pass # todo
|