Component-based game UI Architecture Design

Source: Internet
Author: User
It has always been a dream to build a car by assembling components like producing a car. The emergence of component development ideas has brought us closer to this dream. Components mean high cohesion and high reuse. We only need to know their external interface specifications to use their functions, without having to know how they are implemented and operated internally.
In game development, UI management is a troublesome problem. Especially for games that need to switch different UIS according to different scenarios, the organization and management of UI is particularly important, can I manage various UIS (such as chat windows and system interfaces) as a series of components? The following is a solution used in actual development:

According to the general granularity of the UI component, it is reasonable to generate all the uiobject objects during guisystem initialization and put them into _ uimap, because initui is not called for each uiobject yet, it's just a simple new. It takes very little time to complete these steps. Loadcurui allows us to load the corresponding UI by passing in a scenario ID. for flexibility and convenience, we can place the scenario ID and its corresponding UI component name in the configuration file.
All UI components must be inherited from uiobject, which contains a pointer to the window object that implements the window function. Such a UI class is equivalent to the Wrapper class of a window, so that guisystem can be centrally managed. For the interaction between UI components, guisystem is used as the middle layer, which removes strong coupling between them.
In the next article, I will introduce how to use cegui + Lua to implement this design scheme.

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.