Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request to generate initial code on project creation #898

Open
nagesh007 opened this issue Dec 26, 2024 · 4 comments
Open

Request to generate initial code on project creation #898

nagesh007 opened this issue Dec 26, 2024 · 4 comments

Comments

@nagesh007
Copy link

Relevant sub-area for this feature?

PDE

Feature description

Whenever we click on "File > New", New sketch appears but it will be empty. We need to start writing setup and draw functions manually. I kindly request you to generate initial code on new sketch creation. (Maybe this feature can switched on/off in preferences)

Benefits

  • Developer can easily start writing his logic without writing basic functions every time

Possible challenges

No response

Additional context

No response

@SableRaf
Copy link
Collaborator

Thank you for the suggestion! One of the nice things about Processing is that even a single line of code is a valid program. There’s no need for setup or draw unless you want to change the sketch size or animate something. For this reason, we don’t plan to make this change.

@SableRaf SableRaf closed this as not planned Won't fix, can't repro, duplicate, stale Dec 26, 2024
@Stefterv
Copy link
Collaborator

Agreed but maybe we could allow users to define their starting sketch for themselves, like blender does with File->Defaults->Save Startup File

@hx2A
Copy link
Collaborator

hx2A commented Dec 27, 2024

I think there's a good idea here. What if the "Sketch" menu had an "insert template" submenu option, with a few choices like "basic animated sketch", that would insert something like this:

void setup() {
  size(500, 500);
  // write code that will be called once in this function
}

void draw() {
  // write code that will be called for every frame here
}

and maybe an "interactive sketch" option that had the above template plus more empty functions for the mouse and key events. And the comments in the template could match the user's language preferences.

This would be helpful for beginners because it would provide some guidance on code structure and also save them the time of looking up the names of the mouse and key event functions when they forget. And it would help me because I keep starting my Processing Sketches with "def setup()" by mistake...

@SableRaf SableRaf reopened this Dec 27, 2024
@SableRaf
Copy link
Collaborator

Good points both of you. I read a bit too quickly and didn't notice @nagesh007's suggestion to make it an optional setting. My apologies!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants