Using ogre mygui to implement a complete set of game interfaces and implementation methods

Source: Internet
Author: User
Using ogre mygui to implement a complete set of game interfaces and implementation methods
Author Ming · Ming
Reprinted please indicate from http://www.mobilegamebase.com/

The following figure shows the game interface implemented using mygui. The resources are recorded by Lu Ding. Both the results and efficiency are quite satisfactory, and I have hardly modified the myguiCodeYou only need to modify the skin configuration file.


Explain the following practices:
1. Animation
There are two types of animations: texture animation, position movement, Alpha gradient, and so on. These two myguis have been implemented and can be used through staticimage and controller. There is nothing to say about texture animation. The controller can perform any extension (such as moving the specified path and flashing the button), and it is very convenient to scale and won't modify the mygui.

2. Automatic stitching
For example, to create a dialog composed of images, the dialog can be stretched without deformation. Refer to the Panel skin and then create a skin. Generally, a panel is composed of nine parts, but the buttons are usually composed of three parts, when writing skin, you can keep three basisskins (I am still taking a detour here), and then put an editclient as the text on the button. It can be easily expanded and combined to achieve the goal. This is the strength of mygui skin.

3. Adaptive Window
It is the align concept of mygui. For example, in the upper-right corner of the parent window, the Child window is in the upper-right corner no matter how the parent window is stretched. In this way, a set of UIS can be used to adapt to any resolution. So my practice is that every main window (such as a dialog) is made up of a panlempty parent window. When loading in the game, the parent window at the top is enlarged to full screen, in this way, you can use align to place the control in a proper position. Of course, we need to solve a problem. When you click the mouse, we do not select this upper-level window, so that the mouse event can be passed to the game logic.

4. tooltip
Tooltip can be any complicated. Please refer to the example of itembox in mygui. Note that a tooltip can be triggered only when the needtooltip attribute of the control is true.

5. Chinese display and text Mixing
There is no doubt that you have to implement the Chinese text by yourself. I mentioned it in the previous article. Text-and-text mixing is often troublesome for UI, because there are many things to manage, but mygui can be easily implemented. Take a closer look at the colour example, if the string contains the # and 6-digit color values, it is recorded during parsing and used for painting. Here, we can use the number # E followed by two digits. when parsing this situation, we will create a staticimage as the subwindow of the current control, and we will be able to implement emoticon animation. This is also a benefit. When the controller is used to make some effects on the control, the expression also has the same effect.

6. Image buttons
Basic functions of mygui.
7. progress bar of any style
Provide the skin file.
8. Icon dragging
Please refer to the example itembox.

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.