Initial commit
This commit is contained in:
15
example/example.cpp
Normal file
15
example/example.cpp
Normal file
@@ -0,0 +1,15 @@
|
||||
#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();
|
||||
}
|
||||
Reference in New Issue
Block a user