Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Anyone else a little bit OCD with tidying up the extra spaces in the AGK function parameters after creating a new project? And adding then when missing?

Author
Message
Kevin Cross
21
Years of Service
User Offline
Joined: 15th Nov 2003
Location: London, UK
Posted: 2nd Apr 2017 09:16 Edited at: 2nd Apr 2017 09:22
Just curious to see if anyone else removes the extra spaces in a new project template and adds them when missing? For example changing SetWindowAllowResize( 1 ) to SetWindowAllowResize(1) and changing SetScissor( 0,0,0,0 ) to SetScissor(0, 0, 0, 0). For SetScissor I remove the spaces near both parentheses and then add spaces after the commas.

I do this everytime, and I like to lowercase the print function so changing Print( ScreenFPS() ) to print(ScreenFPS()). I admit that one's probably a bit weird.

If more of us make these changes each time (or similar changes) then maybe TGC could amend their starting template and be a bit more consistent. They're not consistent with the SetScissor line (as shown above) or with SetErrorMode(2) where they haven't included any extra spaces.

By the way this isn't really a moan I'm merely curious.
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 2nd Apr 2017 09:58 Edited at: 2nd Apr 2017 10:01
Hey,
personaly I don't like spaces in my code at all, so sometimes I change them in the template.
Yes there are templates already and I did change them long time ago, but they're getting overwritten by the AppGameKit updates and I forgot to save them somewhere
Here you can find the templates here: AGK2\Tier 1\Editor\data\templates\files
You can also add files from templates: In AppGameKit IDE->File->New File(From Tamplate)->YourTemplate.agc

Using AGKv2 Tier1
29 games
19
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: not entirely sure
Posted: 2nd Apr 2017 10:13
Yes, I do the same with the default template.

My use a capitals seems to be a bit odd as well. Command like type-endtype, select-endselect, for-to-next will be all in lower case. Things like SetObjectColor, CreateText, SetSpritePosition will have the first letter of each word in uppercase. I think this comes from using the intelisense where AppGameKit will put all the uppercase letters but when I writing, for example, for-to-next I tend just to type it all in by hand.

I tend to use spaces to in the function parameters to split groups of values up. For example:

ObjectSphereCast(obj, old_x#,old_y#,old_z#, new_x#,new_y#,new_z#, radius#) <> 0

However, I try not to get too hung on any of this as it can waste a serious amount of time.
Hover Car Race Challenge! - available now on Google Play
Invaders of the 29th Dimension - available now on Google Play
Find me on indieDB
Kevin Cross
21
Years of Service
User Offline
Joined: 15th Nov 2003
Location: London, UK
Posted: 2nd Apr 2017 10:27
@janbo, thanks for pointing that out. I had to do a bit of searching on the Mac to find the default template that gets loaded with each new project.

For anyone interested it can be found inside the AppGameKit app (right click on the app and pick Show Package Contents)

Contents -> Resources -> share -> geany -> templates -> files -> main.agc

Any changes you make or lines you add/remove to this file will show in all new projects you create.
Kevin Cross
21
Years of Service
User Offline
Joined: 15th Nov 2003
Location: London, UK
Posted: 2nd Apr 2017 10:40 Edited at: 2nd Apr 2017 10:40
@29 Games, I also write for next loops, and if lines etc. in lower case etc. And I write the standard AppGameKit functions like SetSpritePosition with a capital S at the beginning (except for print which is odd). Before AppGameKit I was use to writing all functions with camel casing so I would have written it as setSpritePosition before AppGameKit but it didn't take long to get use it and now I write my own functions with the first letter uppercase.

And you're right, it's not something to get hung up on. It's just a habit. Thankfully the starting template only has a few lines so it was no major task each time. I've amended the main template now and also removed the comments like "// 30fps instead of 60 to save battery" which is something else I don't like. I understand why they are there though
GameDevGuy
9
Years of Service
User Offline
Joined: 18th Jul 2015
Location:
Posted: 2nd Apr 2017 13:56
Those spaces next to the parentheses always annoy me, and to my eyes makes the code look weird, so I remove them. And I would certainly never enter such spaces when writing code from scratch. ( Why type an extra space which looks out of place? )

Although, a space after a comma is welcome, except when trying to give my left thumb a bit of a rest.
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 2nd Apr 2017 14:07 Edited at: 3rd Apr 2017 08:32
You're not alone!
I don't like bad formatting either but I don't use the templates. I delete everything that a New Project creates and start from scratch.
My code formatting OCD makes itself much more obvious on the very rare occasions that I take someone else's code.
I recently stumbled across the Bezier Curve library the Clonex posted. It's a lovely bit of code so I decided to keep it (thanks Clonex!) but I then had to spend around an hour changing the formatting of pretty much everything so that it didn't irritate me every time I looked at it.

[Edit]
I'd just like to make it clear that I'm not saying there is anything wrong with the code posted by Clonex. It's just that it is about as far removed from my coding style as it is possible to get.
There is no right or wrong way to format your code (unless you work in a team under strict guidelines) and everyone has their own style. I just like to make sure that everything I use is written in my style even if it wasn't me that wrote it.
AGK V2 user - Tier 1 (mostly)
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 3rd Apr 2017 09:21
I do the same, but I always add spaces between parenthesis and values. I like neat code, and personally think
looks neater than
Signature removed by mod because it's larger than 600x120... please resize and try again.
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 3rd Apr 2017 22:07
Yes, I take out all the spaces.

I know people like them, but I just really don't - they annoy me more than they should!

I am a stickler for indentation though.

I'm not worried about the templates, as I start new projects from existing defaults (I use a lot of separate code files - maybe 20 or more) with portable functions in them.
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 3rd Apr 2017 22:10
At work, our dev team operates on development standards.

This is more to do with global and local naming conventions, but tabs vs spaces is also a thing.

It's much more of an issue with team based development, as it can be important enough to some developers that they sometimes literally can't work in a place that uses tabs over spaces or puts underscores in front of global variables etc.

=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 3rd Apr 2017 23:02
I guess the short answer to this question is yes.

I could spend hours writing out all the little formatting rules I try and use (purely to make my code more readable, to me at least); but I won't unless someone really wants me to?
Dybing
13
Years of Service
User Offline
Joined: 12th Sep 2011
Location: Bergen, Norway
Posted: 4th Apr 2017 01:43
My bigger gripe - since I essentially do not use any templates or use others AppGameKit code - is the auto-completion of built in commands always starting it with a capital letter. Drives me up the wall. Though I've learned to live with it. Still annoys me, but I've caved and stopped fighting it.

Good thing the are no curly-braces in AppGameKit - if there were, and I saw code sprinkled with the opening curly on its' own line, I'd be compelled to point out the perps error of his way at every opportunity. As for tabs vs spaces, I'd have it written into law that each indented line using spaces would be punished by one Euro going directly to a fund to provide hospital childrens wards with toys, entertainment and other quality of life items and activities. Like a swear-jar only for blind coders who have yet to discover the tab key!

Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 4th Apr 2017 09:16
Quote: " I'd have it written into law that each indented line using spaces would be punished"

I'd have you killed. lol
Signature removed by mod because it's larger than 600x120... please resize and try again.
Kevin Cross
21
Years of Service
User Offline
Joined: 15th Nov 2003
Location: London, UK
Posted: 4th Apr 2017 09:54
Thanks guys. It's really good to know that I'm not alone! Wasn't expecting many more replies.

I'm also pretty bad when it comes to using someone else's shared code. I can't just copy and paste and leave it as is (even if it works fine). I have to pretty much re-write it in my preferred formatting/style and remove all of the comments etc. I don't do this because I want to take credit for it, I do it because it can often look out of place and odd within my code if I don't.

I'd hate to think how much time I waste being so fussy over the weeks, months and years. I can understand being fussy in a team when a number of people are working on the same project but I work alone and I'm the only one that will ever see it >.<
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 4th Apr 2017 13:12 Edited at: 4th Apr 2017 13:13
Quote: " I have to pretty much re-write it in my preferred formatting/style and remove all of the comments etc. I don't do this because I want to take credit for it, I do it because it can often look out of place and odd within my code if I don't."

I do the same thing.

It's almost as if i'm using it as an excuse to avoid doing any actual work....
Signature removed by mod because it's larger than 600x120... please resize and try again.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 4th Apr 2017 14:28
Quote: "is the auto-completion of built in commands always starting it with a capital letter."

I'm with you on that one! My main coding style has stemmed from Java, so I use camel case starting with a lowercase letter. I only capitalize class names (or UDTs in this case).

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds

Login to post a reply

Server time is: 2024-11-24 16:43:23
Your offset time is: 2024-11-24 16:43:23