Classique #35

Merged
tipragot merged 11 commits from Classique into main 2023-10-29 18:51:42 +00:00
8 changed files with 82 additions and 1 deletions
Showing only changes of commit cf894a13db - Show all commits

BIN
assets/krita/search_bar.kra Normal file

Binary file not shown.

BIN
assets/krita/valider.kra Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View file

@ -4,12 +4,13 @@ Example de l'utilisation du moteur de jeu.
from engine import start_game
from scenes import menu
from scenes import classique, menu
start_game(
{
"menu": menu.SCENE,
"classique": classique.SCENE
},
"menu",
title="Guess The Number",

29
src/plugins/typing.py Normal file
View file

@ -0,0 +1,29 @@
"""
Definit un plugin qui crée un texte avec les touches frappées
"""
from engine import Keyboard, Scene, Text, World
class Typing:
"""
Marque une entité comme un texte qui s'ecrit en fonction du clavier
"""
def __update(world: World):
"""
Met a jour les entitées contenant le composant Typing
"""
keyboard = world[Keyboard]
for entity in world.query(Typing, Text):
text = entity[Text]
pressed = keyboard.pressed
PLUGIN = Scene(
[],
[__update],
[],
)

View file

@ -0,0 +1,51 @@
"""
Définis la scène du jeu classique, sans variante.
"""
from plugins import typing
from engine import (
Centered,
HoveredTexture,
Order,
Position,
Scene,
Text,
TextSize,
Texture,
World,
)
def __initialize_world(world: World):
"""
Initialise le monde du menu.
"""
world.create_entity(
Position(1215, 964),
Order(1),
Centered(),
Texture("classique/valider.png"),
HoveredTexture("classique/valider_hover.png"),
)
world.create_entity(
Position(519, 964),
Order(1),
Centered(),
Texture("classique/search_bar.png"),
)
world.create_entity(
Position(50, 750),
Order(2),
Text("Salut"),
TextSize(150),
)
SCENE = (
Scene(
[__initialize_world],
[],
[],
)
+ typing.PLUGIN
)