Ejemplo n.º 1
0
void Mouse::updateCursor() {

	if (!_surface)
		return;

	if (_doDeltaX) {
		_surface->getDrawRect().x = filterX(_x - _drawOffset.width - _drawOffset.x + 1);
	} else {
		_surface->getDrawRect().x = filterX(_x + _drawOffset.x);
	}

	if (_doDeltaY) {
		_surface->getDrawRect().y = filterY(_y - _drawOffset.height - _drawOffset.y + 1);
	} else {
		_surface->getDrawRect().y = filterY(_y + _drawOffset.y);
	}

	if (_needRefresh) {
		_needRefresh = false;
		_drawOffset = _mouseCursorResource.getRect();
		_surface->drawMouseCursorResource(_mouseCursorResource, _frameNum / 2);
		Graphics::Surface *cursorSurface = _surface->getSurface();
		CursorMan.replaceCursor((const byte*)cursorSurface->pixels,
			cursorSurface->w, cursorSurface->h, -_drawOffset.x, -_drawOffset.y, 0);
	}

}
Ejemplo n.º 2
0
void FastHessian::buildResponseLayer(ResponseLayer *layer)
{
  int step = layer->step();
  int size = layer->filter_size();
  int lobe = size/3;

  float inverse_area = 1.0f/(size*size);

  float Dxx, Dyy, Dxy;

  int x,y;

  for(y = 0; y<layer->height(); y++) {
    for(x = 0; x<layer->width(); x++) {
      Point p(x*step,y*step);

      Dxx = filterX(p, lobe) * inverse_area;
      Dyy = filterY(p, lobe) * inverse_area;
      Dxy = filterXY(p, lobe) * inverse_area;

      float detHess = (Dxx*Dyy - 0.81f*Dxy*Dxy); // (0.9Dxy)^2 == 0.81*Dxy*Dxy
      layer->setResponse(Point(x,y), detHess);
    }
  }
}
Ejemplo n.º 3
0
void AnimatedSprite::updatePosition() {

	if (!_surface)
		return;

	if (_doDeltaX) {
		_surface->getDrawRect().x = filterX(_x - _drawOffset.x - _drawOffset.width + 1);
	} else {
		_surface->getDrawRect().x = filterX(_x + _drawOffset.x);
	}

	if (_doDeltaY) {
		_surface->getDrawRect().y = filterY(_y - _drawOffset.y - _drawOffset.height + 1);
	} else {
		_surface->getDrawRect().y = filterY(_y + _drawOffset.y);
	}

	if (_needRefresh) {
		_surface->drawAnimResource(_animResource, _currFrameIndex, _doDeltaX, _doDeltaY, _drawOffset.width, _drawOffset.height);
		_needRefresh = false;
	}

}
Ejemplo n.º 4
0
void StaticSprite::updatePosition() {

	if (!_surface)
		return;

	if (_doDeltaX) {
		_surface->getDrawRect().x = filterX(_x - _drawOffset.x - _drawOffset.width + 1);
	} else {
		_surface->getDrawRect().x = filterX(_x + _drawOffset.x);
	}

	if (_doDeltaY) {
		_surface->getDrawRect().y = filterY(_y - _drawOffset.y - _drawOffset.height + 1);
	} else {
		_surface->getDrawRect().y = filterY(_y + _drawOffset.y);
	}

	if (_needRefresh) {
		_surface->drawSpriteResourceEx(_spriteResource, _doDeltaX, _doDeltaY, _drawOffset.width, _drawOffset.height);
		_needRefresh = false;
	}

}