polygonRgba function

bool polygonRgba(
  1. Pointer<SdlRenderer> renderer,
  2. Pointer<Int16> vx,
  3. Pointer<Int16> vy,
  4. int n,
  5. int r,
  6. int g,
  7. int b,
  8. int a,
)

Implementation

bool polygonRgba(Pointer<SdlRenderer> renderer, Pointer<Int16> vx,
    Pointer<Int16> vy, int n, int r, int g, int b, int a) {
  /*
	* Draw
	*/
  bool result = true;

  /*
	* Vertex array NULL check
	*/
  if (vx == nullptr) {
    return false;
  }
  if (vy == nullptr) {
    return false;
  }

  /*
	* Sanity check
	*/
  if (n < 3) {
    return false;
  }

  /*
	* Pointer setup
	*/

  /*
	* Set color
	*/
  result = true;
  if (result) {
    result = sdlSetRenderDrawBlendMode(
        renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
  }
  if (result) {
    result = sdlSetRenderDrawColor(renderer, r, g, b, a);
  }

  /*
	* Draw
	*/
  if (result) {
    result = polygon(renderer, vx, vy, n);
  }

  return result;
}