mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-02 00:27:27 +00:00
29 lines
921 B
C++
29 lines
921 B
C++
// Copyright © SixtyFPS GmbH <info@sixtyfps.io>
|
|
// SPDX-License-Identifier: (GPL-3.0-only OR LicenseRef-SixtyFPS-commercial)
|
|
|
|
// main.cpp
|
|
|
|
#include "memory_tiles_from_cpp.h" // generated header from memory_tiles_from_cpp.60
|
|
// ANCHOR: main
|
|
// ...
|
|
|
|
#include <random> // Added
|
|
|
|
int main()
|
|
{
|
|
auto main_window = MainWindow::create();
|
|
auto old_tiles = main_window->get_memory_tiles();
|
|
std::vector<TileData> new_tiles;
|
|
new_tiles.reserve(old_tiles->row_count() * 2);
|
|
for (int i = 0; i < old_tiles->row_count(); ++i) {
|
|
new_tiles.push_back(*old_tiles->row_data(i));
|
|
new_tiles.push_back(*old_tiles->row_data(i));
|
|
}
|
|
std::default_random_engine rng {};
|
|
std::shuffle(new_tiles.begin(), new_tiles.end(), rng);
|
|
auto tiles_model = std::make_shared<slint::VectorModel<TileData>>(new_tiles);
|
|
main_window->set_memory_tiles(tiles_model);
|
|
|
|
main_window->run();
|
|
}
|
|
// ANCHOR_END: main
|