fix mypy... error
This commit is contained in:
parent
56a4de653d
commit
c79f1ab345
|
@ -23,7 +23,6 @@ class HoverPlugin(Plugin):
|
|||
textures = world[TextureManager]
|
||||
mouse_pos = world[Mouse].position
|
||||
for entity in entities:
|
||||
|
||||
# Récupération de la position et de la taille de l'entité
|
||||
entity_pos: Vec2 = entity[Position]
|
||||
if Offset in entity:
|
||||
|
@ -65,18 +64,18 @@ class Hover:
|
|||
Un composant qui marque une entitée comme etant survolée.
|
||||
"""
|
||||
|
||||
|
||||
class Hoverable:
|
||||
"""
|
||||
Un composant qui marque une entitée comme pouvant etre survolée.
|
||||
"""
|
||||
|
||||
def __init__(self,
|
||||
entry_callback: Callable[[World, Entity], None] = lambda _a,_b : (),
|
||||
update_callback: Callable[[World, Entity], None] = lambda _a,_b : (),
|
||||
exit_callback: Callable[[World, Entity], None] = lambda _a,_b : (),
|
||||
def __init__(
|
||||
self,
|
||||
entry_callback: Callable[[World, Entity], None] = lambda _a, _b: None,
|
||||
update_callback: Callable[[World, Entity], None] = lambda _a, _b: None,
|
||||
exit_callback: Callable[[World, Entity], None] = lambda _a, _b: None,
|
||||
) -> None:
|
||||
|
||||
self.update_callback = update_callback
|
||||
self.entry_callback = entry_callback
|
||||
self.exit_callback = exit_callback
|
||||
|
||||
|
|
13
src/main.py
13
src/main.py
|
@ -5,8 +5,8 @@ Ceci est un exemple de comment l'on peut utiliser le moteur du jeu.
|
|||
|
||||
from engine import *
|
||||
from engine.math import Vec2
|
||||
from engine.plugins.animation import AnimatedSprite, AnimationPlugin
|
||||
from engine.plugins.clickable import Clickable, ClickablePlugin
|
||||
from engine.plugins.animation import AnimationPlugin
|
||||
from engine.plugins.clickable import ClickablePlugin
|
||||
from engine.plugins.hover import HoverPlugin, Hoverable
|
||||
from engine.plugins.render import (
|
||||
Order,
|
||||
|
@ -16,7 +16,6 @@ from engine.plugins.render import (
|
|||
)
|
||||
from engine.plugins.timing import Delta, TimePlugin
|
||||
from engine.plugins.pygame import Display, Keyboard, PygamePlugin
|
||||
from random import random
|
||||
|
||||
|
||||
# Initialisation
|
||||
|
@ -41,12 +40,16 @@ def spawn_sprites(world: World) -> None:
|
|||
Position(position),
|
||||
Order(0),
|
||||
Texture(file_name + ".png"),
|
||||
Hoverable(entry_callback= lambda _world, entity: entity.set(
|
||||
Hoverable(
|
||||
entry_callback=lambda _world, entity: entity.set(
|
||||
Texture(file_name + "_hover.png"),
|
||||
),
|
||||
exit_callback=lambda _world, entity: entity.set(
|
||||
Texture(file_name + ".png"),
|
||||
)),)
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
for i in range(3):
|
||||
if i == 0:
|
||||
file_name = "button_classique"
|
||||
|
|
Loading…
Reference in a new issue