Easy to use game development library based on pygame
Project description
EZSGAME
ezsgame is a library that aims to make the process of creating and manipulating 2D graphics or game development simple, easy, fun, and comfortable as possible for the user.
Instalation
pip install ezsgame
Manual install
Sample
window = Window()
# current count value
current_value = [0] # We use a list so the value can be modified from other scopes
container = Rect(
Pos("center", "center"), Size("30%", "2/4"), styles=Styles(color="white", stroke=1)
)
counter_text = Text(
f"Count is {current_value[0]}", 23, Pos(0, 0), parent=container
).center_at() # This method centers the objects inside it's parent
# Let's make buttons to modify the count
increase_button = Rect(
pos=Pos("right-center", "center"),
size=Size(50, 50),
styles=Styles(border_radius=[5], color="green"),
)
# Lets add an event listerner to the button
@add_event(event="click", object=increase_button)
def increase_count():
# This method will only be called when `increase_button` is clicked
current_value[0] += 1
# We also need to update the text in the counter
counter_text.update(text=f"Count is {current_value[0]}")
decrease_button = Rect(
pos=Pos("left-center", "center"),
size=Size(50, 50),
styles=Styles(border_radius=[5], color="red"),
)
@add_event(event="click", object=decrease_button)
def decrease_count():
# This method will only be called when `decrease_button` is clicked
current_value[0] -= 1
# We also need to update the text in the counter
counter_text.update(text=f"Count is {current_value[0]}")
# Group everthing so you don't have to call draw method one-by-one
counter = Group(container, counter_text, decrease_button, increase_button)
while True:
window.check_events()
window.fill("black")
# Draw the counter
counter.draw()
window.update()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ezsgame-0.6.tar.gz
(27.7 kB
view details)
File details
Details for the file ezsgame-0.6.tar.gz
.
File metadata
- Download URL: ezsgame-0.6.tar.gz
- Upload date:
- Size: 27.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b137d76ff3ea4151e5b5d69fc058d2b69bd7e6b5293b6dcd17992fcc04ccfc7d |
|
MD5 | ddf90ac90db7d6bcae4321e08ff892e9 |
|
BLAKE2b-256 | 94d72246486708b2446df75a686c179d5649e5f1a75eb219c45b9a63186dde8d |