GSDP:GAM100/CProcessing/CP Matrix Set()

From Inside
Jump to: navigation, search

CP_Matrix_Set()

Description

Create a CP_Matrix by inputting each individual value of every index of the matrix.

Parameters

CP_Matrix_Set(float m00, float m01, float m02, float m10, float m11, float m12, float m20, float m21, float m22)

  • mXY - (float) Each input is a matrix index in row X and column Y.

Example

CP_Vector end_position;
void init()
{
  end_position = CP_Matrix_Set(CP_System_GetWindowWidth() / 2.0f + 80.0f, CP_System_GetWindowHeight() / 2.0f + 80.0f);
}

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

  // Create transformation matrices
  CP_Matrix trans = CP_Matrix_Set(1.0f, 0, CP_System_GetWindowWidth() / 2.0f,
                        0, 1.0f, CP_System_GetWindowHeight() / 2.0f,
                        0, 0, 1.0f);
  CP_Matrix rotate = CP_Matrix_Rotate(5.0f);

  // Combine
  CP_Matrix transform = CP_Matrix_Multiply(trans, CP_Matrix_Multiply(rotate, CP_Matrix_Inverse(trans)));

  // Update the end point of the line
  end_position = CP_Vector_MatrixMultiply(transform, end_position);

  CP_Graphics_DrawLine(CP_System_GetWindowWidth() / 2.0f, CP_System_GetWindowHeight() / 2.0f, end_position.x, end_position.y);
}

Related

Personal tools
Namespaces

Variants
Actions
Navigation
NameSpaces:>
Tools
Dynamic:>