IronForce is a decentralized network, Degeon is a messenger built on it
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.
 
 

40 lines
1020 B

from __future__ import annotations
from dataclasses import dataclass
import pygame
from config import HEIGHT, WIDTH, CHAT_SELECTOR_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 = WIDTH - CHAT_SELECTOR_WIDTH
@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