Ejemplo n.º 1
0
void Scene::FlipCursor() {
  Q_CHECK_PTR(cursor_);
  Q_CHECK_PTR(collection_);
  auto flipped = cursor_->CloneFlipped();
  addItem(flipped.release_ownership());
  removeItem(cursor_.get());
  cursor_ = std::move(flipped);
  collection_->RearrangeAdherableEdges(*cursor_);
}
Ejemplo n.º 2
0
void Scene::PutTileAtCursor() {
  Q_CHECK_PTR(cursor_);
  Q_CHECK_PTR(collection_);
  if (is_cursor_adhering_) {
    auto tile = cursor_->Clone();
    addItem(tile.release_ownership());
    collection_->PutTile(tile.get());
    collection_->RearrangeAdherableEdges(*cursor_);
  }
}
Ejemplo n.º 3
0
Scene::Scene(int width, int height, QObject* parent)
    : Base_(0.0, 0.0, width, height, parent),
      collection_(new TileCollection()),
      pos_(width / 2.0, height / 2.0),
      cursor_(new Kite(pos_)),
      is_cursor_adhering_(false),
      drag_last_pointed_(boost::none),
      pointed_(nullptr),
      putting_tile_(nullptr),
      removing_tile_(nullptr) {
  addItem(collection_.release_ownership());
  addItem(cursor_.release_ownership());
  auto initial_tile = cursor_->Clone();
  addItem(initial_tile.release_ownership());
  collection_->PutInitialTile(initial_tile.get());
}
Ejemplo n.º 4
0
 void release()
 {
     weak = const_cast<void*>(static_cast<void const*>(
         get_pointer(p)));
     release_ownership(p);
 }