Dxutgui control customization (1)

Source: Internet
Author: User
Tags bmp image
<! -- All Rights Reserved foruok. For more information, see the source !! -->

Recently, I have been studying the built-in control library of dxut. I have done some experiments according to the SDK and examples. It is always a fixed one (you can refer to the examples in dxsdk, which is the effect ), you can see at a glance that the interface is implemented using dxutgui. I want to make my own results, it seems that it must be customized.
Customization includes two aspects: customization of the entire control library style and customization of specific control instances.
Let's talk about the overall UI style customization.
I started to learn dxut from SDK customui.
This example declares a global dialog box resource management object cdxutdialogresourcemanager g_dialogresourcemanager, and then uses it to initialize three dialogs respectively. Take the sampleui dialog box as an example. The initialization statement is in the initapp function: g_samleui.init (& g_dialogresourcemanager ). There is only one parameter for calling the init function, and the other is the default bregisterdialog = true.
Dxut implements buttons, lists, optional buttons, and edit boxes. At first I thought the control was directly drawn (this feeling is too stupid), and later I thought it should be a texture map. However, it seems that you must read the source code of dxutgui.
It is a good choice to study the Resource Management of dxutgui starting with the init function. I followed the steps and found that, according to the exampleProgram In this way, the "skin" texture is loaded from the memory during the initialization dialog box. The memory texture resources used by dxutgui are in the DDS format and stored in the g_dxutguitexturesrcdata array of dxutres. cpp. This is where its mysteries are.
Save the texture as a BMP image (256x256) to view the resources of the dxutgui control.
With this discovery, we can implement our own style. Only two steps are required:
(1) Create your own image based on the skin texture inherent in dxutgui
(2) In the initialization dialog box, select the init function of the three parameters to specify the path of the texture image.
Note that the image we make must be the same as the image type used by dxutgui, including the texture areas corresponding to various elements. Otherwise, the image may be messy. Of course, there is another way not to be consistent with the dxutgui image specifications: Modify the cdxutdialog: initdefaultelements function.
Studying the initdefaultelements function can help us to understand how dxutgui uses texture skins and implement our own skins.

<! -- All Rights Reserved foruok. For more information, see the source !! -->

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.