void CreateEntityTool::handleDragLeave(InputState& inputState, const String& payload) {
     assert(m_entity != NULL);
     delete m_entity;
     m_entity = NULL;
     deleteFigure(m_entityFigure);
     m_entityFigure = NULL;
 }
 CreateEntityTool::~CreateEntityTool() {
     if (m_entityFigure != NULL) {
         deleteFigure(m_entityFigure);
         m_entityFigure = NULL;
     }
     if (m_entity != NULL) {
         delete m_entity;
         m_entity = NULL;
     }
 }
예제 #3
0
파일: main.c 프로젝트: gekola/BSUIR-labs
void render(SDL_Surface *screen, rect_win **win, figure *f,             \
            point p, float sx, float sy, unsigned nn, unsigned* n,      \
            Uint32 color)
{
  for(int j=0; j<nn; ++j) {
    figure *ff = transFigure(f, p, sx, sy);
    for (int i=0; i<n[j]; ++i)
      rectWinCut(win[j][i], &ff);
    drawFigure(screen, ff, color);
    deleteFigure(ff);
  }
}
        bool CreateEntityTool::handleDragDrop(InputState& inputState, const String& payload) {
            assert(m_entity != NULL);

            beginCommandGroup(wxT("Create Entity"));
            Controller::AddObjectsCommand* addObjectsCommand = Controller::AddObjectsCommand::addEntity(document(), *m_entity);
            submitCommand(addObjectsCommand);
            Controller::ChangeEditStateCommand* changeEditStateCommand = Controller::ChangeEditStateCommand::replace(document(), *m_entity);
            submitCommand(changeEditStateCommand);
            endCommandGroup();
            
            m_entity = NULL;
            deleteFigure(m_entityFigure);
            m_entityFigure = NULL;

            return true;
        }
예제 #5
0
        void CreateBrushTool::handleEndPlaneDrag(InputState& inputState) {
            assert(m_brush != NULL);
            assert(m_brushFigure != NULL);
            
            Controller::AddObjectsCommand* addBrushCommand = Controller::AddObjectsCommand::addBrush(document(), *m_brush);
            Controller::ChangeEditStateCommand* selectBrushCommand = Controller::ChangeEditStateCommand::replace(document(), *m_brush);
            
            beginCommandGroup(wxT("Create Brush"));
            submitCommand(addBrushCommand);
            submitCommand(selectBrushCommand);
            endCommandGroup();
            
            m_brush = NULL;

            deleteFigure(m_brushFigure);
            m_brushFigure = NULL;
        }
예제 #6
0
/*****************************************************************************
 *
 * Description:
 *    Advance the game, check if game is over
 *
 ****************************************************************************/
static void
advanceGame(void)
{
  insertFigure(currFigure, currXpos, currYpos);
  drawGame();
  deleteFigure(currFigure, currXpos, currYpos);

  /*******************************************************
   * Check if time to update figure position
   *******************************************************/
  updateDelayTime();
  if ((ms - lastUpdate) > delayTimeMs)
  {
    lastUpdate = ms;
    
    if (isValid(currXpos, currYpos+1, currFigure))
      currYpos++;

    //figure has hit bottom
    //insert new, random figure on the game board
    else
    {
      insertFigure(currFigure, currXpos, currYpos);
      currYpos  = 0;
      currXpos  = 3;
      currFigure = rand() % NUM_OF_FIGURE;

      //check if game is over
      if (gameOver())
        gameStatus = GAME_OVER;
    }

    //check score, i.e., if any rows are full
    checkScore();
  }
}