A 2048 game written with lvgl(lv_lib_100ask_2048)

lv_lib_100ask_2048
ezgif-1-49ad072ecf

Introduction

lv_100ask_2048 features:

  • Custom size
  • Support touch gesture control
  • Support key control(LV_KEY_UP、LV_KEY_DOWN、LV_KEY_LEFT、LV_KEY_RIGH)
  • Get game scores
  • Get game status
  • Get the best tile of the current merge
  • Start new game
  • more todo…

lv_100ask_2048 is very simple to use, and the subsequent custom expansion functions are also very convenient, so stay tuned for more functions.

Get it

3 Likes

Woooow, great!

I’ve just found this in your repo: https://github.com/100askTeam/lv_lib_100ask/blob/master/src/lv_100ask_chinese_ime/README_zh.md

Perfect timing, someone just asked me about it and I had no idea how to handle Chinese input :slightly_smiling_face:

2 Likes

I’m very glad to help you! It is planned that lv_lib_100ask_chinese_ime will be comprehensively updated and released in lv_lib_100ask warehouse recently

Great! No push, but have you also considered contributing these into LVGL?

Of course, I will reply to you here when I finish it. It is expected to be completed within one month.

1 Like

@kisvegabor

Upgrade Complete

Hi, I have basically completed the upgrade and demonstrated the effect:

video: https://www.bilibili.com/video/BV1DY41147xX

2022年5月27日-lv_100ask_pinyin_ime-v2.0-demo(百问网lvgl拼音输入法demo)

Sample code

void lv_100ask_pinyin_ime_simple_test(void)
{
    lv_obj_t * pinyin_ime = lv_100ask_pinyin_ime_create(lv_scr_act());
    lv_obj_set_style_text_font(pinyin_ime, &lv_font_source_han_sans_bold_16, 0);   // set font
    //lv_pinyin_ime_set_dict(your_dict); // Use a custom thesaurus. If it is not set, the built-in thesaurus will be used

    lv_obj_t * kb = lv_100ask_pinyin_ime_get_kb(pinyin_ime);

    /* ta1 */
    lv_obj_t * ta1 = lv_textarea_create(lv_scr_act());
    lv_obj_set_style_text_font(ta1, &lv_font_source_han_sans_bold_16, 0);   // set font
    lv_obj_align(ta1, LV_ALIGN_TOP_LEFT, 10, 10);

    lv_keyboard_set_textarea(kb, ta1);

    lv_obj_add_event_cb(ta1, ta_event_cb, LV_EVENT_ALL, kb);

    /* ta2 */
    lv_obj_t * ta2 = lv_textarea_create(lv_scr_act());
    lv_obj_set_style_text_font(ta2, &lv_font_source_han_sans_bold_16, 0);   // set font
    lv_obj_align_to(ta2, ta1,LV_ALIGN_OUT_RIGHT_MID, 10, 0);

    lv_obj_add_event_cb(ta2, ta_event_cb, LV_EVENT_ALL, kb);
}

Executable file

lv_100ask_pinyin_ime_beta-v2.0.zip (2.6 MB)

I am upgrading from the previous version(not yet push). What is the next step?

Looks fantastic!

Just one question: in China are people usually familiar with pinyin? Can it be considered a standard, well-known input method?

Regarding the next step we have two options:

  1. (the simpler) We can add a link in LVGL’s docs to your repo to let them know about the pinyin_ime option is available.
  2. We merge your widget into LVGL. If we take this way, I’ll have some questions about the need of cJSON, or if it really needs to be a new widget (or just an extension like lv_keyboard_add_pinyin_ime(kb, pinyin) which adds the top bar and a custom event handler).

I’d be happy with any of these. :slight_smile:

  1. In China, Pinyin is an important tool for reading Chinese characters, learning Putonghua, and cultivating and improving reading and writing skills. Therefore, Pinyin input method (26 key Pinyin input method) is the most commonly used input method. In addition, there are five stroke input method and Jiugongge input method (9 key Pinyin input method) ,etc.
    Among them, the small screen device is more friendly to use the Jiugongge input method, which I will add later.
  2. Current Pinyin_IME no longer uses cJSON, and can be used as an upgraded version of lv_keyboard or extended to lv_keyboard_add_pinyin_ime. I upload the latest version code to https://github.com/100askTeam/lv_lib_100ask/tree/master/src/lv_100ask_pinyin_ime. Can you read it?

Great! I think a plugin like implementation (e.g. lv_keyboard_add_pinyin_ime) would be better on the long run.

Would you prefer merging it to LVGL or would you like to keep in in your repo?
If it goes to LVGL we should remove the “100ask” prefix to keep the names simple but of course we can add attribution back to your work in comments and the docs.

I also think that it will be better as a plug-in, and a lot of functions will be added later, such as fuzzy input, associative input, and nine-square grid mode.
On the other hand, each country has its own language input method, and it would be too bloated if they were all incorporated into lv_keyboard. Therefore, it is better to use this Pinyin input method as a reference for the implementation of other input methods.

Finally, I hope to enter your repository below as an extension of lv_keyboard, and I will continue to maintain and upgrade.

And the lv_100ask_pinyin_ime in my previous repo will be deprecated and point to your new repo for pinyin_ime.

Sounds great!

Please send a pull request. I suggest creating an ime folder here where we can add files like lv_pinyin.c/h.

Of course, I will write the documents here too, and I will finish them within today.

Pretty incredible… @kisvegabor look at this profile, fairly certain this is not a human being

Thank you for pointing it out!
I’ve just deleted the user.