C++ UI library. Just write views, they are automatically layed out in that order.
See the sample at tears/MainScene.cpp
. If you want to run sample app, open tears.xcodeproj
in Xcode and run.
- Create a class which inherit
View
class. - Add subview to the
CustomView
at the constructor orviewWillLayout()
.
#include "view/base/View.hpp"
class CustomView: public View {
protected:
virtual void viewWillLayout() override {
// add subview(s) here ...
auto subview = make_unique<Rectangle>();
addchild(move(subview));
}
public:
CustomView() {
// or here.
auto subview = make_unique<Circle>();
addChild(move(subview));
}
virtual ~CustomView() {}
};
If you want to specify size, padding, alignment etc., use the methods in the Modifier
class. Since View
class inherits Modifier
class, just call those methods from the View
instances.
auto customView = make_unique<CustomView>();
customView->setWidthRatio(0.5f) // width = 50%
.setHeight(100.f) // height = 100dp
.setPadding(EdgeVertical, 8.f) // padding top and bottom = 8dp
.setAlignment(AlignmentTop); // aligned to top in the container
Document page is not deployed yet but you can serve it on localhost.
pip install mkdocs-material
mkdocs serve