Initial commit
This commit is contained in:
1
example/.gitignore
vendored
Normal file
1
example/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
build
|
||||
10
example/CMakeLists.txt
Normal file
10
example/CMakeLists.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
cmake_minimum_required(VERSION 4.0)
|
||||
project(example)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
find_package(quip REQUIRED)
|
||||
|
||||
add_executable(example example.cpp)
|
||||
target_link_libraries(example PRIVATE quip::quip)
|
||||
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