GSDP:GAM100/CProcessing/CP Matrix Identity()

From Inside
Jump to: navigation, search

CP_Matrix_Identity()

Description

Create a CP_Matrix identity matrix.

Example

CP_Matrix default_m;
CP_Matrix identity_m;

void init()
{
  CP_Font_DrawTextBox(CP_Font_GetDefault() , 30.0f);
  CP_Settings_Fill(CP_Color_Create(0, 0, 0, 255));

  default_m = CP_Matrix_Identity();
  identity_m = CP_Matrix_Identity();
}

void update()
{
  CP_Settings_Background(CP_Color_Create(255, 255, 255, 255));

  // Print out the default matrix
  CP_Font_DrawText("Default: ", 0, 30);
  char matrix[128] = {0};
  sprintf_s(matrix, 128,"[%.0f, %.0f, %.0f]\n[%.0f, %.0f, %.0f]\n[%.0f, %.0f, %.0f]",
    default_m.m00, default_m.m01, default_m.m02,
    default_m.m10, default_m.m11, default_m.m12,
    default_m.m20, default_m.m21, default_m.m22);
  CP_Font_DrawTextBox(matrix, 175, 30, 200);

  // Print out the identity matrix
  CP_Font_DrawText("Identity: ", 0, 150);
  sprintf_s(matrix, 128, "[%.0f, %.0f, %.0f]\n[%.0f, %.0f, %.0f]\n[%.0f, %.0f, %.0f]",
    identity_m.m00, identity_m.m01, identity_m.m02,
    identity_m.m10, identity_m.m11, identity_m.m12,
    identity_m.m20, identity_m.m21, identity_m.m22);
  CP_Font_DrawTextBox(matrix, 175, 150, 200);

  CP_Font_DrawText("They are the same!", 0, 300);
}

Related

Personal tools
Namespaces

Variants
Actions
Navigation
NameSpaces:>
Tools
Dynamic:>