Skip to content

Commit

Permalink
Merge branch 'main' into tool-only
Browse files Browse the repository at this point in the history
# Conflicts:
#	README.md
  • Loading branch information
BlackRam-oss committed Jul 17, 2022
2 parents abeb6e5 + 5afaf2d commit 0067405
Show file tree
Hide file tree
Showing 4 changed files with 121 additions and 81 deletions.
3 changes: 1 addition & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
// for the documentation about the extensions.json format
"recommendations": [
"luquedaniel.languague-renpy",
"spmeesseman.vscode-taskexplorer",
"ms-python.python",
"ms-vscode.PowerShell",
"ms-vscode.powershell"
]
}
42 changes: 38 additions & 4 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,52 @@
"version": "0.2.0",
"configurations": [
{
"name": "Ren'Py Windows: Run",
"name": "Ren'Py: Setup",
"type": "PowerShell",
"request": "launch",
"script": "bin/renpy.ps1 -Command run",
"cwd": "${workspaceFolder}"
"script": "echo \"${input:RenPySdk}\" > .renpy-sdk",
},
{
"name": "Ren'Py MacOS/Linux: Run",
"name": "Ren'Py: Run",
"type": "PowerShell",
"request": "launch",
"script": "bin/renpy run",
"cwd": "${workspaceFolder}"
},
{
"name": "Ren'Py: Recompile & Run",
"type": "PowerShell",
"request": "launch",
"script": "bin/renpy compile; bin/renpy run",
"cwd": "${workspaceFolder}"
},
{
"name": "Ren'Py: Delete Persistent",
"type": "PowerShell",
"request": "launch",
"script": "bin/renpy rmpersistent",
"cwd": "${workspaceFolder}"
},
{
"name": "Ren'Py: Lint",
"type": "PowerShell",
"request": "launch",
"script": "bin/renpy lint",
"cwd": "${workspaceFolder}"
},
{
"name": "Ren'Py: Distribute",
"type": "PowerShell",
"request": "launch",
"script": "bin/renpy distribute",
"cwd": "${workspaceFolder}"
},
],
"inputs": [
{
"id": "RenPySdk",
"description": "Paste the path to your Ren'Py SDK folder",
"type": "promptString",
}
]
}
75 changes: 0 additions & 75 deletions .vscode/tasks.json

This file was deleted.

82 changes: 82 additions & 0 deletions game/tool/notify.rpy
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
init python:
class NotifyEx(renpy.python.RevertableObject):
"""Notifications, to use: default ... = NotifyEx(msg="...", img="...")"""
def __init__(self,
msg: str,
img: str
):
super(NotifyEx, self).__init__()
self.msg = msg
self.img = img
self.remain = gui.notifyEx_delay


def notifyEx(msg: str = None, img: str = None):
notifications.append(NotifyEx(msg, img))
if len(store.notifications) == 1:
renpy.show_screen("notifyEx")


def notifyExClean(value):
if value in store.notifications:
store.notifications.remove(value)
if len(store.notifications) == 0:
renpy.hide_screen("notifyEx")


def notify(notific):
"""View defined notifications.
to use: $ notify(...)"""
notifications.append(NotifyEx(notific.msg, notific.img))
if len(store.notifications) == 1:
renpy.show_screen("notifyEx")

# Delay of visibility of a notification.
define gui.notifyEx_delay = 10.0
# Width of the images.
define gui.notifyEx_width = 64
# Height of the images.
define gui.notifyEx_height = 64

define gui.notifyEx_color = "#000000"

default notifications = []

style notify_text is default:
color gui.notifyEx_color
yalign 0.5

style notify_hbox is default:
ysize gui.notifyEx_height

screen notifyEx():

zorder 100

style_prefix "notify"

vbox:
for d in notifications:
use notifyExInternal( d )
# aerate a little.
null height 5

screen notifyExInternal( n ):

style_prefix "notify"

frame at notify_appear:
hbox:
if not n.img is None:
add n.img
else:
# Ensure that all the texts will be aligned.
null width gui.notifyEx_width

# aerate a little.
null width 5

if not n.msg is None:
text n.msg

timer 0.05 repeat True action [ SetField( n, "remain", n.remain - 0.05 ), If( n.remain <= 0, Function( notifyExClean, n ), NullAction() ) ]

0 comments on commit 0067405

Please sign in to comment.