Demos update (SpaceInvaders demo)
-added new sprites -added new functions to vectors -fixed rendering rotated sprites -small performance improvement and some bug fixes -added animations support -bullets get initial velocity from parent -added partiles for fire from gun and explosion of enemies
This commit is contained in:
parent
6c3c803d1e
commit
0b924ae77c
7 changed files with 411 additions and 34 deletions
|
|
@ -2,6 +2,18 @@ module ecs_utils.math.vector;
|
|||
|
||||
struct vec2
|
||||
{
|
||||
this(float v) @nogc nothrow
|
||||
{
|
||||
x = v;
|
||||
y = v;
|
||||
}
|
||||
|
||||
this(float x, float y) @nogc nothrow
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
|
|
@ -75,6 +87,22 @@ struct vec4
|
|||
float[4] data;
|
||||
}
|
||||
|
||||
this(float v) @nogc nothrow
|
||||
{
|
||||
x = v;
|
||||
y = v;
|
||||
z = v;
|
||||
w = v;
|
||||
}
|
||||
|
||||
this(float x, float y, float z, float w) @nogc nothrow
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.w = w;
|
||||
}
|
||||
|
||||
vec4 opBinary(string op)(float v)
|
||||
{
|
||||
static if (op == "+") return vec4(x + v, y + v, z + v, w + v);
|
||||
|
|
@ -96,6 +124,18 @@ struct ivec2
|
|||
}
|
||||
int[2] data;
|
||||
}
|
||||
|
||||
this(int v) @nogc nothrow
|
||||
{
|
||||
x = v;
|
||||
y = v;
|
||||
}
|
||||
|
||||
this(int x, int y) @nogc nothrow
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
ivec2 opBinary(string op, T)(T v)
|
||||
{
|
||||
|
|
@ -125,4 +165,20 @@ struct ivec4
|
|||
}
|
||||
int[4] data;
|
||||
}
|
||||
|
||||
this(int v) @nogc nothrow
|
||||
{
|
||||
x = v;
|
||||
y = v;
|
||||
z = v;
|
||||
w = v;
|
||||
}
|
||||
|
||||
this(int x, int y, int z, int w) @nogc nothrow
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.w = w;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue