From abe714509392e94bd0210de24c8ac47c196dd4f7 Mon Sep 17 00:00:00 2001 From: Exodia <67595890+DonRP@users.noreply.github.com> Date: Sun, 17 Jul 2022 15:43:52 +0200 Subject: [PATCH 1/7] Only PowerShell --- .vscode/extensions.json | 3 +- .vscode/launch.json | 42 ++++++++++++++++++++--- .vscode/settings.json | 5 ++- .vscode/tasks.json | 75 ----------------------------------------- 4 files changed, 43 insertions(+), 82 deletions(-) delete mode 100644 .vscode/tasks.json diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 69b61bb..32b9b84 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -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" ] } \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index 1db019c..0d6800d 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -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", + } ] } \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 19bdfe2..0ccee0d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,7 +4,10 @@ }, "editor.formatOnSave": true, "files.exclude": { - "**/*.rpyc": true + "**/*.rpyc": true, + "**/*.rpa": true, + "**/*.rpymc": true, + "**/cache/": true }, "editor.tokenColorCustomizations": { "textMateRules": [ diff --git a/.vscode/tasks.json b/.vscode/tasks.json deleted file mode 100644 index fd84a41..0000000 --- a/.vscode/tasks.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - // See https://go.microsoft.com/fwlink/?LinkId=733558 - // for the documentation about the tasks.json format - "version": "2.0.0", - "tasks": [ - { - "label": "Ren'Py Setup: Set .renpy-sdk path", - "type": "shell", - "command": "echo \"${input:RenPySdk}\" > .renpy-sdk", - }, - { - "label": "Ren'Py MacOS/Linux: Run", - "type": "shell", - "command": "bin/renpy run", - "group": "build" - }, - { - "label": "Ren'Py MacOS/Linux: Delete Persistent", - "type": "shell", - "command": "bin/renpy rmpersistent" - }, - { - "label": "Ren'Py MacOS/Linux: Force Recompile", - "type": "shell", - "command": "bin/renpy compile" - }, - { - "label": "Ren'Py MacOS/Linux: Lint", - "type": "shell", - "command": "bin/renpy lint" - }, - { - "label": "Ren'Py MacOS/Linux: Distribute", - "type": "shell", - "command": "bin/renpy distribute", - "group": "build", - "problemMatcher": [] - }, - { - "label": "Ren'Py Windows: Run", - "type": "shell", - "command": "bin/renpy.ps1 -Command run", - "group": "build" - }, - { - "label": "Ren'Py Windows: Delete Persistent", - "type": "shell", - "command": "bin/renpy.ps1 -Command rmpersistent" - }, - { - "label": "Ren'Py Windows: Force Recompile", - "type": "shell", - "command": "bin/renpy.ps1 -Command compile" - }, - { - "label": "Ren'Py Windows: Lint", - "type": "shell", - "command": "bin/renpy.ps1 -Command lint" - }, - { - "label": "Ren'Py Windows: Distribute", - "type": "shell", - "command": "bin/renpy.ps1 -Command distribute", - "group": "build", - "problemMatcher": [] - }, - ], - "inputs": [ - { - "id": "RenPySdk", - "description": "Paste the path to your Ren'Py SDK folder", - "type": "promptString" - } - ] -} \ No newline at end of file From a56456884de1a814864fea2460297b5c846a2e10 Mon Sep 17 00:00:00 2001 From: Exodia <67595890+DonRP@users.noreply.github.com> Date: Sun, 17 Jul 2022 15:47:36 +0200 Subject: [PATCH 2/7] read Me --- README.md | 60 ++++++++++++++++++++++++++----------------------------- 1 file changed, 28 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 58c16d8..08bf733 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,42 @@ -# Ren'Py VSCode Project Template +# Ren'Py VSCode Project Template & Debug -This template includes VSCode tasks and extensions for developing Ren'Py projects. +This template includes VSCode launchs and extensions for developing Ren'Py projects. + +## File - `bin/renpy`: macOS/linux script for calling Ren'Py SDK `renpy.sh` - `bin/renpy.ps1`: Windows script for calling Ren'Py SDK `renpy.exe` - `bin/set-origin.sh`: Git setup helper to configure your local folder to sync to a remote host -- `.vscode/tasks.json`: Tasks for launching Ren'Py SDK commands without opening the Ren'Py launcher. - - Set .renpy-sdk file (custom file for remembering your project's SDK path for commands to work) +- `.vscode/launch.json`: Launch for launching Ren'Py SDK commands without opening the Ren'Py launcher. + - Setup (custom file for remembering your project's SDK path for commands to work) - Run + - Force Recompile & Run + - Delete Persistent - Lint - - Force Recompile - - Delete Persistent data - Distribute - `.vscode/extensions.json`: Optional extensions that VSCode will offer to install for you +- `.vscode/settings.json`: For Test Formatting, and other settings - [Ren'Py Language](https://marketplace.visualstudio.com/items?itemName=LuqueDaniel.languague-renpy) for syntax highlighting - - [Task Explorer](https://marketplace.visualstudio.com/items?itemName=spmeesseman.vscode-taskexplorer) for an easy clickable list of tasks from `.vscode/tasks.json` + - [Power Shell](https://marketplace.visualstudio.com/items?itemName=ms-vscode.PowerShell) for an easy clickable list of launchs from `.vscode/launch.json` + - [Python](https://marketplace.visualstudio.com/items?itemName=spmeesseman.vscode-taskexplorer) for python syntax highlighting - `.gitignore`: Git configuration file for ignoring certain file paths and types. - - \*.rpyc/rpymc - - log.txt, error.txt, traceback.txt + +## How Run Debug (F5) + +### Setup + +( **Necessary only in the beginning** ) + +Paste the path to your Ren'Py SDK folder + +### Run + +Select: + +- Run or +- Force Recompile & Run + +And Play! ## Insert Template in your Project @@ -41,26 +60,3 @@ git pull https://github.com/DRincs-Productions/renpy-template-debug-vscode.git t ``` At the end make a merge inside the arm of the project. - -# Instructions for use - -By default, opening a VSCode project will notify you of "recommended" extensions. VSCode is notifying you that our `.vscode/extensions.json` is present, and allows you install them for you. We include a task explorer panel and a Ren'Py language highlighter. Neither is required, but both are useful. - -Locate the Task Explorer panel to run your project-specific tasks: - -task-explorer - -To see the tasks without the Task Explorer extension, open VSCode's [Command Palette](https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette) and search for `Tasks: Run Task`: - -tasks - -To use the provided tasks, please first run the task `Ren'Py Setup: Set .renpy-sdk path`. It will ask for the path to your Ren'Py SDK (where you unzipped it). The folder name is something like `renpy-7.4.4-sdk`, and should NOT include any trailing slashes at the end. - -- If I keep my SDK in `~/Applications/`, then the path would be `/Users/autumn/Applications/renpy-7.4.4-sdk` -- If I keep my SDK in `C:\Program Files\`, then the path would be `C:\Program Files\renpy-7.4.4-sdk` - -A file will be created in the root of your workspace called `.renpy-sdk` with the path you entered inside it. You can re-run the task to update it, or just modify the `.renpy-sdk` file directly. - -The Windows-specific tasks will call on a `bin/renpy.ps1` helper script, while the non-Windows version will call on `bin/renpy`: - -all-tasks From c69eba5a49d374ac5f4530baae4f01addcbc71c5 Mon Sep 17 00:00:00 2001 From: Exodia <67595890+DonRP@users.noreply.github.com> Date: Sun, 17 Jul 2022 15:48:48 +0200 Subject: [PATCH 3/7] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 08bf733..0470a8f 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,9 @@ This template includes VSCode launchs and extensions for developing Ren'Py proje ## How Run Debug (F5) +![image](https://user-images.githubusercontent.com/67595890/179401467-c8abbc9b-8970-4bad-af86-2b5b31c173a4.png) + + ### Setup ( **Necessary only in the beginning** ) From 961cff221fd5fa11dff0873fa4a85ebf331cee31 Mon Sep 17 00:00:00 2001 From: Exodia <67595890+DonRP@users.noreply.github.com> Date: Sun, 17 Jul 2022 15:54:10 +0200 Subject: [PATCH 4/7] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 0470a8f..67cf014 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,8 @@ This template includes VSCode launchs and extensions for developing Ren'Py proje - [Power Shell](https://marketplace.visualstudio.com/items?itemName=ms-vscode.PowerShell) for an easy clickable list of launchs from `.vscode/launch.json` - [Python](https://marketplace.visualstudio.com/items?itemName=spmeesseman.vscode-taskexplorer) for python syntax highlighting - `.gitignore`: Git configuration file for ignoring certain file paths and types. +- `/game/tool/utility.rpy`: Useful functions such as: isNullOrEmpty +- `/game/tool/flags.rpy`: Flags System ## How Run Debug (F5) From 42a55a582c1d5e46a08ac0325fa691490a2823a4 Mon Sep 17 00:00:00 2001 From: Exodia <67595890+DonRP@users.noreply.github.com> Date: Sun, 17 Jul 2022 16:00:06 +0200 Subject: [PATCH 5/7] Create notify.rpy --- game/tool/notify.rpy | 72 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 game/tool/notify.rpy diff --git a/game/tool/notify.rpy b/game/tool/notify.rpy new file mode 100644 index 0000000..6e3f235 --- /dev/null +++ b/game/tool/notify.rpy @@ -0,0 +1,72 @@ +init python: + ## Notifications + # to use: default ... = NotifyEx(msg="...", img="...") + class NotifyEx( renpy.python.RevertableObject ): + def __init__( self, msg, img ): + super(NotifyEx, self).__init__() + self.msg = msg + self.img = img + self.remain = gui.notifyEx_delay + ## view undefined notifications + # to use: $ notifyEx(msg="...") + # to use: $ notifyEx(msg="...", img="...") + # to use: $ notifyEx(img="...") + def notifyEx( msg=None, img=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" ) + ## view defined notifications + # to use: $ notify(...) + def notify( n ): + notifications.append( NotifyEx( n.msg, n.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 + +default notifications = [] + +style notify_text is default: + # color "#49aae6" + 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() ) ] From 88d4171909a21ad83c5fcfdebe9bae99f22103a5 Mon Sep 17 00:00:00 2001 From: Exodia <67595890+DonRP@users.noreply.github.com> Date: Sun, 17 Jul 2022 16:12:31 +0200 Subject: [PATCH 6/7] NotifyEx --- game/tool/notify.rpy | 50 ++++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/game/tool/notify.rpy b/game/tool/notify.rpy index 6e3f235..221e364 100644 --- a/game/tool/notify.rpy +++ b/game/tool/notify.rpy @@ -1,27 +1,35 @@ init python: - ## Notifications - # to use: default ... = NotifyEx(msg="...", img="...") - class NotifyEx( renpy.python.RevertableObject ): - def __init__( self, msg, img ): + 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 - ## view undefined notifications - # to use: $ notifyEx(msg="...") - # to use: $ notifyEx(msg="...", img="...") - # to use: $ notifyEx(img="...") - def notifyEx( msg=None, img=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" ) - ## view defined notifications - # to use: $ notify(...) - def notify( n ): - notifications.append( NotifyEx( n.msg, n.img ) ) - if len( store.notifications ) == 1: renpy.show_screen( "notifyEx" ) + + + 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 @@ -30,10 +38,12 @@ 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 "#49aae6" + color gui.notifyEx_color yalign 0.5 style notify_hbox is default: From 0c41b8fc89ecf31e1dbb342dec8fe24153bb1344 Mon Sep 17 00:00:00 2001 From: Exodia <67595890+DonRP@users.noreply.github.com> Date: Sun, 17 Jul 2022 16:14:00 +0200 Subject: [PATCH 7/7] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 67cf014..55b9a4c 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ This template includes VSCode launchs and extensions for developing Ren'Py proje - `.gitignore`: Git configuration file for ignoring certain file paths and types. - `/game/tool/utility.rpy`: Useful functions such as: isNullOrEmpty - `/game/tool/flags.rpy`: Flags System +- `/game/tool/notify.rpy`: Notify System ## How Run Debug (F5)