Giter Club home page Giter Club logo

gui-4's Introduction

Project structure

right now src contains sub-folders for independent components that should be standalone libraries later on.
event - event system
layout - layout system
input - input system, builds on top of the event system
gui - core GUI system, integration of layout and input
framework - uses the GUI system, and provides the needed functionality to create applications.

Building

This project uses Conan + Premake setup. Make sure they're installed and run python ./build.py (or build.py -r for release).

The build scripts are configured to use Visual Studio generator on Windows and Visual Studio Code on Linux. You can change these generators in build.py.

Documentation

layout

the layout system is responsible for positioning and sizing of GUI elements.

layout element

a layout elements is a rectangle. it can have child elements that will be positioned relative to it, and laid out according to it's layout object.

a layout element can expand in each axis to fill up space inside its parent.

GUI element inherits from layout element.

layout object

layout objects control how child elements are arranged inside their parent element.

box - lists children one after another horizontally/vertically, and for expanding children size them evenly in the orientation direction by evenly split the parent size between them.

shrink - shrinks to fit around the children, without positioning them.

forward - don't perform any layouting and let the children perform layouting.

null - an element can also have its layout object set to nullptr, in which case it won't perform any layouting and prevent its children from performing layouting.

layout file

layouts can be described in a Deco format file which an element can load to instanciate the file's elements as its children, using application::load_layout().

input

elements can subscribe a callback to an event using input_manager::subscribe(), and the callback will be called when the event happens and the element is focused.
for example see button::button().

input_manager::subscribe_global() can be used to subscribe to events without an element.

events

there are events for key & mouse inputs, element focus & hover, and frame start.

a list of events can be found in events.h.

new events can be added by inheriting from input::event::base.

style

each element class defines its style properties, for example colors.

a style is a map from property name to value.
each style has a name.

element has a style name.
element uses its element name by default.
for example button will use "button" as its style by default.

styles are stored in style::manager::styles.

style file

styles can be described in a Deco format file which can be loaded using application::load_style_file().

gui-4's People

Contributors

enhex avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.