Exemplo n.º 1
0
int rviewOSectionImage::process(wxObject &obj, wxEvent &evt)
{
    int type = evt.GetEventType();

    if (type == wxEVENT_TYPE_CHECKBOX_COMMAND)
    {
        if (&obj == (wxObject*)boundingBox)
        {
            doBoundingBox = boundingBox->GetValue();
            fillBuffer();
            pcanv->updateDisplay();
            return 1;
        }
    }
    else if (type == wxEVENT_TYPE_SLIDER_COMMAND)
    {
        unsigned int i;

        for (i=0; i<numSections; i++)
        {
            if (&obj == (wxObject*)(sliders[i]))
            {
                updateSlice(i, sliders[i]->GetValue(), TRUE);
                return 1;
            }
        }
    }
    else if (type == wxEVENT_TYPE_TEXT_ENTER_COMMAND)
    {
        unsigned int i;

        for (i=0; i<numSections; i++)
        {
            if (&obj == (wxObject*)(sltexts[i]))
            {
                updateSlice(i, atoi(sltexts[i]->GetValue()), FALSE);
                return 1;
            }
        }

        if (&obj == (wxObject*)thickText)
        {
            int newThick = atoi(thickText->GetValue());
            if ((newThick > 0) && (newThick != thickness))
            {
                thickness = newThick;
                refreshSlices(TRUE);
                return 1;
            }
        }
    }

    return rviewRenderImage::process(obj, evt);
}
Exemplo n.º 2
0
void worldSpace::teleportal(int dir)
{
  //std::cout << "Using a portal!" << std::endl;
  //0 moves you down a level, 1 moves you up a level.
  if(dir == 0)
    {
      if(clvl == lvl1)
        {
          clvl = lvl2;
          onlvl = 2;
        }
      else if(clvl == lvl2)
        {
          clvl = lvl3;
          onlvl = 3;
        }
    }
  else if(dir == 1)
    {
      if(clvl == lvl3)
        {
          clvl = lvl2;
          onlvl = 2;
        }
      else if(clvl == lvl2)
        {
          clvl = lvl1;
          onlvl = 1;
        }
    }

  updateSlice();
  update();
}
/*
 * SliceWidget - Constructor for the SliceWidget class.
 *
 * parameter _name - const char *
 * parameter _parent - GLMotif::Container *
 * parameter volume - Volume *
 * parameter _manageChild - bool
 */
SliceWidget::SliceWidget(const char * _name, GLMotif::Container * _parent, Volume * _volume, bool _manageChild) :
    GLMotif::Widget(_name, _parent, false), directionChanged(false), selected(false), sliceChanged(false), sliceDirection(XY),
            volume(_volume) {
    marginWidth = 0.0f;
    preferredSize[0] = 0.0f;
    preferredSize[1] = 0.0f;
    preferredSize[2] = 0.0f;
    xySlice = new unsigned char[volume->getWidth() * volume->getHeight()];
    xzSlice = new unsigned char[volume->getWidth() * volume->getDepth()];
    yzSlice = new unsigned char[volume->getHeight() * volume->getDepth()];
    updateSlice(sliceDirection, volume->getDepth() / 2);
    if (_manageChild)
        manageChild();
} // end SliceWidget()
Exemplo n.º 4
0
worldSpace::worldSpace(QWidget *parent)
  : QWidget(parent)
{
  setPalette(QPalette(QColor(0, 0, 0)));
  setAutoFillBackground(true);
  cXpos = 12;
  cYpos = 12;
  onlvl = 1;
  
  //Initalizes the "permanent" vectors to the correct size.
  rockmap = std::vector<std::vector<char> > (ROW, std::vector<char>(COL,'n'));
  slice = std::vector<std::vector<char> > (WINSIZE, 
                                           std::vector<char>(WINSIZE,'n'));

  //Initalizes the "impermanent" vectors to the correct size.
  lvl1 = std::vector<std::vector<char> > (ROW, std::vector<char>(COL, 'g'));
  lvl2 = std::vector<std::vector<char> > (ROW, std::vector<char>(COL, 'g'));
  lvl3 = std::vector<std::vector<char> > (ROW, std::vector<char>(COL, 'g'));

  //Initalize the down portal, the up portal and some terrain features.
  //The fact that these are held in text files make for easy editing by me!
  //Thank god for small favors amirite?
  rockmap = cartographer.readLevel(0);
  lvl1 = cartographer.readLevel(1);

  //Initalize the up/down portal for level 2
  lvl2[6][8] = 'u';
  lvl2[12][14] = 'd';

  //Pool of water on level 2
  lvl2[20][19] = 'w';
  lvl2[20][20] = 'w';
  lvl2[20][21] = 'w';
  lvl2[21][20] = 'w';
  lvl2[21][21] = 'w';

  //Initalize the up/down portal for level 3
  lvl3[18][20] = 'u';
 

  //The default clvl, or current level, is level 1.
  clvl = lvl1;

  updateSlice();
  update();
}
Exemplo n.º 5
0
void MainViewer::updateXYPlaneView(int value)
{
    float slice_pos = (float)value/sliders[2]->maximum();
    updateSlice(2, slice_pos);
}
Exemplo n.º 6
0
Arquivo: key.cpp Projeto: axiak/axedb
ReadStoreKey &ReadStoreKey::operator=(ReadStoreKey const &aConst) {
  column_ = aConst.column_;
  bytes_ = aConst.bytes_;
  updateSlice();
  return *this;
}
Exemplo n.º 7
0
Arquivo: key.cpp Projeto: axiak/axedb
ReadStoreKey::ReadStoreKey(ReadStoreKey const &aConst) :
    column_(aConst.column_),
    bytes_(aConst.bytes_) {
  updateSlice();
}
Exemplo n.º 8
0
Arquivo: key.cpp Projeto: axiak/axedb
ReadStoreKey::ReadStoreKey() : column_(0), bytes_(), slice_repr_() {
  updateSlice();
}
Exemplo n.º 9
0
//Constructor for the gamespace class
gameSpace::gameSpace(QWidget *parent)
  : QWidget(parent)
{
  QPushButton *button1 = new QPushButton(tr("Orders"));
  button1->setFont(QFont("Times", 18, QFont::Bold));

  QPushButton *button2 = new QPushButton(tr("End Turn"));
  button2->setFont(QFont("Times", 18, QFont::Bold));

  QPushButton *button3 = new QPushButton(tr("Quests"));
  button3->setFont(QFont("Times", 18, QFont::Bold));

  QPushButton *button4 = new QPushButton(tr("Log"));
  button4->setFont(QFont("Times", 18, QFont::Bold));

  wspace = new worldSpace;
  
  wtree = new worldTree;
  
  lmap = new localMap;

  (void) new QShortcut(Qt::Key_Up, wspace, SLOT(moveUP()));
  (void) new QShortcut(Qt::Key_Right, wspace, SLOT(moveRIGHT()));
  (void) new QShortcut(Qt::Key_Down, wspace, SLOT(moveDOWN()));
  (void) new QShortcut(Qt::Key_Left, wspace, SLOT(moveLEFT()));
  (void) new QShortcut(Qt::CTRL + Qt::Key_Q, this, SLOT(close()));

  connect(button1, SIGNAL(clicked()), 
          this, SLOT(showOrderWindow()));

  connect(button2, SIGNAL(clicked()),
          wspace, SLOT(endYourTurn()));

  connect(this, SIGNAL(pickedUnitm(unit)),
          wspace, SLOT(movementOverlay(unit)));

  connect(this, SIGNAL(pickedUnita(unit)),
          wspace, SLOT(attackOverlay(unit)));

  connect(wspace, SIGNAL(deselectall()),
          wspace, SLOT(wipeOverlay()));

  connect(wspace, SIGNAL(moved()), 
          wspace, SLOT(updateSlice()));

  connect(wspace, SIGNAL(sendMap(std::vector<std::vector<tile> >)),
          lmap, SLOT(updateMap(std::vector<std::vector<tile> >)));

  connect(wspace, SIGNAL(updateTree(unit)),
          wtree, SLOT(updateTree(unit)));
  
  QGridLayout *gridLayout = new QGridLayout;
  gridLayout->addWidget(wspace, 0, 0, 2, 2);
  gridLayout->addWidget(wtree, 0, 2, 1, 2);
  gridLayout->addWidget(lmap, 1, 2, 1, 2);
  gridLayout->addWidget(button1, 2, 0);
  gridLayout->addWidget(button2, 2, 1);
  gridLayout->addWidget(button3, 2, 2);
  gridLayout->addWidget(button4, 2, 3);
  gridLayout->setColumnStretch(0, 8);
  gridLayout->setColumnStretch(1, 8);
  setLayout(gridLayout);
}