Files
quip/example/example.cpp
2025-11-01 15:54:37 +00:00

16 lines
639 B
C++

#include <quip.h>
int main() {
Quip::Window window("Quip Window", 800, 600);
int buttonPresses = 0;
window.addChild("textLabel", Quip::Widget::TextLabel("Hi there!", 10, 10));
window.addChild("button", Quip::Widget::Button("Click me!", [&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!";
}
}, 10, 50));
return window.run();
}