Make it possible to exit the printer demo

... by clicking on the power button :-)

Calling exit is a big rough, but simplest and fastest for now.
This commit is contained in:
Simon Hausmann 2020-10-07 15:52:49 +02:00
parent a84fa68537
commit d771143f68
3 changed files with 19 additions and 4 deletions

View file

@ -9,21 +9,21 @@
LICENSE END */
#include "printerdemo.h"
struct InkLevelModel : sixtyfps::Model<InkLevel>
{
int row_count() const override { return m_data.size(); }
InkLevel row_data(int i) const override { return m_data[i]; }
std::vector<InkLevel> m_data = { { sixtyfps::Color::from_rgb_uint8(255, 255, 0), 0.9 },
{ sixtyfps::Color::from_rgb_uint8(0, 255, 255), 0.5 },
{ sixtyfps::Color::from_rgb_uint8(255, 0, 255), 0.8 },
{ sixtyfps::Color::from_rgb_uint8(0, 0, 0), 0.1 } };
{ sixtyfps::Color::from_rgb_uint8(0, 255, 255), 0.5 },
{ sixtyfps::Color::from_rgb_uint8(255, 0, 255), 0.8 },
{ sixtyfps::Color::from_rgb_uint8(0, 0, 0), 0.1 } };
};
int main()
{
static MainWindow printer_demo;
printer_demo.set_ink_levels(std::make_shared<InkLevelModel>());
printer_demo.on_quit([]() { ::exit(0); });
printer_demo.run();
}