diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 758a314f0e3df9f56d15b150ed50b642f6e717c0..413112e667a6018674c27f10c8b7fe65f84d9c51 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -27,7 +27,7 @@ To effectively work on the project the following tools are required: ## Compiling While you can compile it like usual (`compile.bat`/`compile.sh`/`make`), there is also a `Gulp script` that creates -source files for easier debugging. Other than that there are no differences between compiling for development or +source maps for easier debugging. Other than that there are no differences between compiling for development or compiling for playing the game. # Code @@ -59,79 +59,78 @@ as you've made the intent clear in some form of JSDoc. * JavaScript variable and function names should be `camelCase`. ```js +// good +let fooBar; + // bad let foobar; let Foobar; let FooBar; +``` +* JavaScript classes and namespaces should be `PascalCase`. + +```js // good -let fooBar; +class Foo {} +App.Foo.bar(); + +// bad +class foo {} +class FOO {} +App.foo.bar(); ``` * Enum members should be `ALLCAPS`. ```ts -// bad -enum Foo { - bar = 'bar', - Baz = 'baz', -} - // good enum Foo { BAR = 'bar', BAZ = 'baz', } + +// bad +enum Foo { + bar = 'bar', + Baz = 'baz', +} ``` This also applies to JavaScript objects that are used as enums. ```js -// bad -/** @enum {string} */ -const foo = { - bar: 'bar', - Baz: 'baz', -} - // good /** @enum {string} */ -const foo = { +const Foo = { BAR: 'bar', BAZ: 'baz', } - -// better +// bad /** @enum {string} */ -const Foo = { +const foo = { BAR: 'bar', BAZ: 'baz', } -``` - -* JavaScript classes and namespaces should be `PascalCase`. - -```js -// bad -class foo {} -class FOO {} -App.foo.bar(); -// good -class Foo {} -App.Foo.bar(); +// worse +/** @enum {string} */ +const foo = { + bar: 'bar', + Baz: 'baz', +} ``` * CSS classes are `kebob-case`. ```css +/* good */ +.foo-bar {} + /* bad */ .fooBar {} .FOO-BAR {} - -/* good */ -.foo-bar {} ``` New code should generally get organized into the `App` namespace. See `js/002-config/fc-init-js.js` for a rough outline. @@ -161,12 +160,37 @@ On Windows run `compile_debug+sanityCheck.bat`. It searches for common spelling errors and syntax errors in the twine files. Don't worry about preexisting errors, it's not totally clean as is and there are a few false positives. +## Project Structure + +### Source files + +* `src/` is the main directory for source code. It also contains the embedded art files. Since it is inside an `eval()` statement debugging and minification is more complicated than for `js/`. +* `js/` is loaded before SugarCube and therefore outside SugarCube's eval which `src/` is contained in. This means accessing SugarCube features (like `SugarCube.Engine`) is more complicated however it other than `src/` it can be minified and is easier to debug. Currently contains mainly static data, however new code not relying on SC2 should be sorted in here too. +* `css/` contains all CSS files. The internal structure is explained [here](css/css.md). +* `themes/` contains [custom themes](themes/themes.md) which are built separately. + +### Dev Files + +* `devNotes/` contains various wiki files and other potentially interesting files. +* `devTools/` contains various scripts and executables needed for working with the project or compiling. TypeScript typing files are stored here as well. +* `submodules/` contains git submodules. Only the custom version of SugarCube2 right now. + +### Art files + +* `artTools/`contains files for creating and updating [vector art](artTools/README.md). +* `resources/` contains various [art related files](resources/ReadmeBeforeAddingArt.md). + +### External Programs +* `docker/` contains Docker files from which the docker containers for GitLabs CI are created. +* `FCHost/` contains the sources for [FCHost](FCHost/documentation_FCHost.md). +* `saveTools/` contains tools for [editing save files](saveTools/README.md). + # Further Reading ## Wiki Files -* Writing Guides - * [Twine (Twine is being phased out of the project however the concepts are still relevant)](devNotes/scene-guide.txt) +* Event Writing Guides + * [Twine](devNotes/scene-guide.txt) (Twine is being phased out of the project however the concepts are still relevant) * [JavaScript](devNotes/jsEventCreationGuide.md) * [Exception handling](devNotes/exceptions.md) * [Sanity check](devNotes/sanityCheck.md) diff --git a/css/css.md b/css/css.md index f259684518eda9eb52a1895036d44904fbfcc39c..9b5bcc8548b377b966d99f49924b6001339a75fe 100644 --- a/css/css.md +++ b/css/css.md @@ -19,4 +19,4 @@ Most of the structure should be self-explanatory, this is a list of the main rul ## Compiling During compiling all CSS files in this directory get combined and then added as a module, which means the styles are put -directly into <head> element of the final HTML file. +directly into the `<head>` element of the final HTML file. diff --git a/resources/Readme before adding art.md b/resources/ReadmeBeforeAddingArt.md similarity index 100% rename from resources/Readme before adding art.md rename to resources/ReadmeBeforeAddingArt.md