3306 views|4 replies

381

Posts

9

Resources
The OP
 

TouchGFX Design + Make a Rubik's Cube (1) [Copy link]

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);
blockrgb[5]=Bitmap(BITMAP_YELLOW_ID);
for(int i=0;i <9;i++)
{
rgbrange[i+1]=0;
rgbrange[i+10]=1;
rgbrange[i+19]=2;
[ align=left] rgbrange[i+28]=3;
rgbrange[i+37]=4;
rgbrange[i+46]=5;[ cube_1.setBitmap(blockrgb[rgbrange[1]]);
……
Run the simulator again and you can find the expanded diagram of the Rubik's Cube Changes have already taken place.
Add button events
This happened 9times. Add in "TouchGFX\gui\include\gui\screen1_screen\Screen1View.hpp" ]
virtual void btn1Clicked();
……
=left]Complete the above actions in "TouchGFX\gui\src\screen1_screen\Screen1View.cpp" Of course, due to time constraints, this was not completed. But it can run now Go to sleep first and continue tomorrow This content is provided by EEWORLD forum user tobot[/ size]Original, if you want to reprint or use it for commercial purposes, you must obtain the author's consent and indicate the sourcehpp”, add virtual void btn1Clicked();……… In “TouchGFX\gui\src\screen1_screen\Screen1View.cpp”, complete the above actions. Of course, due to time constraints, this is not completed. But it can be run now. Go to bed first and continue tomorrow. This content is originally created by EEWORLD forum user tobot. If you need to reprint or use it for commercial purposes, you must obtain the author's consent and indicate the source.hpp”, add virtual void btn1Clicked();……… In “TouchGFX\gui\src\screen1_screen\Screen1View.cpp”, complete the above actions. Of course, due to time constraints, this is not completed. But it can be run now. Go to bed first and continue tomorrow. This content is originally created by EEWORLD forum user tobot. If you need to reprint or use it for commercial purposes, you must obtain the author's consent and indicate the source.


blue.png (448 Bytes, downloads: 0)

blue.png

green.png (436 Bytes, downloads: 0)

green.png

orange.png (438 Bytes, downloads: 0)

orange.png

purple.png (458 Bytes, downloads: 0)

purple.png

red.png (419 Bytes, downloads: 0)

red.png

yellow.png (447 Bytes, downloads: 0)

yellow.png

创建项目.png (60.06 KB, downloads: 0)

创建项目.png
This post is from stm32/stm8

Latest reply

  Details Published on 2019-4-11 08:57
 

381

Posts

9

Resources
2
 
I started at 22:00 and submitted at 24:00, but I’m still not satisfied with my efficiency. . .
This post is from stm32/stm8

Comments

Remember to submit a video of your final work.  Details Published on 2019-4-10 09:11
 
 

1w

Posts

204

Resources
3
 
Very efficient. The activity has been postponed. Maybe the time hasn't been refreshed when you saw it.
This post is from stm32/stm8
Add and join groups EEWorld service account EEWorld subscription account Automotive development circle
 
 

1w

Posts

204

Resources
4
 
tobot posted on 2019-4-10 00:08 Started at 22:00 and submitted at 24:00. I am still not satisfied with my efficiency. . .
Remember to record a video of the final work and submit it.
This post is from stm32/stm8
Add and join groups EEWorld service account EEWorld subscription account Automotive development circle
 
 
 

173

Posts

0

Resources
5
 
This post is from stm32/stm8
 
Personal signature服务器大全
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list