18 lines
804 B
C++
18 lines
804 B
C++
#include <quip.h>
|
|
|
|
int main() {
|
|
int buttonPresses = 0;
|
|
Quip::Window window("Quip Window", 800, 600);
|
|
Quip::Font font("/usr/share/fonts/noto/NotoSans-Regular.ttf", 16);
|
|
window.addChild("image", Quip::Widget::Image("dingus.png", 100, 100));
|
|
window.addChild("textLabel", Quip::Widget::TextLabel("Hi there!", font));
|
|
window.addChild("button", Quip::Widget::Button(Quip::Widget::TextLabel("Click me!", font), [&window, &buttonPresses] {
|
|
auto* widget = window.getChild("textLabel");
|
|
if (widget && std::holds_alternative<Quip::Widget::TextLabel>(*widget)) {
|
|
buttonPresses++;
|
|
std::get<Quip::Widget::TextLabel>(*widget).text = "You have clicked the button " + std::to_string(buttonPresses) + " times!";
|
|
}
|
|
}));
|
|
return window.run();
|
|
}
|