Skip to content

Commit

Permalink
Added identity constants for transforms.
Browse files Browse the repository at this point in the history
  • Loading branch information
Chukobyte committed Dec 30, 2023
1 parent 2d0ce77 commit 87c12a4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions seika/math/se_math.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ typedef struct SKAVector2 {
} SKAVector2;

#define SKA_VECTOR2_ZERO (SKAVector2){ 0.0f, 0.0f }
#define SKA_VECTOR2_ONE (SKAVector2){ 1.0f, 1.0f }
#define SKA_VECTOR2_LEFT (SKAVector2){ -1.0f, 0.0f }
#define SKA_VECTOR2_RIGHT (SKAVector2){ 1.0f, 0.0f }
#define SKA_VECTOR2_UP (SKAVector2){ 0.0f, -1.0f }
Expand Down Expand Up @@ -67,6 +68,12 @@ typedef struct SKATransform2D {
float rotation; // degrees
} SKATransform2D;

#define SKA_TRANSFORM_IDENTITY (SKATransform2D){ \
.position = SKA_VECTOR2_ZERO, \
.scale = SKA_VECTOR2_ONE, \
.rotation = 0.0f \
}

typedef struct SKATransformModel2D {
SKAVector2 position;
SKAVector2 scale;
Expand All @@ -76,6 +83,14 @@ typedef struct SKATransformModel2D {
mat4 model;
} SKATransformModel2D;

#define SKA_TRANSFORM_MODEL_IDENTITY (SKATransformModel2D){ \
.position = SKA_VECTOR2_ZERO, \
.scale = SKA_VECTOR2_ONE, \
.rotation = 0.0f, \
.zIndex = 0, \
.scaleSign = SKA_VECTOR2_ONE \
}

// --- SKAVector3 --- //
typedef struct SKAVector3 {
float x;
Expand Down
2 changes: 1 addition & 1 deletion vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "seika",
"version": "0.0.17",
"version": "0.0.18",
"dependencies": [
{
"name": "sdl2",
Expand Down

0 comments on commit 87c12a4

Please sign in to comment.