Demos update:
-modified texture atlas -fixed bug with high CPU usage (use pthread instead of builtin D multithreading) -added new graphics -snake now render tile coresponding to body part -snake is destroyed after collision and emit some particles -added some functionality to vectors -fixed documentation issue in Manager.d
This commit is contained in:
parent
8381ac166b
commit
50715fbc40
6 changed files with 366 additions and 23 deletions
|
|
@ -30,6 +30,11 @@ struct vec2
|
|||
else static assert(0, "Operator "~op~" not implemented");
|
||||
}
|
||||
|
||||
ivec2 opCast()
|
||||
{
|
||||
return ivec2(cast(int)x,cast(int)y);
|
||||
}
|
||||
|
||||
void opOpAssign(string op)(vec2 v)
|
||||
{
|
||||
static if (op == "+")
|
||||
|
|
@ -69,6 +74,15 @@ struct vec4
|
|||
}
|
||||
float[4] data;
|
||||
}
|
||||
|
||||
vec4 opBinary(string op)(float v)
|
||||
{
|
||||
static if (op == "+") return vec4(x + v, y + v, z + v, w + v);
|
||||
else static if (op == "-") return vec4(x - v, y - v, z - v, w - v);
|
||||
else static if (op == "*") return vec4(x * v, y * v, z * v, w * v);
|
||||
else static if (op == "/") return vec4(x / v, y / v, z / v, w / v);
|
||||
else static assert(0, "Operator "~op~" not implemented");
|
||||
}
|
||||
}
|
||||
|
||||
struct ivec2
|
||||
|
|
@ -82,6 +96,11 @@ struct ivec2
|
|||
}
|
||||
int[2] data;
|
||||
}
|
||||
|
||||
vec2 opCast()
|
||||
{
|
||||
return vec2(x,y);
|
||||
}
|
||||
}
|
||||
|
||||
struct ivec4
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue