You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/part3/project-structure.md
+60-52Lines changed: 60 additions & 52 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,41 +4,45 @@ This page is going to give you an idea of how the Galactic Armada project is str
4
4
5
5
## Folder Layout
6
6
7
-
For organizational purposes, many parts of the logic are separated into reusable functions. This is to reduce file size, and make logic more clear.
8
-
9
-
Here’s a basic look at how the project is structured
10
-
11
-
> NOTE: Generated files should never be included in VCS repositories. It unneccessarily bloats the repo. The folders below that are not included in the project contain assets generated from running the Makefile.
12
-
13
-
- libs - Two assembly files for input and sprites are located here.
14
-
- src
15
-
- generated - the results of RGBGFX are stored here. **This is not included in the repo**
16
-
- resources - Here exist some PNGs and Aseprite files for usage with RGBGFX
17
-
- main - All assembly files are located here, or in subfolders
18
-
- states
19
-
- gameplay - for gameplay related files
20
-
- objects - for gameplay objects like the player, bullets, and enemies
21
-
- collision - for collision among objects
22
-
- story - for our story state's related files
23
-
- title-screen - for our title screen's related files
24
-
- utils - Extra functions includes to assist with development
25
-
- macros
26
-
- dist - The final ROM file will be created here. **This is not included in the repo**
27
-
- obj - Intermediate files from the compile process. **This is not included in the repo**
28
-
- Makefile - used to create the final ROM file and intermediate files
7
+
For organizational purposes, many parts of the logic are separated into reusable functions. This is to reduce duplicate code, and make logic more clear.
8
+
9
+
Here’s a basic look at how the project is structured:
10
+
11
+
::: tip
12
+
13
+
Generated files should never be included in VCS repositories. It unneccessarily bloats the repo. The folders below marked with \* contains assets generated from running the Makefile and are not included in the repository.
14
+
15
+
:::
16
+
17
+
-`libs` - Two assembly files for input and sprites are located here.
18
+
-`src`
19
+
-`generated` - the results of RGBGFX are stored here. \*
20
+
-`resources` - Here exist some PNGs and Aseprite files for usage with RGBGFX
21
+
-`main` - All assembly files are located here, or in subfolders
22
+
-`states`
23
+
-`gameplay` - for gameplay related files
24
+
-`objects` - for gameplay objects like the player, bullets, and enemies
25
+
- collision - for collision among objects
26
+
-`story` - for our story state's related files
27
+
-`title-screen` - for our title screen's related files
28
+
-`utils` - Extra functions includes to assist with development
29
+
-`macros`
30
+
-`dist` - The final ROM file will be created here. \*
31
+
-`obj` - Intermediate files from the compile process. \*
32
+
-`Makefile` - used to create the final ROM file and intermediate files
29
33
30
34
## Background & Sprite Resources
31
35
32
36
The following backgrounds and sprites are used in Galactic Armada:
@@ -52,17 +56,15 @@ The following backgrounds and sprites are used in Galactic Armada:
52
56
53
57

54
58
55
-
These images were originally created in Aseprite. The original templates are also included in the repository. They were exported as a PNG **with a specific color palette**. Ater being exported as a PNG, when you run `make`, they are converted into .2bpp and .tilemap files via the RGBDS tool: RGBGFX.
59
+
These images were originally created in Aseprite. The original templates are also included in the repository. They were exported as a PNG **with a specific color palette**. Ater being exported as a PNG, when you run `make`, they are converted into .2bpp and .tilemap files via the RGBDS tool: RGBGFX.
56
60
57
61
> The **`rgbgfx`** program converts PNG images into data suitable for display on the Game Boy and Game Boy Color, or vice-versa.
58
-
>
59
-
>
62
+
>
60
63
> The main function of **`rgbgfx`** is to divide the input PNG into 8×8 pixel *[squares](https://rgbds.gbdev.io/docs/v0.6.1/rgbgfx.1#squares)*, convert each of those squares into 1bpp or 2bpp tile data, and save all of the tile data in a file. It also has options to generate a tile map, attribute map, and/or palette set as well; more on that and how the conversion process can be tweaked below.
61
-
>
62
64
63
65
RGBGFX can be found here: [https://rgbds.gbdev.io/docs/v0.6.1/rgbgfx.1](https://rgbds.gbdev.io/docs/v0.6.1/rgbgfx.1)
64
66
65
-
We'll use it to convert all of our graphics to .2bpp, and .tilemap formats (binary files)
67
+
We'll use it to convert all of our graphics to .2bpp, and .tilemap formats (binary files)
You can find more about the INCBIN command here: [https://rgbds.gbdev.io/docs/v0.6.1/rgbasm.5#Including_binary_files](https://rgbds.gbdev.io/docs/v0.6.1/rgbasm.5#Including_binary_files)
> You probably have some graphics, level data, etc. you'd like to include. Use **`INCBIN`** to include a raw binary file as it is. If the file isn't found in the current directory, the include-path list passed to [rgbasm(1)](https://rgbds.gbdev.io/docs/v0.6.1/rgbasm.1) (see the **`-i`** option) on the command line will be searched.
82
-
>
83
-
> **`INCBIN "titlepic.bin"
84
-
> INCBIN "sprites/hero.bin"`**
85
-
>
86
-
> You can also include only part of a file with **`INCBIN`**. The example below includes 256 bytes from data.bin, starting from byte 78.
87
-
>
88
-
> **`INCBIN "data.bin",78,256`**
89
-
>
90
-
> The length argument is optional. If only the start position is specified, the bytes from the start position until the end of the file will be included.
79
+
::: tip Including binary files
80
+
81
+
You probably have some graphics, level data, etc. you'd like to include. Use **`INCBIN`** to include a raw binary file as it is. If the file isn't found in the current directory, the include-path list passed to [rgbasm(1)](https://rgbds.gbdev.io/docs/v0.6.1/rgbasm.1) (see the **`-i`** option) on the command line will be searched.
82
+
83
+
```
84
+
INCBIN "titlepic.bin"
85
+
INCBIN "sprites/hero.bin"
86
+
```
87
+
88
+
You can also include only part of a file with **`INCBIN`**. The example below includes 256 bytes from data.bin, starting from byte 78.
89
+
90
+
```
91
+
INCBIN "data.bin",78,256
92
+
```
93
+
94
+
The length argument is optional. If only the start position is specified, the bytes from the start position until the end of the file will be included.
95
+
96
+
See also: [Including binary files - RGBASM documentation](https://rgbds.gbdev.io/docs/v0.6.1/rgbasm.5#Including_binary_files)
97
+
98
+
:::
91
99
92
100
## Compilation
93
101
94
-
Compilation is done via a Makefile. This makefile can be run using the `make` command. Make should be preinstalled on Linux and Mac systems. For Windows users, check out [cygwin](https://www.cygwin.com/).
102
+
Compilation is done via a Makefile. This Makefile can be run using the `make` command. Make should be preinstalled on Linux and Mac systems. For Windows users, check out [cygwin](https://www.cygwin.com/).
95
103
96
-
Without going over everything in detail, here’s what the makefile does:
104
+
Without going over everything in detail, here’s what the Makefile does:
97
105
98
106
- Clean generated folders
99
107
- Recreate generated folders
100
-
- Convert PNGs in src/resources to .2bpp, and .tilemap formats
101
-
- Convert .asm files to .o
102
-
- Use the .o files to build the ROM file
108
+
- Convert PNGs in src/resources to `.2bpp`, and `.tilemap` formats
0 commit comments