GSDP:GAM100/CProcessing/CP POSITION MODE

From Inside
Jump to: navigation, search

CP_POSITION_MODE

Description

The enumeration of methods of drawing shapes. Shapes can be drawn using the reference point of the CP_POSITION_CENTER or the top-left CP_POSITION_CORNER. Used with CP_Graphics_SetRectMode(), CP_Graphics_SetEllipseMode(), and CP_Graphics_SetImageMode().

Example

void update() 
{
  // set the background color to gray
  CP_Settings_Background(CP_Color_Create(200, 200, 200, 255));

  // set the rectangle drawing mode to CENTER
  CP_Graphics_SetRectMode(CP_POSITION_CENTER);

  // draw a rectangle at the center of the screen, half the size of the screen
  CP_Graphics_DrawRect(CP_System_GetCanvasWidth() / 2.0f, CP_System_GetCanvasHeight() / 2.0f, CP_System_GetCanvasWidth() / 2.0f, CP_System_GetCanvasHeight() / 2.0f);

  // set the rectangle drawing mode to CORNER
  CP_Graphics_SetRectMode(CP_POSITION_CORNER);

  // draw the same rectangle, different mode
  CP_Graphics_DrawRect(CP_System_GetCanvasWidth() / 2.0f, CP_System_GetCanvasHeight() / 2.0f, CP_System_GetCanvasWidth() / 2.0f, CP_System_GetCanvasHeight() / 2.0f);
}

Related

Personal tools
Namespaces

Variants
Actions
Navigation
NameSpaces:>
Tools
Dynamic:>