lua_api: accept velocity as a vector
This commit is contained in:
parent
29c701ce6a
commit
3cd0a1f8ae
@ -328,7 +328,9 @@ function system:draw()
|
||||
local image = e["race.image"].data.image
|
||||
local origin = e["race.image"].data.origin
|
||||
--draw(velocity, x, y, sx, sy, angle, image, origin)
|
||||
test.set_sphere(x, y, angle)
|
||||
local vx = 0
|
||||
local vy = 0
|
||||
test.set_sphere(x, y, vx, vy)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ void update(float time);
|
||||
void draw_quad(int x1, int y1, int x2, int y2,
|
||||
int x3, int y3, int x4, int y4);
|
||||
|
||||
void set_sphere(float x, float y, float angle);
|
||||
void set_sphere(float x, float y, float vx, float vy);
|
||||
]]
|
||||
local source_path = love.filesystem.getSource()
|
||||
test = ffi.load(source_path .. "/test.so")
|
||||
|
||||
@ -45,10 +45,10 @@ void draw_quad(int x1, int y1, int x2, int y2,
|
||||
x3, y3, x4, y4);
|
||||
}
|
||||
|
||||
void set_sphere(float x, float y, float angle)
|
||||
void set_sphere(float x, float y, float vx, float vy)
|
||||
{
|
||||
XMVECTOR unit = XMVectorSet(1, 0, 0, 0); // the angle==0 unit vector
|
||||
view::state.forward = -XMVector3TransformNormal(unit, XMMatrixRotationZ(angle));
|
||||
view::state.forward = XMVector3Normalize(XMVectorSet(vx, vy, 0, 0));
|
||||
view::state.normal = view::get_normal();
|
||||
view::state.direction = view::get_direction();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user