Exemplo n.º 1
0
void LCDScreen::seeSamplingEdge(ticks_t time)
{
  ++edgeCounter;
  // TODO According to the AT043TN24 datasheet data should be sampled on the
  // falling edge. However the sc_lcd code drives on the falling edge so for
  // the moment sample on the rising to match that.
  if (DETracker.getSignal().getValue(time)) {
    // Thb
    const unsigned minHorizontalClks = 40;
    // Th * tvb
    const unsigned minVerticalClks = 5 * 520;
    ticks_t lowEdges = edgeCounter - (lastDEHighEdge + 1);
    if (lowEdges >= minVerticalClks) {
      // VSync
      x = y = 0;
      screen.flip();
    } else if (lowEdges >= minHorizontalClks) {
      // HSync
      x = 0;
      ++y;
    }
    if (x < screen.getWidth() && y < screen.getHeigth()) {
      screen.writePixel(x++, y, DataTracker.getSignal().getValue(time));
    }
    lastDEHighEdge = edgeCounter;
  }
}
Exemplo n.º 2
0
WaitActivity::WaitActivity(SDLScreen & screen):Activity(screen)
{
	waitView = new WaitView("waitting","gameover","winner","alert");
	waitView->setStateWait();
	ViewGroup* viewGroup = new ViewGroup(0, 0, screen.getWidth(), screen.getHeight());
	viewGroup->add(waitView);
	this->setContentView(viewGroup);
}
Exemplo n.º 3
0
void WaitView::draw(SDLScreen & screen)
{
	TextureManager::Instance().drawBackground(imageId.c_str(),
								screen.getRenderer());

	if (this->state == WAIT_VIEW_ALERT) 
	{
		this->text.draw(screen.getRenderer(), 250,300, 0, 0);
	}

}
Exemplo n.º 4
0
void PowerView::draw(SDLScreen & screen){
	
		int margin = 5;
		int heightBarProgress = 15;
		rect.x = getX();
		rect.y = getY() + 20;
		rect.h = heightBarProgress - margin;
		TextureManager::Instance().drawFillRect(screen.getRenderer(), rect, 255,0,0, 255);
		this->label.draw(screen.getRenderer(), getX() , getY());

}
Exemplo n.º 5
0
void LCDScreen::run(ticks_t time)
{
  switch (scheduleReason) {
  case SCHEDULE_SAMPLING_EDGE:
    assert(CLKSignal.isClock());
    seeSamplingEdge(time);
    if (time - lastPollForEvents >= minUpdateTicks) {
      if (screen.pollForEvents()) {
        throw ExitException(time, 0);
      }
      lastPollForEvents = time;
    }
    scheduleSamplingEdge(time + CLKSignal.getPeriod());
    break;
  case SCHEDULE_POLL_FOR_EVENTS:
    if (screen.pollForEvents()) {
      throw ExitException(time, 0);
    }
    schedulePollForEvents(time + minUpdateTicks);
    lastPollForEvents = time;
    break;
  }
}
Exemplo n.º 6
0
void HolyView::draw(SDLScreen & screen)
{ 
	TextureManager::Instance().drawFrame(currentSprite->getImageId(), 
										this->getXCenter(), 
										this->getYCenter(), 
										currentSprite->getWidth(), 
										currentSprite->getHeight(), 
										currentSprite->getCurrentRow(), 
										currentSprite->getCurrentFrame(), 
										screen.getRenderer(),
										false, 
										this->flip,
										true);

	if (!this->detonated) {
		SDL_Rect rect;
		rect.x = this->getX()-10;
		rect.y = this->getY()-22;
		rect.w = this->widhtLifeCurrent;
		rect.h = 5;
		TextureManager::Instance().drawFillRect(screen.getRenderer(),rect, 255, 0, 0, 255,true);
	}

}
Exemplo n.º 7
0
void RectangleView::draw(SDLScreen & screen)
{
	vertexX[0] = vertexA.x;
	vertexX[1] = vertexB.x;
	vertexX[2] = vertexC.x;
	vertexX[3] = vertexD.x;
	vertexY[0] = vertexA.y;
	vertexY[1] = vertexB.y;
	vertexY[2] = vertexC.y;
	vertexY[3] = vertexD.y;
	TextureManager::Instance().drawPolygon(screen.getRenderer(),
				vertexX,
				vertexY,
				4,
				this->getColorCod(),
				this->getBorderColorCod());
}
Exemplo n.º 8
0
void PentagonView::draw(SDLScreen & screen)
{
	vertexX[0] = vertexA.x;
	vertexX[1] = vertexB.x;
	vertexX[2] = vertexC.x;
	vertexX[3] = vertexD.x;
	vertexX[4] = vertexE.x;

	vertexY[0] = vertexA.y;
	vertexY[1] = vertexB.y;
	vertexY[2] = vertexC.y;
	vertexY[3] = vertexD.y;
	vertexY[4] = vertexE.y;

	TextureManager::Instance().drawPolygon(screen.getRenderer(),
				vertexX,
				vertexY,
				countPoint,
				this->getColorCod(),
				this->getBorderColorCod());
	
}
Exemplo n.º 9
0
/*
void TimerView::start(){
	this->timmer.start();
	this->finished = false;
	this->timerView = 60;
	this->updateTimer = 0;
}

void TimerView::reset(){
	this->start();
}

bool TimerView::isFinished(){
	return this->finished;
}
*/
void TimerView::draw(SDLScreen & screen){
		int margin_left = 10;
		TextureManager::Instance().draw("reloj", 5, 5, screen.getRenderer());
		this->label.draw(screen.getRenderer(), getX() + margin_left , getY());
		this->numberLabel.draw(screen.getRenderer(), getX() + margin_left + 20, getY() + 30);
}