Yesterday I found that there was only one day left, so I was ready to rush to make something. I planned to spend two hours on a small project and one hour on writing documents. What I can write is up to fate. But I didn't expect it to be delayed, so I can take my time and finish the first part first.
I believe that every friend who participated in the installation of TouchGFX will write about it, so I won't say much here.
Now let's start the project:
I hope to make a Rubik's Cube and realize the rotation effect of the Rubik's Cube through buttons, but considering that 3Ddrawing cannot be done in two hours, I will directly make a Rubik's Cube expansion diagram. Use PS to make each block of the Rubik's Cube (6 types). There are three directions for the Rubik's Cube to rotate, and each direction includes 3 columns (only considering the simplest 3-order Rubik's Cube, and multi-order ones are similar), so we need to make 3 kinds (9) of buttons. In order to indicate the difference in the number of layers, they are parallel to the Roman]The LCDrotating buttons I made into 3different colors.
Okay, this is the most basic resource. After the extension, I will change the Rubik's Cube into 3D. . .
The materials are ready, and the next step is the tools.
Using VS is really a bit of a waste of resources, just use UE. Create a new project "RubiksCube"408892. The Rubik's Cube has 54 small cubes, so use 54 Images, named cube_1~cube_54. When drawing the interface, you can load the same picture first, and use the mouse + input coordinates. It will take about 10 minutes to drag it.
If you can use arrays, it will be much simpler, but unfortunately I don't know how to do it. . .
Add a control button, button, and use the same image for both the pressed and released images.
As required, add a logo image.
At this point, you can run the simulator by clicking "Run Simulator" in the upper right corner.
Next, it is time to write the code. First open "TouchGFX\gui\src\screen1_screen\Screen1View.cpp", add resources:
#include "BitmapDatabase.hpp"
Bitmap blockrgb[6];
int rgbrange[55];
In Screen1View::In Screen1View(), add
blockrgb[0]=Bitmap(BITMAP_ORANGE_ID);
blockrgb[1 ]=Bitmap(BITMAP_GREEN_ID);
blockrgb[2]=Bitmap(BITMAP_RED_ID);
blockrgb[3]=Bitmap(BITMAP_BLUE_ID);
[ align=left] blockrgb[4]=Bitmap(BITMAP_PURPLE_ID);
Run the simulator again and you can find the expanded diagram of the Rubik's Cube Changes have already taken place.