Exemple #1
0
Construction::Construction(MyWindow& window)
	:target(window)
	, stats(DATABASE.getStats())
	, cursorVector(0, 0, 1)
	, cursor(arus::Textures::cursor)
	, kafelki()
	, elementy()
	, backShape()
	, stillBuildingMap(true)
	, itSaved(false)
	, nextElement()
{
	for (int i = 0; i < 13; i++)
		for (int j = 0; j < 13; j++)
			kafelkiID[i][j] = 0;

	next.setFont(DATABASE.get(arus::Font::DisposableDroid));
	next.setString("Next");
	next.setPosition(770, 450);
	next.setCharacterSize(30);
	next.setFillColor(sf::Color::Black);

	mapPos.x = 30;
	mapPos.y = 25;
	backShape.setSize(sf::Vector2f(13 * 54, 13 * 48));
	backShape.setFillColor(sf::Color::Black);
	backShape.setPosition(mapPos.x, mapPos.y);
	backShape.setScale(1, 1);

	backShapeNext.setSize(sf::Vector2f(54, 48));
	backShapeNext.setFillColor(sf::Color::Black);
	backShapeNext.setPosition(mapPos.x, mapPos.y);
	backShapeNext.setScale(1, 1);
	backShapeNext.setPosition(770, 500);

	cursor.setPosition(mapPos.x + 27, mapPos.y + 24);
	underCursor = elementy[0];

	//mapTexture.loadFromFile("/Data/Textures/MapTextures.jpg");
	//brick
	elementy[1].setTextureAndRect(arus::Textures::brick, sf::IntRect(0, 0, 54, 48));
	elementy[2].setTextureAndRect(arus::Textures::brick, sf::IntRect(0, 0, 27, 48));
	elementy[3].setTextureAndRect(arus::Textures::brick, sf::IntRect(27, 0, 27, 48));
	elementy[4].setTextureAndRect(arus::Textures::brick, sf::IntRect(0, 0, 54, 24));
	elementy[5].setTextureAndRect(arus::Textures::brick, sf::IntRect(0, 24, 54, 24));
	//steel
	elementy[6].setTextureAndRect(arus::Textures::steel, sf::IntRect(0, 0, 54, 48));
	elementy[7].setTextureAndRect(arus::Textures::steel, sf::IntRect(0, 0, 27, 48));
	elementy[8].setTextureAndRect(arus::Textures::steel, sf::IntRect(27, 0, 27, 48));
	elementy[9].setTextureAndRect(arus::Textures::steel, sf::IntRect(0, 0, 54, 24));
	elementy[10].setTextureAndRect(arus::Textures::steel, sf::IntRect(0, 24, 54, 24));
	//reszta
	elementy[11].setTexture(arus::Textures::water); //water
	elementy[12].setTexture(arus::Textures::ice); //ice
	elementy[13].setTexture(arus::Textures::grass); //grass
	elementy[14].setTexture(arus::Textures::eagle); //orzel

	mapPos.x += 27;
	mapPos.y += 24;
}
Exemple #2
0
void
PlotWidget::loadMarkers (DataBase &db)
{
  // load marker names
  QStringList names;
  db.getTypes(QString("marker"), names);
  
  for (int pos = 0; pos < names.size(); pos++)
  {
    Entity te;
    te.setName(names.at(pos));
    te.set(QString("plugin"), new QVariant(QString()));
    te.set(QString("plot"), new QVariant(QString()));
    te.set(QString("symbol"), new QVariant(QString()));
    
    if (! db.get(&te))
      continue;

    QVariant *tset = te.get(QString("symbol"));
    if (tset->toString() != g_symbol->symbol())
      continue;
    
    tset = te.get(QString("plot"));
    Plot *p = _plots.value(tset->toString());
    if (! p)
    {
      qDebug() << "PlotWidget::loadMarkers: plot not found" << tset->toString();
      continue;
    }
    
    tset = te.get(QString("plugin"));
    
    Marker *m = new Marker(tset->toString());
    m->setID(names.at(pos));
    
    Entity *e = m->settings();
    
    e->setName(names.at(pos));
    db.get(e);

    p->setMarker(m);
  }
}