Kubic-C / spock_engine

C++ 2D Game Engine | Spock Engine
MIT License
7 stars 1 forks source link

UI Canvas redesign #6

Closed Kubic-C closed 1 year ago

Kubic-C commented 1 year ago

Currently spock engine's UI canvas's design is slightly cluttered and includes a lot of boiler blate user side.

Solution: 1) Redesign the ui canvas' elements to be addable through functions calls by the main ui_canvas_t class. 2) Create system through which all elements are controlled by restraints, which controls size and position of ui_element_t through restraints. 3) opitional- if an element already exists on screen and a new one is added, it should be automatically moved. So both can be visible and one is not not clipping inside of another.


// 1. && 2. example
ui_canvas_t* canvas = scene.canvas;

// this will make the element display in the middle of the screen
canvas->add_text("hello_world").add_horizontal_constraint(SPK_MIDDLE).add_vertical_constraint(SPK_MIDDLE);
Kubic-C commented 1 year ago

Finished: https://github.com/Kubic-C/spock_engine/commit/fb01e41e7ab7e8753dfe4b7470e5e11288a029d7

Kubic-C commented 1 year ago

still have to add that FLECS C++ style building stuff, but ill get it done later, its not a major concern as of now