GUI Library Development Articles

Basically, I can’t find any good articles for developing my own GUI , which deal with best practices, basic structure, event bubbles, tips and avoiding all common mistakes . I'm particularly uninterested in how to build a GUI with a proof of concept in 5 minutes, which barely works ... and I'm not interested in creating the next GUI of the future.

The goal is to create an acceptable graphical interface for use in the tools for the game, however they will exist in the game itself, so I do not want to use the existing large-scale graphical interfaces, and I believe that most of the graphical interfaces of the games are pretty bloated because I need. And I like the experience of doing it myself.

In the past, I worked with a GUI that worked very well, but due to some bad design decisions and inexperience, it could only do so much (and was built into Flash, so it got a lot of things for free). So I would really like to understand the basics this time.

+4
source share
2 answers

A few tips -

1) Choose your style that will work with the user interface - will it be stateless? If so, how are you going to handle events accordingly? If it is inactive, you may have to reevaluate the user interface user code twice to update events from the user side. If your user interface is stateful then you don’t have to worry about handling events, but it will limit your user interfaces when it comes to quick mutations and rearrangements.

2) Do not rely too much on OO; virtual methods are not the fastest thing in the world, so use them with caution; however, it may have some kind of inheritance structure. Beware of dynamic_cast and RTTI if you use objects; they will slow you down. Instead, configure the enum method, get_type () for each widget class, and perform manual immunity checks.

3) Try to separate the look and the logic / layout of the interface.

4) If you need dynamic windows, layouts, etc., you will have to handle alignment, clip, position, etc. and their updates. If you only need statically positioned widgets, this will simplify.

5) Do not overestimate, you will not benefit from this.

Actually there is nothing special that I will tell you; Any specific question may arise?

+1
source

Take a look at the docs for existing GUI libraries. This should give you detailed information about proven designs to solve the problems you are facing.

You might want to start with the one you are familiar with, but the one that I think is well designed is AppKit . Its API is Obj-C, so copying it requires some adjustment, but the documents provide all kinds of information about the interaction of objects, for example. handle events and how layout restrictions work that should be directly applicable to designing OO GUIs in most languages.

0
source

Source: https://habr.com/ru/post/1402333/


All Articles