GSDP:GAM100/CProcessing/CP Image Draw()

From Inside
Jump to: navigation, search

CP_Image_Draw()

Description

Draws a given CP_Image to the screen using the given size and coordinates

Function Definition

void CP_Image_Draw(CP_Image image, float x, float y, float w, float h, int alpha);

Parameters

  • image- (CP_Image) The image that you want to draw to the screen
  • x- (float) The x coordinate of the image in screen coordinates
  • y- (float) The y coordinate of the image in screen coordinates
  • w- (float) The width to draw the image in pixels
  • h- (float) The height to draw the image in pixels
  • alpha- (float) The alpha value to draw the image with (0-255)

Return

  • void- This function does not return anything

Example

CP_Image justinFace = NULL;

void init()
{
  justinFace = CP_Image_Load("./Assets/Justins_face.png");
}

void update()
{
  CP_Settings_Background(CP_Color_Create(255, 255, 255, 255));
 
  int width = CP_System_GetWindowWidth();
  int height = CP_System_GetWindowHeight();

  CP_Image_Draw(justinFace, width / 2, height / 2, width / 2, width / 2, 255);
}

void shutdown()
{
  CP_Image_Free(justinFace);
}

Related

Personal tools
Namespaces

Variants
Actions
Navigation
NameSpaces:>
Tools
Dynamic:>