Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of el17dg by
main/main.h@31:becb8f6bf7b7, 2019-04-23 (annotated)
- Committer:
- Noximilien
- Date:
- Tue Apr 23 18:18:57 2019 +0000
- Revision:
- 31:becb8f6bf7b7
- Parent:
- 29:579e00b7f118
- Child:
- 33:c623c6d5ed16
Have changed comments structure as well as the content. Finished intro music. Have cleaned a code in some places to make it readable.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Noximilien | 3:10918b0f7a7d | 1 | #ifndef MAIN_H |
Noximilien | 3:10918b0f7a7d | 2 | #define MAIN_H |
Noximilien | 3:10918b0f7a7d | 3 | |
Noximilien | 4:02c63aaa2df9 | 4 | #include "mbed.h" |
Noximilien | 4:02c63aaa2df9 | 5 | #include "N5110.h" |
Noximilien | 4:02c63aaa2df9 | 6 | #include "Gamepad.h" |
Noximilien | 21:0eb394495b8a | 7 | #include "geometry.h" |
Noximilien | 21:0eb394495b8a | 8 | #include "models.h" |
Noximilien | 8:c18c240665aa | 9 | |
Noximilien | 31:becb8f6bf7b7 | 10 | /** |
Noximilien | 31:becb8f6bf7b7 | 11 | * Global variable readings from the gamepad are shared for all the files to use. |
Noximilien | 29:579e00b7f118 | 12 | */ |
Noximilien | 4:02c63aaa2df9 | 13 | extern N5110 lcd; |
Noximilien | 4:02c63aaa2df9 | 14 | extern Gamepad gamepad; |
Noximilien | 4:02c63aaa2df9 | 15 | extern AnalogIn pot; |
Noximilien | 4:02c63aaa2df9 | 16 | extern AnalogIn x_dir; |
Noximilien | 4:02c63aaa2df9 | 17 | extern AnalogIn y_dir; |
Noximilien | 4:02c63aaa2df9 | 18 | |
Noximilien | 16:b7d0cac561cc | 19 | static const int fps = 10; |
Noximilien | 14:e8de27c4d0d4 | 20 | |
Noximilien | 31:becb8f6bf7b7 | 21 | /** |
Noximilien | 31:becb8f6bf7b7 | 22 | * @brief A simplified function to draw sprites. |
Noximilien | 31:becb8f6bf7b7 | 23 | * @details This is a specific function I made to simplify drawing the sprites. |
Noximilien | 31:becb8f6bf7b7 | 24 | * It only works with spawn() function in gameobject.h. |
Noximilien | 31:becb8f6bf7b7 | 25 | * The parameters for this function are given in the models.cpp for the |
Noximilien | 31:becb8f6bf7b7 | 26 | * sprites. |
Noximilien | 31:becb8f6bf7b7 | 27 | */ |
Noximilien | 21:0eb394495b8a | 28 | static void drawSprite(Point pos, const Sprite& sprite) { |
Noximilien | 21:0eb394495b8a | 29 | lcd.drawSprite(pos.x, pos.y, sprite.height, sprite.width, (int*)sprite.data); |
Noximilien | 21:0eb394495b8a | 30 | } |
Noximilien | 9:5ad5501c702e | 31 | |
Noximilien | 31:becb8f6bf7b7 | 32 | /** |
Noximilien | 31:becb8f6bf7b7 | 33 | * @brief A simplified function to draw sprites. But this draw black pixels on top of white pixels. |
Noximilien | 31:becb8f6bf7b7 | 34 | * @details This is an exactly the same function as before, but for the drawing |
Noximilien | 31:becb8f6bf7b7 | 35 | * sprite function that draws the black pixels on top the white pixels when the |
Noximilien | 31:becb8f6bf7b7 | 36 | * sprites overlap. |
Noximilien | 31:becb8f6bf7b7 | 37 | */ |
Noximilien | 29:579e00b7f118 | 38 | static void drawSpriteOnTop(Point pos, const Sprite& sprite) { |
Noximilien | 29:579e00b7f118 | 39 | lcd.drawSpriteOnTop(pos.x, pos.y, sprite.height, sprite.width, (int*)sprite.data); |
Noximilien | 27:f05f4e738ba9 | 40 | } |
Noximilien | 27:f05f4e738ba9 | 41 | |
Noximilien | 29:579e00b7f118 | 42 | |
Noximilien | 4:02c63aaa2df9 | 43 | #endif |