Skip to content

Commit

Permalink
Merge pull request #67 from LupaDevStudio/49-add-a-link-to-the-website
Browse files Browse the repository at this point in the history
49 add a link to the website
  • Loading branch information
LupaDevStudio committed Dec 5, 2023
2 parents 5fe2e39 + b221a57 commit c66f55b
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ reports

# Ignore screenshots
screenshot*
share_image*
share_image.png

# Ignore ini files
*ini
Expand Down
Binary file added resources/images/lupa_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 14 additions & 10 deletions screens/menu.kv
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,6 @@
on_release:
root.manager.current = "settings"

# Label:
# id: high_score_label
# text: root.high_score
# bold: True
# color: TITLE_FONT_COLOR
# pos_hint: {"right":1, "y":0}
# size_hint: 0.2, 0.1
# font_name: root.font_name
# font_size: 30*root.font_ratio

Image:
source: PATH_IMAGES + "achievements_logo.png"
size_hint: None, side_logo_size
Expand All @@ -79,3 +69,17 @@
width: self.height
on_release:
root.manager.current = "achievements"

Image:
source: PATH_IMAGES + "lupa_logo.png"
size_hint: None, side_logo_size*0.7
pos_hint: {"center_x": 0.5, "y": 0.05}
allow_stretch: True
width: self.height
Button:
size_hint: None,side_logo_size*0.7
pos_hint: {"center_x": 0.5, "y": 0.05}
background_color: (0, 0, 0, 0)
width: self.height
on_release:
root.open_lupa_website()
7 changes: 7 additions & 0 deletions screens/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
### Imports ###
###############

### Python imports ###

import webbrowser

### Kivy imports ###

from kivy.clock import Clock
Expand Down Expand Up @@ -90,3 +94,6 @@ def start_game(self):
self.manager.current = "tutorial"
else:
self.manager.current = "game"

def open_lupa_website(self):
webbrowser.open("https://lupadevstudio.com", 2)
48 changes: 48 additions & 0 deletions tools/share_image.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import PIL.Image as PIL_Image
from PIL import ImageDraw, ImageFont
from tools.path import (
PATH_IMAGES,
PATH_TEXT_FONT,
PATH_TITLE_FONT
)


def create_image_to_share(score, ending_title, back_image_path):
"""
Generate an image to share it.
"""

# Load the images
back_image = PIL_Image.open(back_image_path)
tombstone_image = PIL_Image.open(PATH_IMAGES + "ending_background.png",)

# Resize and paste the tombstone
tombstone_image = tombstone_image.resize((1024 - 584, 1024 - 584))
back_image.paste(tombstone_image, (584, 584, 1024, 1024),
mask=tombstone_image)

# Load the font
title_font = ImageFont.truetype(PATH_TITLE_FONT, 60)
font = ImageFont.truetype(PATH_TEXT_FONT, 40)

# Add the text
draw_image = ImageDraw.Draw(back_image)
draw_image.text(((1024 + 584) / 2, 910), "Score : " + str(score),
font=font, fill=(0, 0, 0), align="center", anchor="mm")
new_ending_title = ending_title
for i, car in enumerate(ending_title):
if i > 10 and car == " ":
new_ending_title = ending_title[:i] + \
"\n" + ending_title[i + 1:]
draw_image.multiline_text(((1024 + 584) / 2, 810), new_ending_title,
font=font, fill=(0, 0, 0), align="center", anchor="mm")
draw_image.text(((1024 + 584) / 2, 710), "POSTRIAS", font=title_font,
fill=(0, 0, 0), align="center", anchor="mm")

# Save the image
back_image.save("./share_image.png")


if __name__ == "__main__":
create_image_to_share(100, "La fin de la Science",
"./resources/images/ending_order_max.jpg")

0 comments on commit c66f55b

Please sign in to comment.