In the previous entry we got the basic environment of the homebrew, now we want to make it modular. This will make the project easier to mantain and upgrade.
For this goal, we have to make separate files for the headers and the main module (main.h and main.c). From now on, we are also going to do something similar for each "Bmax's function" (sub module).
At the end of this point we will have 4 files created/updated, but in the future will be adding more files.
In the main.c file we only leave the main function with: init, program_loop (currently redrectangle), and quit.
main.c step |
In the main.h we will have definitions of data types, function prototypes and C preprocessor commands.
(How to write your own header file in C). (we surely need more files like this)
main.h step |
In the common.c we will write the generic functions we are going to call (we surely need more files like this).
common.c step |
In the makefile we are adding the new c files that we want to add to the compile process, in the "add executable" section
makefile step |
Note: debugScreen is added for future debuggin purposes. also a function for that goal has been created.
No comments:
Post a Comment