MTK add Project Resource Structure

Source: Internet
Author: User

The MTK program divides the data into dynamic and static data.
Dynamic data is generated dynamically by the program only when the program is running.
Static data refers to the fixed data, which can be converted to binary data during program compilation and stored in the burning file.

Static data is called a resource. Common resources include strings, images, menus, font libraries, themes, and sounds.

Three steps are required to add a resource:Raw material, ID, loading.
Raw MaterialsIt is actually a data source, piece, String, etc.
ID: The alias of the resource. The program can only obtain the resource by ID.
Load: Convert the raw material to binary data and associate it with the ID.

The Resource load pre-Compilation Program is plutommi/customer/resgenerator/mtk_resgenerator.exe. This program is compiled and generated temporarily before each compilation target is burned into a file.

Step 1: Add a resource entry:
Add res_1_thui.c to plutommi/customer/custresource/pluto_mmi/res_mmi.
This program provides a function for adding and adding resources.

Void populatebluw.thuires (void)
{
}
Note that this c file is provided to the pre-compiled program during pre-compilation. Used to specify how to add and add resources.

Step 2: Modify makefile
In plutommi/customer/resgenerator/makefile.
-I "plutommi/MMI/mainmenu/mainmenuinc "/
-I "plutommi/MMI/effecthui/effecthuiinc "/
Note: This makefileis The makefile of the resource pre-Compilation Program mtk_resgenerator.exe.

Step 3: Modify populateres. c
Add populateblustmthuires () to populateresdate. When the Pre-compiled program mtk_resgenerator.exe runs, resources will be added according to the content in the interface populatebluw.thuires () provided by us.

Step 4: Add Resource ID:
Because the ID of each type of resource is in the same value space. So it cannot be repeated.
InPlutommi/MMI/INC/mmidatatype. hMedium
It actually provides the base-id of each program.

Taking string resources as an example:
1. Add the string ID in incluthuidefs. h:
Str_incluthui_string = incluthui_base + 1,
Note: bluetoothui_base is added in plutommi/MMI/INC/mmidatatype. h.

2. Match the ID with the resource content:
Add the following to plutommi/customer/custresource/pluto_mmi/ref_list.txt:
Str_rjthui_string 3 dijoy Ding Yi Technology
The str_rjthui_string ID corresponds to 3 dijoy (English) and technology (Chinese)

3. String loading:
In plutommi/customer/custresource/pluto_mmi/res_mmi/res_1_thui.c
Of
Void populatebluw.thuires (void)
{
Add_application_string2 (str_javasthui_string, "3 dijoy ","");
}
The first parameter is ID.
The second parameter is: Upload Resource (use this parameter when ref_list.txt does not have the resource corresponding to this ID)
The third parameter is the string description, which can be ignored.

4. String reading:
Getstring () can read data from the ID.

Gui_print_text (ui_string_type)Getstring(Str_incluthui_string ));

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.