Conversation
5f7520b to
4e8c8bf
Compare
Chinese_Chess/Chinese_chess.c
Outdated
| {black_che_1,black_ma_1,black_xiang_1,black_shi_1,black_jiang,black_shi_2,black_xiang_2,black_ma_2,black_che_2} | ||
| }; | ||
|
|
||
| const lv_style_prop_t transition_props[] = { |
There was a problem hiding this comment.
it seems like not to be used. better to remove it.
There was a problem hiding this comment.
it seems like not to be used. better to remove it.
Hello, thank you for your suggestion. I have removed the unused variables in the revised program. Could you please take a look and let me know if there are any remaining issues or suggestions for improvement?
f1830ae to
1eb718c
Compare
4bfbe19 to
b696468
Compare
| @@ -0,0 +1,29 @@ | |||
| # | |||
| # Copyright (C) 2022 Xiaomi Corporation | |||
There was a problem hiding this comment.
please add CMakeLists.txt as well
There was a problem hiding this comment.
CMakeLists.txt
Thank you for your suggestion. I have now added the CMakeLists.txt file.
Chinese_Chess/Chinese_chess.c
Outdated
| lv_obj_set_pos(Black_bing_5,Board_Xvalue[piece[black_bing_5].Xvalue]-35,Board_Yvalue[piece[black_bing_5].Yvalue]-35); | ||
| } | ||
|
|
||
| static void app_create_main_page(void) |
There was a problem hiding this comment.
The app_create_main_page and position_init functions have highly repetitive code—shall we merge them into one?
There was a problem hiding this comment.
The app_create_main_page and position_init functions have highly repetitive code—shall we merge them into one?
Thank you for your suggestion. In the newly submitted code, I have merged them together.
Chinese_Chess/Chinese_chess.c
Outdated
| lv_obj_set_pos(Black_bing_2,Board_Xvalue[piece[black_bing_2].Xvalue]-35,Board_Yvalue[piece[black_bing_2].Yvalue]-35); | ||
| lv_obj_set_pos(Black_bing_3,Board_Xvalue[piece[black_bing_3].Xvalue]-35,Board_Yvalue[piece[black_bing_3].Yvalue]-35); | ||
| lv_obj_set_pos(Black_bing_4,Board_Xvalue[piece[black_bing_4].Xvalue]-35,Board_Yvalue[piece[black_bing_4].Yvalue]-35); | ||
| lv_obj_set_pos(Black_bing_5,Board_Xvalue[piece[black_bing_5].Xvalue]-35,Board_Yvalue[piece[black_bing_5].Yvalue]-35); |
There was a problem hiding this comment.
Please format the code
There was a problem hiding this comment.
Please format the code
Thank you for your suggestion. I have now adjusted the code accordingly. If there are any further issues, please let me know.
778d804 to
e0ddd1a
Compare
e0ddd1a to
613808f
Compare
7b7fd63 to
42fd047
Compare
a5765bb to
4d56ef3
Compare
Chinese_Chess/Chinese_chess.c
Outdated
| static void app_create_main_page(void) | ||
| { | ||
|
|
||
| position_init(); |
There was a problem hiding this comment.
code format use webkit style
There was a problem hiding this comment.
eg. clang-format-14 --style=WebKit -i Chinese_Chess/Chinese_chess.c
There was a problem hiding this comment.
eg. clang-format-14 --style=WebKit -i Chinese_Chess/Chinese_chess.c
Thank you for your suggestion. I have already used this command to change the code style to WebKit style.
Chinese_Chess/Chinese_chess.c
Outdated
| lv_obj_set_pos(Red_elephant_2,Board_Xvalue[piece[red_xiang_2].Xvalue]-35,Board_Yvalue[piece[red_xiang_2].Yvalue]-35); | ||
| //Add red shi | ||
| Red_shi_1 = lv_image_create(root); | ||
| lv_image_set_src(Red_shi_1,images.redshi); |
There was a problem hiding this comment.
ditto
Hello, I have now also modified the code style for this part. Please let me know if there are any other issues.
Chinese_chess_game Chinese_chess_game
2d7a58c to
ee34a5d
Compare
This is a Chinese Chess (Xiangqi) game example built with LVGL, demonstrating piece selection, movement, and win/loss detection.
Features:
Piece selection and movement: Tap a piece to select it, then tap a target position on the board to move it.
Capture rules: Opponent pieces can be captured, including the General; capturing the opponent’s General ends the game.
Intuitive interaction: Simple touch-based controls suitable for embedded device demonstrations.
Demo GIF:

showcasing the complete flow of piece selection, movement, and game-ending conditions.