Make binding functions static;

This commit is contained in:
bjorn 2019-02-17 14:52:22 -08:00
parent e05b835927
commit 90d6e2b407
29 changed files with 340 additions and 346 deletions

View File

@ -1,4 +1,5 @@
#include "api.h"
#include "api/data.h"
#include "filesystem/filesystem.h"
#include "data/blob.h"
#include <stdlib.h>

View File

@ -15,10 +15,6 @@ int l_lovrRandomGeneratorRandom(lua_State* L);
int l_lovrRandomGeneratorRandomNormal(lua_State* L);
int l_lovrRandomGeneratorGetSeed(lua_State* L);
int l_lovrRandomGeneratorSetSeed(lua_State* L);
int l_lovrPoolVec3(lua_State* L);
int l_lovrPoolQuat(lua_State* L);
int l_lovrPoolMat4(lua_State* L);
int l_lovrPoolDrain(lua_State* L);
int l_lovrVec3Set(lua_State* L);
int l_lovrQuatSet(lua_State* L);
int l_lovrMat4Set(lua_State* L);

View File

@ -20,26 +20,26 @@ static int luax_checkanimation(lua_State* L, int index, Animator* animator) {
}
}
int l_lovrAnimatorReset(lua_State* L) {
static int l_lovrAnimatorReset(lua_State* L) {
Animator* animator = luax_checktype(L, 1, Animator);
lovrAnimatorReset(animator);
return 0;
}
int l_lovrAnimatorUpdate(lua_State* L) {
static int l_lovrAnimatorUpdate(lua_State* L) {
Animator* animator = luax_checktype(L, 1, Animator);
float dt = luax_checkfloat(L, 2);
lovrAnimatorUpdate(animator, dt);
return 0;
}
int l_lovrAnimatorGetAnimationCount(lua_State* L) {
static int l_lovrAnimatorGetAnimationCount(lua_State* L) {
Animator* animator = luax_checktype(L, 1, Animator);
lua_pushnumber(L, lovrAnimatorGetAnimationCount(animator));
return 1;
}
int l_lovrAnimatorGetAnimationNames(lua_State* L) {
static int l_lovrAnimatorGetAnimationNames(lua_State* L) {
Animator* animator = luax_checktype(L, 1, Animator);
int animationCount = lovrAnimatorGetAnimationCount(animator);
@ -58,35 +58,35 @@ int l_lovrAnimatorGetAnimationNames(lua_State* L) {
return 1;
}
int l_lovrAnimatorPlay(lua_State* L) {
static int l_lovrAnimatorPlay(lua_State* L) {
Animator* animator = luax_checktype(L, 1, Animator);
int animation = luax_checkanimation(L, 2, animator);
lovrAnimatorPlay(animator, animation);
return 0;
}
int l_lovrAnimatorStop(lua_State* L) {
static int l_lovrAnimatorStop(lua_State* L) {
Animator* animator = luax_checktype(L, 1, Animator);
int animation = luax_checkanimation(L, 2, animator);
lovrAnimatorStop(animator, animation);
return 0;
}
int l_lovrAnimatorPause(lua_State* L) {
static int l_lovrAnimatorPause(lua_State* L) {
Animator* animator = luax_checktype(L, 1, Animator);
int animation = luax_checkanimation(L, 2, animator);
lovrAnimatorPause(animator, animation);
return 0;
}
int l_lovrAnimatorResume(lua_State* L) {
static int l_lovrAnimatorResume(lua_State* L) {
Animator* animator = luax_checktype(L, 1, Animator);
int animation = luax_checkanimation(L, 2, animator);
lovrAnimatorResume(animator, animation);
return 0;
}
int l_lovrAnimatorSeek(lua_State* L) {
static int l_lovrAnimatorSeek(lua_State* L) {
Animator* animator = luax_checktype(L, 1, Animator);
int animation = luax_checkanimation(L, 2, animator);
float time = luax_checkfloat(L, 3);
@ -94,7 +94,7 @@ int l_lovrAnimatorSeek(lua_State* L) {
return 0;
}
int l_lovrAnimatorTell(lua_State* L) {
static int l_lovrAnimatorTell(lua_State* L) {
Animator* animator = luax_checktype(L, 1, Animator);
int animation = luax_checkanimation(L, 2, animator);
float time = lovrAnimatorTell(animator, animation);
@ -102,7 +102,7 @@ int l_lovrAnimatorTell(lua_State* L) {
return 1;
}
int l_lovrAnimatorGetAlpha(lua_State* L) {
static int l_lovrAnimatorGetAlpha(lua_State* L) {
Animator* animator = luax_checktype(L, 1, Animator);
int animation = luax_checkanimation(L, 2, animator);
float alpha = lovrAnimatorGetAlpha(animator, animation);
@ -110,7 +110,7 @@ int l_lovrAnimatorGetAlpha(lua_State* L) {
return 1;
}
int l_lovrAnimatorSetAlpha(lua_State* L) {
static int l_lovrAnimatorSetAlpha(lua_State* L) {
Animator* animator = luax_checktype(L, 1, Animator);
int animation = luax_checkanimation(L, 2, animator);
float alpha = luax_checkfloat(L, 3);
@ -118,7 +118,7 @@ int l_lovrAnimatorSetAlpha(lua_State* L) {
return 0;
}
int l_lovrAnimatorGetDuration(lua_State* L) {
static int l_lovrAnimatorGetDuration(lua_State* L) {
Animator* animator = luax_checktype(L, 1, Animator);
int animation = luax_checkanimation(L, 2, animator);
float duration = lovrAnimatorGetDuration(animator, animation);
@ -126,7 +126,7 @@ int l_lovrAnimatorGetDuration(lua_State* L) {
return 1;
}
int l_lovrAnimatorIsPlaying(lua_State* L) {
static int l_lovrAnimatorIsPlaying(lua_State* L) {
Animator* animator = luax_checktype(L, 1, Animator);
int animation = luax_checkanimation(L, 2, animator);
bool playing = lovrAnimatorIsPlaying(animator, animation);
@ -134,7 +134,7 @@ int l_lovrAnimatorIsPlaying(lua_State* L) {
return 1;
}
int l_lovrAnimatorIsLooping(lua_State* L) {
static int l_lovrAnimatorIsLooping(lua_State* L) {
Animator* animator = luax_checktype(L, 1, Animator);
int animation = luax_checkanimation(L, 2, animator);
bool looping = lovrAnimatorIsLooping(animator, animation);
@ -142,7 +142,7 @@ int l_lovrAnimatorIsLooping(lua_State* L) {
return 1;
}
int l_lovrAnimatorSetLooping(lua_State* L) {
static int l_lovrAnimatorSetLooping(lua_State* L) {
Animator* animator = luax_checktype(L, 1, Animator);
int animation = luax_checkanimation(L, 2, animator);
bool looping = lua_toboolean(L, 3);
@ -150,7 +150,7 @@ int l_lovrAnimatorSetLooping(lua_State* L) {
return 0;
}
int l_lovrAnimatorGetPriority(lua_State* L) {
static int l_lovrAnimatorGetPriority(lua_State* L) {
Animator* animator = luax_checktype(L, 1, Animator);
int animation = luax_checkanimation(L, 2, animator);
int priority = lovrAnimatorGetPriority(animator, animation);
@ -158,7 +158,7 @@ int l_lovrAnimatorGetPriority(lua_State* L) {
return 1;
}
int l_lovrAnimatorSetPriority(lua_State* L) {
static int l_lovrAnimatorSetPriority(lua_State* L) {
Animator* animator = luax_checktype(L, 1, Animator);
int animation = luax_checkanimation(L, 2, animator);
int priority = luaL_checkinteger(L, 3);
@ -166,7 +166,7 @@ int l_lovrAnimatorSetPriority(lua_State* L) {
return 0;
}
int l_lovrAnimatorGetSpeed(lua_State* L) {
static int l_lovrAnimatorGetSpeed(lua_State* L) {
Animator* animator = luax_checktype(L, 1, Animator);
if (lua_isnoneornil(L, 2)) {
float speed = lovrAnimatorGetSpeed(animator, -1);
@ -179,7 +179,7 @@ int l_lovrAnimatorGetSpeed(lua_State* L) {
return 1;
}
int l_lovrAnimatorSetSpeed(lua_State* L) {
static int l_lovrAnimatorSetSpeed(lua_State* L) {
Animator* animator = luax_checktype(L, 1, Animator);
if (lua_isnoneornil(L, 2)) {
float speed = luax_checkfloat(L, 2);

View File

@ -2,7 +2,7 @@
#include "data/audioStream.h"
#include "data/soundData.h"
int l_lovrAudioStreamDecode(lua_State* L) {
static int l_lovrAudioStreamDecode(lua_State* L) {
AudioStream* stream = luax_checktype(L, 1, AudioStream);
int samples = lovrAudioStreamDecode(stream, NULL, 0);
if (samples > 0) {
@ -16,25 +16,25 @@ int l_lovrAudioStreamDecode(lua_State* L) {
return 1;
}
int l_lovrAudioStreamGetBitDepth(lua_State* L) {
static int l_lovrAudioStreamGetBitDepth(lua_State* L) {
AudioStream* stream = luax_checktype(L, 1, AudioStream);
lua_pushinteger(L, stream->bitDepth);
return 1;
}
int l_lovrAudioStreamGetChannelCount(lua_State* L) {
static int l_lovrAudioStreamGetChannelCount(lua_State* L) {
AudioStream* stream = luax_checktype(L, 1, AudioStream);
lua_pushinteger(L, stream->channelCount);
return 1;
}
int l_lovrAudioStreamGetDuration(lua_State* L) {
static int l_lovrAudioStreamGetDuration(lua_State* L) {
AudioStream* stream = luax_checktype(L, 1, AudioStream);
lua_pushnumber(L, (float) stream->samples / stream->sampleRate);
return 1;
}
int l_lovrAudioStreamGetSampleRate(lua_State* L) {
static int l_lovrAudioStreamGetSampleRate(lua_State* L) {
AudioStream* stream = luax_checktype(L, 1, AudioStream);
lua_pushinteger(L, stream->sampleRate);
return 1;

View File

@ -1,25 +1,25 @@
#include "api.h"
#include "data/blob.h"
int l_lovrBlobGetName(lua_State* L) {
static int l_lovrBlobGetName(lua_State* L) {
Blob* blob = luax_checktype(L, 1, Blob);
lua_pushstring(L, blob->name);
return 1;
}
int l_lovrBlobGetPointer(lua_State* L) {
static int l_lovrBlobGetPointer(lua_State* L) {
Blob* blob = luax_checktype(L, 1, Blob);
lua_pushlightuserdata(L, blob->data);
return 1;
}
int l_lovrBlobGetSize(lua_State* L) {
static int l_lovrBlobGetSize(lua_State* L) {
Blob* blob = luax_checktype(L, 1, Blob);
lua_pushinteger(L, blob->size);
return 1;
}
int l_lovrBlobGetString(lua_State* L) {
static int l_lovrBlobGetString(lua_State* L) {
Blob* blob = luax_checktype(L, 1, Blob);
lua_pushlstring(L, blob->data, blob->size);
return 1;

View File

@ -61,7 +61,7 @@ void luax_readattachments(lua_State* L, int index, Attachment* attachments, int*
}
}
int l_lovrCanvasNewTextureData(lua_State* L) {
static int l_lovrCanvasNewTextureData(lua_State* L) {
Canvas* canvas = luax_checktype(L, 1, Canvas);
int index = luaL_optinteger(L, 2, 1) - 1;
int count;
@ -73,7 +73,7 @@ int l_lovrCanvasNewTextureData(lua_State* L) {
return 1;
}
int l_lovrCanvasRenderTo(lua_State* L) {
static int l_lovrCanvasRenderTo(lua_State* L) {
Canvas* canvas = luax_checktype(L, 1, Canvas);
luaL_checktype(L, 2, LUA_TFUNCTION);
int argumentCount = lua_gettop(L) - 2;
@ -84,7 +84,7 @@ int l_lovrCanvasRenderTo(lua_State* L) {
return 0;
}
int l_lovrCanvasGetTexture(lua_State* L) {
static int l_lovrCanvasGetTexture(lua_State* L) {
Canvas* canvas = luax_checktype(L, 1, Canvas);
int count;
const Attachment* attachments = lovrCanvasGetAttachments(canvas, &count);
@ -94,7 +94,7 @@ int l_lovrCanvasGetTexture(lua_State* L) {
return count;
}
int l_lovrCanvasSetTexture(lua_State* L) {
static int l_lovrCanvasSetTexture(lua_State* L) {
Canvas* canvas = luax_checktype(L, 1, Canvas);
Attachment attachments[MAX_CANVAS_ATTACHMENTS];
int count;
@ -103,40 +103,40 @@ int l_lovrCanvasSetTexture(lua_State* L) {
return 0;
}
int l_lovrCanvasGetWidth(lua_State* L) {
static int l_lovrCanvasGetWidth(lua_State* L) {
Canvas* canvas = luax_checktype(L, 1, Canvas);
lua_pushinteger(L, lovrCanvasGetWidth(canvas));
return 1;
}
int l_lovrCanvasGetHeight(lua_State* L) {
static int l_lovrCanvasGetHeight(lua_State* L) {
Canvas* canvas = luax_checktype(L, 1, Canvas);
lua_pushinteger(L, lovrCanvasGetHeight(canvas));
return 1;
}
int l_lovrCanvasGetDimensions(lua_State* L) {
static int l_lovrCanvasGetDimensions(lua_State* L) {
Canvas* canvas = luax_checktype(L, 1, Canvas);
lua_pushinteger(L, lovrCanvasGetWidth(canvas));
lua_pushinteger(L, lovrCanvasGetHeight(canvas));
return 2;
}
int l_lovrCanvasGetDepthTexture(lua_State* L) {
static int l_lovrCanvasGetDepthTexture(lua_State* L) {
Canvas* canvas = luax_checktype(L, 1, Canvas);
Texture* texture = lovrCanvasGetDepthTexture(canvas);
luax_pushobject(L, texture);
return 1;
}
int l_lovrCanvasGetMSAA(lua_State* L) {
static int l_lovrCanvasGetMSAA(lua_State* L) {
Canvas* canvas = luax_checktype(L, 1, Canvas);
int msaa = lovrCanvasGetMSAA(canvas);
lua_pushinteger(L, msaa);
return 1;
}
int l_lovrCanvasIsStereo(lua_State* L) {
static int l_lovrCanvasIsStereo(lua_State* L) {
Canvas* canvas = luax_checktype(L, 1, Canvas);
bool stereo = lovrCanvasIsStereo(canvas);
lua_pushboolean(L, stereo);

View File

@ -18,7 +18,7 @@ static void luax_checktimeout(lua_State* L, int index, double* timeout) {
}
}
int l_lovrChannelPush(lua_State* L) {
static int l_lovrChannelPush(lua_State* L) {
Variant variant;
double timeout;
Channel* channel = luax_checktype(L, 1, Channel);
@ -31,7 +31,7 @@ int l_lovrChannelPush(lua_State* L) {
return 2;
}
int l_lovrChannelPop(lua_State* L) {
static int l_lovrChannelPop(lua_State* L) {
Variant variant;
double timeout;
Channel* channel = luax_checktype(L, 1, Channel);
@ -45,7 +45,7 @@ int l_lovrChannelPop(lua_State* L) {
return 1;
}
int l_lovrChannelPeek(lua_State* L) {
static int l_lovrChannelPeek(lua_State* L) {
Variant variant;
Channel* channel = luax_checktype(L, 1, Channel);
if (lovrChannelPeek(channel, &variant)) {
@ -55,19 +55,19 @@ int l_lovrChannelPeek(lua_State* L) {
return 1;
}
int l_lovrChannelClear(lua_State* L) {
static int l_lovrChannelClear(lua_State* L) {
Channel* channel = luax_checktype(L, 1, Channel);
lovrChannelClear(channel);
return 0;
}
int l_lovrChannelGetCount(lua_State* L) {
static int l_lovrChannelGetCount(lua_State* L) {
Channel* channel = luax_checktype(L, 1, Channel);
lua_pushinteger(L, lovrChannelGetCount(channel));
return 1;
}
int l_lovrChannelHasRead(lua_State* L) {
static int l_lovrChannelHasRead(lua_State* L) {
Channel* channel = luax_checktype(L, 1, Channel);
uint64_t id = luaL_checkinteger(L, 2);
lua_pushboolean(L, lovrChannelHasRead(channel, id));

View File

@ -2,34 +2,34 @@
#include "physics/physics.h"
#include <stdbool.h>
int l_lovrColliderDestroy(lua_State* L) {
static int l_lovrColliderDestroy(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
lovrColliderDestroyData(collider);
return 0;
}
int l_lovrColliderGetWorld(lua_State* L) {
static int l_lovrColliderGetWorld(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
World* world = lovrColliderGetWorld(collider);
luax_pushobject(L, world);
return 1;
}
int l_lovrColliderAddShape(lua_State* L) {
static int l_lovrColliderAddShape(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
Shape* shape = luax_checktype(L, 2, Shape);
lovrColliderAddShape(collider, shape);
return 0;
}
int l_lovrColliderRemoveShape(lua_State* L) {
static int l_lovrColliderRemoveShape(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
Shape* shape = luax_checktype(L, 2, Shape);
lovrColliderRemoveShape(collider, shape);
return 0;
}
int l_lovrColliderGetShapes(lua_State* L) {
static int l_lovrColliderGetShapes(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
lua_newtable(L);
vec_void_t* shapes = lovrColliderGetShapes(collider);
@ -40,7 +40,7 @@ int l_lovrColliderGetShapes(lua_State* L) {
return 1;
}
int l_lovrColliderGetJoints(lua_State* L) {
static int l_lovrColliderGetJoints(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
lua_newtable(L);
vec_void_t* joints = lovrColliderGetJoints(collider);
@ -51,14 +51,14 @@ int l_lovrColliderGetJoints(lua_State* L) {
return 1;
}
int l_lovrColliderGetUserData(lua_State* L) {
static int l_lovrColliderGetUserData(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
int ref = (int) lovrColliderGetUserData(collider);
lua_rawgeti(L, LUA_REGISTRYINDEX, ref);
return 1;
}
int l_lovrColliderSetUserData(lua_State* L) {
static int l_lovrColliderSetUserData(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
uint64_t ref = (int) lovrColliderGetUserData(collider);
if (ref) {
@ -75,72 +75,72 @@ int l_lovrColliderSetUserData(lua_State* L) {
return 0;
}
int l_lovrColliderIsKinematic(lua_State* L) {
static int l_lovrColliderIsKinematic(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
lua_pushboolean(L, lovrColliderIsKinematic(collider));
return 1;
}
int l_lovrColliderSetKinematic(lua_State* L) {
static int l_lovrColliderSetKinematic(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
bool kinematic = lua_toboolean(L, 2);
lovrColliderSetKinematic(collider, kinematic);
return 0;
}
int l_lovrColliderIsGravityIgnored(lua_State* L) {
static int l_lovrColliderIsGravityIgnored(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
lua_pushboolean(L, lovrColliderIsGravityIgnored(collider));
return 1;
}
int l_lovrColliderSetGravityIgnored(lua_State* L) {
static int l_lovrColliderSetGravityIgnored(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
bool ignored = lua_toboolean(L, 2);
lovrColliderSetGravityIgnored(collider, ignored);
return 0;
}
int l_lovrColliderIsAwake(lua_State* L) {
static int l_lovrColliderIsAwake(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
lua_pushboolean(L, lovrColliderIsAwake(collider));
return 1;
}
int l_lovrColliderSetAwake(lua_State* L) {
static int l_lovrColliderSetAwake(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
bool awake = lua_toboolean(L, 2);
lovrColliderSetAwake(collider, awake);
return 0;
}
int l_lovrColliderIsSleepingAllowed(lua_State* L) {
static int l_lovrColliderIsSleepingAllowed(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
lua_pushboolean(L, lovrColliderIsSleepingAllowed(collider));
return 1;
}
int l_lovrColliderSetSleepingAllowed(lua_State* L) {
static int l_lovrColliderSetSleepingAllowed(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
bool allowed = lua_toboolean(L, 2);
lovrColliderSetSleepingAllowed(collider, allowed);
return 0;
}
int l_lovrColliderGetMass(lua_State* L) {
static int l_lovrColliderGetMass(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
lua_pushnumber(L, lovrColliderGetMass(collider));
return 1;
}
int l_lovrColliderSetMass(lua_State* L) {
static int l_lovrColliderSetMass(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
float mass = luax_checkfloat(L, 2);
lovrColliderSetMass(collider, mass);
return 0;
}
int l_lovrColliderGetMassData(lua_State* L) {
static int l_lovrColliderGetMassData(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
float cx, cy, cz, mass;
float inertia[6];
@ -157,7 +157,7 @@ int l_lovrColliderGetMassData(lua_State* L) {
return 5;
}
int l_lovrColliderSetMassData(lua_State* L) {
static int l_lovrColliderSetMassData(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
float cx = luax_checkfloat(L, 2);
float cy = luax_checkfloat(L, 3);
@ -187,7 +187,7 @@ int l_lovrColliderSetMassData(lua_State* L) {
return 0;
}
int l_lovrColliderGetPosition(lua_State* L) {
static int l_lovrColliderGetPosition(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
float x, y, z;
lovrColliderGetPosition(collider, &x, &y, &z);
@ -197,7 +197,7 @@ int l_lovrColliderGetPosition(lua_State* L) {
return 3;
}
int l_lovrColliderSetPosition(lua_State* L) {
static int l_lovrColliderSetPosition(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
float x = luax_checkfloat(L, 2);
float y = luax_checkfloat(L, 3);
@ -206,7 +206,7 @@ int l_lovrColliderSetPosition(lua_State* L) {
return 0;
}
int l_lovrColliderGetOrientation(lua_State* L) {
static int l_lovrColliderGetOrientation(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
float angle, x, y, z;
lovrColliderGetOrientation(collider, &angle, &x, &y, &z);
@ -217,7 +217,7 @@ int l_lovrColliderGetOrientation(lua_State* L) {
return 4;
}
int l_lovrColliderSetOrientation(lua_State* L) {
static int l_lovrColliderSetOrientation(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
float angle = luax_checkfloat(L, 2);
float x = luax_checkfloat(L, 3);
@ -227,7 +227,7 @@ int l_lovrColliderSetOrientation(lua_State* L) {
return 0;
}
int l_lovrColliderGetLinearVelocity(lua_State* L) {
static int l_lovrColliderGetLinearVelocity(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
float x, y, z;
lovrColliderGetLinearVelocity(collider, &x, &y, &z);
@ -237,7 +237,7 @@ int l_lovrColliderGetLinearVelocity(lua_State* L) {
return 3;
}
int l_lovrColliderSetLinearVelocity(lua_State* L) {
static int l_lovrColliderSetLinearVelocity(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
float x = luax_checkfloat(L, 2);
float y = luax_checkfloat(L, 3);
@ -246,7 +246,7 @@ int l_lovrColliderSetLinearVelocity(lua_State* L) {
return 0;
}
int l_lovrColliderGetAngularVelocity(lua_State* L) {
static int l_lovrColliderGetAngularVelocity(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
float x, y, z;
lovrColliderGetAngularVelocity(collider, &x, &y, &z);
@ -256,7 +256,7 @@ int l_lovrColliderGetAngularVelocity(lua_State* L) {
return 3;
}
int l_lovrColliderSetAngularVelocity(lua_State* L) {
static int l_lovrColliderSetAngularVelocity(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
float x = luax_checkfloat(L, 2);
float y = luax_checkfloat(L, 3);
@ -265,7 +265,7 @@ int l_lovrColliderSetAngularVelocity(lua_State* L) {
return 0;
}
int l_lovrColliderGetLinearDamping(lua_State* L) {
static int l_lovrColliderGetLinearDamping(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
float damping, threshold;
lovrColliderGetLinearDamping(collider, &damping, &threshold);
@ -274,7 +274,7 @@ int l_lovrColliderGetLinearDamping(lua_State* L) {
return 2;
}
int l_lovrColliderSetLinearDamping(lua_State* L) {
static int l_lovrColliderSetLinearDamping(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
float damping = luax_checkfloat(L, 2);
float threshold = luax_optfloat(L, 3, .01f);
@ -282,7 +282,7 @@ int l_lovrColliderSetLinearDamping(lua_State* L) {
return 0;
}
int l_lovrColliderGetAngularDamping(lua_State* L) {
static int l_lovrColliderGetAngularDamping(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
float damping, threshold;
lovrColliderGetAngularDamping(collider, &damping, &threshold);
@ -291,7 +291,7 @@ int l_lovrColliderGetAngularDamping(lua_State* L) {
return 2;
}
int l_lovrColliderSetAngularDamping(lua_State* L) {
static int l_lovrColliderSetAngularDamping(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
float damping = luax_checkfloat(L, 2);
float threshold = luax_optfloat(L, 3, .01f);
@ -299,7 +299,7 @@ int l_lovrColliderSetAngularDamping(lua_State* L) {
return 0;
}
int l_lovrColliderApplyForce(lua_State* L) {
static int l_lovrColliderApplyForce(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
float x = luax_checkfloat(L, 2);
float y = luax_checkfloat(L, 3);
@ -317,7 +317,7 @@ int l_lovrColliderApplyForce(lua_State* L) {
return 0;
}
int l_lovrColliderApplyTorque(lua_State* L) {
static int l_lovrColliderApplyTorque(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
float x = luax_checkfloat(L, 2);
float y = luax_checkfloat(L, 3);
@ -326,7 +326,7 @@ int l_lovrColliderApplyTorque(lua_State* L) {
return 0;
}
int l_lovrColliderGetLocalCenter(lua_State* L) {
static int l_lovrColliderGetLocalCenter(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
float x, y, z;
lovrColliderGetLocalCenter(collider, &x, &y, &z);
@ -336,7 +336,7 @@ int l_lovrColliderGetLocalCenter(lua_State* L) {
return 3;
}
int l_lovrColliderGetLocalPoint(lua_State* L) {
static int l_lovrColliderGetLocalPoint(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
float wx = luax_checkfloat(L, 2);
float wy = luax_checkfloat(L, 3);
@ -349,7 +349,7 @@ int l_lovrColliderGetLocalPoint(lua_State* L) {
return 3;
}
int l_lovrColliderGetWorldPoint(lua_State* L) {
static int l_lovrColliderGetWorldPoint(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
float x = luax_checkfloat(L, 2);
float y = luax_checkfloat(L, 3);
@ -362,7 +362,7 @@ int l_lovrColliderGetWorldPoint(lua_State* L) {
return 3;
}
int l_lovrColliderGetLocalVector(lua_State* L) {
static int l_lovrColliderGetLocalVector(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
float wx = luax_checkfloat(L, 2);
float wy = luax_checkfloat(L, 3);
@ -375,7 +375,7 @@ int l_lovrColliderGetLocalVector(lua_State* L) {
return 3;
}
int l_lovrColliderGetWorldVector(lua_State* L) {
static int l_lovrColliderGetWorldVector(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
float x = luax_checkfloat(L, 2);
float y = luax_checkfloat(L, 3);
@ -388,7 +388,7 @@ int l_lovrColliderGetWorldVector(lua_State* L) {
return 3;
}
int l_lovrColliderGetLinearVelocityFromLocalPoint(lua_State* L) {
static int l_lovrColliderGetLinearVelocityFromLocalPoint(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
float x = luax_checkfloat(L, 2);
float y = luax_checkfloat(L, 3);
@ -401,7 +401,7 @@ int l_lovrColliderGetLinearVelocityFromLocalPoint(lua_State* L) {
return 3;
}
int l_lovrColliderGetLinearVelocityFromWorldPoint(lua_State* L) {
static int l_lovrColliderGetLinearVelocityFromWorldPoint(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
float x = luax_checkfloat(L, 2);
float y = luax_checkfloat(L, 3);
@ -414,7 +414,7 @@ int l_lovrColliderGetLinearVelocityFromWorldPoint(lua_State* L) {
return 3;
}
int l_lovrColliderGetAABB(lua_State* L) {
static int l_lovrColliderGetAABB(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
float aabb[6];
lovrColliderGetAABB(collider, aabb);
@ -424,39 +424,39 @@ int l_lovrColliderGetAABB(lua_State* L) {
return 6;
}
int l_lovrColliderGetFriction(lua_State* L) {
static int l_lovrColliderGetFriction(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
lua_pushnumber(L, lovrColliderGetFriction(collider));
return 1;
}
int l_lovrColliderSetFriction(lua_State* L) {
static int l_lovrColliderSetFriction(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
float friction = luax_checkfloat(L, 2);
lovrColliderSetFriction(collider, friction);
return 0;
}
int l_lovrColliderGetRestitution(lua_State* L) {
static int l_lovrColliderGetRestitution(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
lua_pushnumber(L, lovrColliderGetRestitution(collider));
return 1;
}
int l_lovrColliderSetRestitution(lua_State* L) {
static int l_lovrColliderSetRestitution(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
float restitution = luax_checkfloat(L, 2);
lovrColliderSetRestitution(collider, restitution);
return 0;
}
int l_lovrColliderGetTag(lua_State* L) {
static int l_lovrColliderGetTag(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
lua_pushstring(L, lovrColliderGetTag(collider));
return 1;
}
int l_lovrColliderSetTag(lua_State* L) {
static int l_lovrColliderSetTag(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
if (lua_isnoneornil(L, 2)) {
lovrColliderSetTag(collider, NULL);

View File

@ -4,20 +4,20 @@
#include "data/modelData.h"
#include "graphics/model.h"
int l_lovrControllerIsConnected(lua_State* L) {
static int l_lovrControllerIsConnected(lua_State* L) {
Controller* controller = luax_checktype(L, 1, Controller);
lua_pushboolean(L, lovrHeadsetDriver->controllerIsConnected(controller));
return 1;
}
int l_lovrControllerGetHand(lua_State* L) {
static int l_lovrControllerGetHand(lua_State* L) {
Controller* controller = luax_checktype(L, 1, Controller);
ControllerHand hand = lovrHeadsetDriver->controllerGetHand(controller);
lua_pushstring(L, ControllerHands[hand]);
return 1;
}
int l_lovrControllerGetPose(lua_State* L) {
static int l_lovrControllerGetPose(lua_State* L) {
Controller* controller = luax_checktype(L, 1, Controller);
float x, y, z, angle, ax, ay, az;
lovrHeadsetDriver->controllerGetPose(controller, &x, &y, &z, &angle, &ax, &ay, &az);
@ -31,7 +31,7 @@ int l_lovrControllerGetPose(lua_State* L) {
return 7;
}
int l_lovrControllerGetPosition(lua_State* L) {
static int l_lovrControllerGetPosition(lua_State* L) {
Controller* controller = luax_checktype(L, 1, Controller);
float position[3], angle, ax, ay, az;
lovrHeadsetDriver->controllerGetPose(controller, &position[0], &position[1], &position[2], &angle, &ax, &ay, &az);
@ -41,7 +41,7 @@ int l_lovrControllerGetPosition(lua_State* L) {
return 3;
}
int l_lovrControllerGetOrientation(lua_State* L) {
static int l_lovrControllerGetOrientation(lua_State* L) {
Controller* controller = luax_checktype(L, 1, Controller);
float x, y, z, angle, ax, ay, az;
lovrHeadsetDriver->controllerGetPose(controller, &x, &y, &z, &angle, &ax, &ay, &az);
@ -52,7 +52,7 @@ int l_lovrControllerGetOrientation(lua_State* L) {
return 4;
}
int l_lovrControllerGetVelocity(lua_State* L) {
static int l_lovrControllerGetVelocity(lua_State* L) {
Controller* controller = luax_checktype(L, 1, Controller);
float velocity[3];
lovrHeadsetDriver->controllerGetVelocity(controller, &velocity[0], &velocity[1], &velocity[2]);
@ -62,7 +62,7 @@ int l_lovrControllerGetVelocity(lua_State* L) {
return 3;
}
int l_lovrControllerGetAngularVelocity(lua_State* L) {
static int l_lovrControllerGetAngularVelocity(lua_State* L) {
Controller* controller = luax_checktype(L, 1, Controller);
float velocity[3];
lovrHeadsetDriver->controllerGetAngularVelocity(controller, &velocity[0], &velocity[1], &velocity[2]);
@ -72,28 +72,28 @@ int l_lovrControllerGetAngularVelocity(lua_State* L) {
return 3;
}
int l_lovrControllerGetAxis(lua_State* L) {
static int l_lovrControllerGetAxis(lua_State* L) {
Controller* controller = luax_checktype(L, 1, Controller);
ControllerAxis axis = luaL_checkoption(L, 2, NULL, ControllerAxes);
lua_pushnumber(L, lovrHeadsetDriver->controllerGetAxis(controller, axis));
return 1;
}
int l_lovrControllerIsDown(lua_State* L) {
static int l_lovrControllerIsDown(lua_State* L) {
Controller* controller = luax_checktype(L, 1, Controller);
ControllerButton button = luaL_checkoption(L, 2, NULL, ControllerButtons);
lua_pushboolean(L, lovrHeadsetDriver->controllerIsDown(controller, button));
return 1;
}
int l_lovrControllerIsTouched(lua_State* L) {
static int l_lovrControllerIsTouched(lua_State* L) {
Controller* controller = luax_checktype(L, 1, Controller);
ControllerButton button = luaL_checkoption(L, 2, NULL, ControllerButtons);
lua_pushboolean(L, lovrHeadsetDriver->controllerIsTouched(controller, button));
return 1;
}
int l_lovrControllerVibrate(lua_State* L) {
static int l_lovrControllerVibrate(lua_State* L) {
Controller* controller = luax_checktype(L, 1, Controller);
float duration = luax_optfloat(L, 2, .5f);
float power = luax_optfloat(L, 3, 1.f);
@ -101,7 +101,7 @@ int l_lovrControllerVibrate(lua_State* L) {
return 0;
}
int l_lovrControllerNewModel(lua_State* L) {
static int l_lovrControllerNewModel(lua_State* L) {
Controller* controller = luax_checktype(L, 1, Controller);
ModelData* modelData = lovrHeadsetDriver->controllerNewModelData(controller);
if (modelData) {

View File

@ -2,7 +2,7 @@
#include "api/math.h"
#include "math/curve.h"
int l_lovrCurveEvaluate(lua_State* L) {
static int l_lovrCurveEvaluate(lua_State* L) {
Curve* curve = luax_checktype(L, 1, Curve);
float t = luax_checkfloat(L, 2);
float point[3];
@ -13,7 +13,7 @@ int l_lovrCurveEvaluate(lua_State* L) {
return 3;
}
int l_lovrCurveGetTangent(lua_State* L) {
static int l_lovrCurveGetTangent(lua_State* L) {
Curve* curve = luax_checktype(L, 1, Curve);
float t = luax_checkfloat(L, 2);
float point[3];
@ -24,7 +24,7 @@ int l_lovrCurveGetTangent(lua_State* L) {
return 3;
}
int l_lovrCurveRender(lua_State* L) {
static int l_lovrCurveRender(lua_State* L) {
Curve* curve = luax_checktype(L, 1, Curve);
int n = luaL_optinteger(L, 2, 32);
float t1 = luax_optfloat(L, 3, 0.);
@ -41,7 +41,7 @@ int l_lovrCurveRender(lua_State* L) {
return 1;
}
int l_lovrCurveSlice(lua_State* L) {
static int l_lovrCurveSlice(lua_State* L) {
Curve* curve = luax_checktype(L, 1, Curve);
float t1 = luax_checkfloat(L, 2);
float t2 = luax_checkfloat(L, 3);
@ -50,13 +50,13 @@ int l_lovrCurveSlice(lua_State* L) {
return 1;
}
int l_lovrCurveGetPointCount(lua_State* L) {
static int l_lovrCurveGetPointCount(lua_State* L) {
Curve* curve = luax_checktype(L, 1, Curve);
lua_pushinteger(L, lovrCurveGetPointCount(curve));
return 1;
}
int l_lovrCurveGetPoint(lua_State* L) {
static int l_lovrCurveGetPoint(lua_State* L) {
Curve* curve = luax_checktype(L, 1, Curve);
int index = luaL_checkinteger(L, 2) - 1;
lovrAssert(index >= 0 && index < lovrCurveGetPointCount(curve), "Invalid Curve point index: %d", index + 1);
@ -68,7 +68,7 @@ int l_lovrCurveGetPoint(lua_State* L) {
return 3;
}
int l_lovrCurveSetPoint(lua_State* L) {
static int l_lovrCurveSetPoint(lua_State* L) {
Curve* curve = luax_checktype(L, 1, Curve);
int index = luaL_checkinteger(L, 2) - 1;
lovrAssert(index >= 0 && index < lovrCurveGetPointCount(curve), "Invalid Curve point index: %d", index + 1);
@ -78,7 +78,7 @@ int l_lovrCurveSetPoint(lua_State* L) {
return 0;
}
int l_lovrCurveAddPoint(lua_State* L) {
static int l_lovrCurveAddPoint(lua_State* L) {
Curve* curve = luax_checktype(L, 1, Curve);
float point[3];
int i = luax_readvec3(L, 2, point, NULL);
@ -88,7 +88,7 @@ int l_lovrCurveAddPoint(lua_State* L) {
return 0;
}
int l_lovrCurveRemovePoint(lua_State* L) {
static int l_lovrCurveRemovePoint(lua_State* L) {
Curve* curve = luax_checktype(L, 1, Curve);
int index = luaL_checkinteger(L, 2) - 1;
lovrAssert(index >= 0 && index < lovrCurveGetPointCount(curve), "Invalid Curve point index: %d", index + 1);

View File

@ -1,7 +1,7 @@
#include "api.h"
#include "graphics/font.h"
int l_lovrFontGetWidth(lua_State* L) {
static int l_lovrFontGetWidth(lua_State* L) {
Font* font = luax_checktype(L, 1, Font);
size_t length;
const char* string = luaL_checklstring(L, 2, &length);
@ -14,62 +14,62 @@ int l_lovrFontGetWidth(lua_State* L) {
return 1;
}
int l_lovrFontGetHeight(lua_State* L) {
static int l_lovrFontGetHeight(lua_State* L) {
Font* font = luax_checktype(L, 1, Font);
lua_pushnumber(L, lovrFontGetHeight(font));
return 1;
}
int l_lovrFontGetAscent(lua_State* L) {
static int l_lovrFontGetAscent(lua_State* L) {
Font* font = luax_checktype(L, 1, Font);
lua_pushnumber(L, lovrFontGetAscent(font));
return 1;
}
int l_lovrFontGetDescent(lua_State* L) {
static int l_lovrFontGetDescent(lua_State* L) {
Font* font = luax_checktype(L, 1, Font);
lua_pushnumber(L, lovrFontGetDescent(font));
return 1;
}
int l_lovrFontGetBaseline(lua_State* L) {
static int l_lovrFontGetBaseline(lua_State* L) {
Font* font = luax_checktype(L, 1, Font);
lua_pushnumber(L, lovrFontGetBaseline(font));
return 1;
}
int l_lovrFontGetLineHeight(lua_State* L) {
static int l_lovrFontGetLineHeight(lua_State* L) {
Font* font = luax_checktype(L, 1, Font);
lua_pushinteger(L, lovrFontGetLineHeight(font));
return 1;
}
int l_lovrFontSetLineHeight(lua_State* L) {
static int l_lovrFontSetLineHeight(lua_State* L) {
Font* font = luax_checktype(L, 1, Font);
float lineHeight = luax_checkfloat(L, 2);
lovrFontSetLineHeight(font, lineHeight);
return 0;
}
int l_lovrFontIsFlipEnabled(lua_State* L) {
static int l_lovrFontIsFlipEnabled(lua_State* L) {
Font* font = luax_checktype(L, 1, Font);
lua_pushboolean(L, lovrFontIsFlipEnabled(font));
return 1;
}
int l_lovrFontSetFlipEnabled(lua_State* L) {
static int l_lovrFontSetFlipEnabled(lua_State* L) {
Font* font = luax_checktype(L, 1, Font);
lovrFontSetFlipEnabled(font, lua_toboolean(L, 2));
return 0;
}
int l_lovrFontGetPixelDensity(lua_State* L) {
static int l_lovrFontGetPixelDensity(lua_State* L) {
Font* font = luax_checktype(L, 1, Font);
lua_pushnumber(L, lovrFontGetPixelDensity(font));
return 1;
}
int l_lovrFontSetPixelDensity(lua_State* L) {
static int l_lovrFontSetPixelDensity(lua_State* L) {
Font* font = luax_checktype(L, 1, Font);
if (lua_isnoneornil(L, 2)) {
lovrFontSetPixelDensity(font, lovrFontGetRasterizer(font)->height);
@ -80,13 +80,13 @@ int l_lovrFontSetPixelDensity(lua_State* L) {
return 0;
}
int l_lovrFontGetRasterizer(lua_State* L) {
static int l_lovrFontGetRasterizer(lua_State* L) {
Font* font = luax_checktype(L, 1, Font);
luax_pushobject(L, lovrFontGetRasterizer(font));
return 1;
}
int l_lovrFontHasGlyphs(lua_State* L) {
static int l_lovrFontHasGlyphs(lua_State* L) {
Font* font = luax_checktype(L, 1, Font);
Rasterizer* rasterizer = lovrFontGetRasterizer(font);
bool hasGlyphs = true;

View File

@ -1,19 +1,19 @@
#include "api.h"
#include "physics/physics.h"
int l_lovrJointDestroy(lua_State* L) {
static int l_lovrJointDestroy(lua_State* L) {
Joint* joint = luax_checktype(L, 1, Joint);
lovrJointDestroyData(joint);
return 0;
}
int l_lovrJointGetType(lua_State* L) {
static int l_lovrJointGetType(lua_State* L) {
Joint* joint = luax_checktype(L, 1, Joint);
lua_pushstring(L, JointTypes[lovrJointGetType(joint)]);
return 1;
}
int l_lovrJointGetColliders(lua_State* L) {
static int l_lovrJointGetColliders(lua_State* L) {
Joint* joint = luax_checktype(L, 1, Joint);
Collider* a;
Collider* b;
@ -23,14 +23,14 @@ int l_lovrJointGetColliders(lua_State* L) {
return 2;
}
int l_lovrJointGetUserData(lua_State* L) {
static int l_lovrJointGetUserData(lua_State* L) {
Joint* joint = luax_checktype(L, 1, Joint);
int ref = (int) lovrJointGetUserData(joint);
lua_rawgeti(L, LUA_REGISTRYINDEX, ref);
return 1;
}
int l_lovrJointSetUserData(lua_State* L) {
static int l_lovrJointSetUserData(lua_State* L) {
Joint* joint = luax_checktype(L, 1, Joint);
uint64_t ref = (int) lovrJointGetUserData(joint);
if (ref) {
@ -56,7 +56,7 @@ const luaL_Reg lovrJoint[] = {
{ NULL, NULL }
};
int l_lovrBallJointGetAnchors(lua_State* L) {
static int l_lovrBallJointGetAnchors(lua_State* L) {
BallJoint* joint = luax_checktype(L, 1, BallJoint);
float x1, y1, z1, x2, y2, z2;
lovrBallJointGetAnchors(joint, &x1, &y1, &z1, &x2, &y2, &z2);
@ -69,7 +69,7 @@ int l_lovrBallJointGetAnchors(lua_State* L) {
return 6;
}
int l_lovrBallJointSetAnchor(lua_State* L) {
static int l_lovrBallJointSetAnchor(lua_State* L) {
BallJoint* joint = luax_checktype(L, 1, BallJoint);
float x = luax_checkfloat(L, 2);
float y = luax_checkfloat(L, 3);
@ -84,7 +84,7 @@ const luaL_Reg lovrBallJoint[] = {
{ NULL, NULL }
};
int l_lovrDistanceJointGetAnchors(lua_State* L) {
static int l_lovrDistanceJointGetAnchors(lua_State* L) {
DistanceJoint* joint = luax_checktype(L, 1, DistanceJoint);
float x1, y1, z1, x2, y2, z2;
lovrDistanceJointGetAnchors(joint, &x1, &y1, &z1, &x2, &y2, &z2);
@ -97,7 +97,7 @@ int l_lovrDistanceJointGetAnchors(lua_State* L) {
return 6;
}
int l_lovrDistanceJointSetAnchors(lua_State* L) {
static int l_lovrDistanceJointSetAnchors(lua_State* L) {
DistanceJoint* joint = luax_checktype(L, 1, DistanceJoint);
float x1 = luax_checkfloat(L, 2);
float y1 = luax_checkfloat(L, 3);
@ -109,13 +109,13 @@ int l_lovrDistanceJointSetAnchors(lua_State* L) {
return 0;
}
int l_lovrDistanceJointGetDistance(lua_State* L) {
static int l_lovrDistanceJointGetDistance(lua_State* L) {
DistanceJoint* joint = luax_checktype(L, 1, DistanceJoint);
lua_pushnumber(L, lovrDistanceJointGetDistance(joint));
return 1;
}
int l_lovrDistanceJointSetDistance(lua_State* L) {
static int l_lovrDistanceJointSetDistance(lua_State* L) {
DistanceJoint* joint = luax_checktype(L, 1, DistanceJoint);
float distance = luax_checkfloat(L, 2);
lovrDistanceJointSetDistance(joint, distance);
@ -130,7 +130,7 @@ const luaL_Reg lovrDistanceJoint[] = {
{ NULL, NULL }
};
int l_lovrHingeJointGetAnchors(lua_State* L) {
static int l_lovrHingeJointGetAnchors(lua_State* L) {
HingeJoint* joint = luax_checktype(L, 1, HingeJoint);
float x1, y1, z1, x2, y2, z2;
lovrHingeJointGetAnchors(joint, &x1, &y1, &z1, &x2, &y2, &z2);
@ -143,7 +143,7 @@ int l_lovrHingeJointGetAnchors(lua_State* L) {
return 6;
}
int l_lovrHingeJointSetAnchor(lua_State* L) {
static int l_lovrHingeJointSetAnchor(lua_State* L) {
HingeJoint* joint = luax_checktype(L, 1, HingeJoint);
float x = luax_checkfloat(L, 2);
float y = luax_checkfloat(L, 3);
@ -152,7 +152,7 @@ int l_lovrHingeJointSetAnchor(lua_State* L) {
return 0;
}
int l_lovrHingeJointGetAxis(lua_State* L) {
static int l_lovrHingeJointGetAxis(lua_State* L) {
HingeJoint* joint = luax_checktype(L, 1, HingeJoint);
float x, y, z;
lovrHingeJointGetAxis(joint, &x, &y, &z);
@ -162,7 +162,7 @@ int l_lovrHingeJointGetAxis(lua_State* L) {
return 3;
}
int l_lovrHingeJointSetAxis(lua_State* L) {
static int l_lovrHingeJointSetAxis(lua_State* L) {
HingeJoint* joint = luax_checktype(L, 1, HingeJoint);
float x = luax_checkfloat(L, 2);
float y = luax_checkfloat(L, 3);
@ -171,46 +171,46 @@ int l_lovrHingeJointSetAxis(lua_State* L) {
return 0;
}
int l_lovrHingeJointGetAngle(lua_State* L) {
static int l_lovrHingeJointGetAngle(lua_State* L) {
HingeJoint* joint = luax_checktype(L, 1, HingeJoint);
lua_pushnumber(L, lovrHingeJointGetAngle(joint));
return 1;
}
int l_lovrHingeJointGetLowerLimit(lua_State* L) {
static int l_lovrHingeJointGetLowerLimit(lua_State* L) {
HingeJoint* joint = luax_checktype(L, 1, HingeJoint);
lua_pushnumber(L, lovrHingeJointGetLowerLimit(joint));
return 1;
}
int l_lovrHingeJointSetLowerLimit(lua_State* L) {
static int l_lovrHingeJointSetLowerLimit(lua_State* L) {
HingeJoint* joint = luax_checktype(L, 1, HingeJoint);
float limit = luax_checkfloat(L, 2);
lovrHingeJointSetLowerLimit(joint, limit);
return 0;
}
int l_lovrHingeJointGetUpperLimit(lua_State* L) {
static int l_lovrHingeJointGetUpperLimit(lua_State* L) {
HingeJoint* joint = luax_checktype(L, 1, HingeJoint);
lua_pushnumber(L, lovrHingeJointGetUpperLimit(joint));
return 1;
}
int l_lovrHingeJointSetUpperLimit(lua_State* L) {
static int l_lovrHingeJointSetUpperLimit(lua_State* L) {
HingeJoint* joint = luax_checktype(L, 1, HingeJoint);
float limit = luax_checkfloat(L, 2);
lovrHingeJointSetUpperLimit(joint, limit);
return 0;
}
int l_lovrHingeJointGetLimits(lua_State* L) {
static int l_lovrHingeJointGetLimits(lua_State* L) {
HingeJoint* joint = luax_checktype(L, 1, HingeJoint);
lua_pushnumber(L, lovrHingeJointGetLowerLimit(joint));
lua_pushnumber(L, lovrHingeJointGetUpperLimit(joint));
return 2;
}
int l_lovrHingeJointSetLimits(lua_State* L) {
static int l_lovrHingeJointSetLimits(lua_State* L) {
HingeJoint* joint = luax_checktype(L, 1, HingeJoint);
float lower = luax_checkfloat(L, 2);
float upper = luax_checkfloat(L, 3);
@ -234,7 +234,7 @@ const luaL_Reg lovrHingeJoint[] = {
{ NULL, NULL }
};
int l_lovrSliderJointGetAxis(lua_State* L) {
static int l_lovrSliderJointGetAxis(lua_State* L) {
SliderJoint* joint = luax_checktype(L, 1, SliderJoint);
float x, y, z;
lovrSliderJointGetAxis(joint, &x, &y, &z);
@ -244,7 +244,7 @@ int l_lovrSliderJointGetAxis(lua_State* L) {
return 3;
}
int l_lovrSliderJointSetAxis(lua_State* L) {
static int l_lovrSliderJointSetAxis(lua_State* L) {
SliderJoint* joint = luax_checktype(L, 1, SliderJoint);
float x = luax_checkfloat(L, 2);
float y = luax_checkfloat(L, 3);
@ -253,46 +253,46 @@ int l_lovrSliderJointSetAxis(lua_State* L) {
return 0;
}
int l_lovrSliderJointGetPosition(lua_State* L) {
static int l_lovrSliderJointGetPosition(lua_State* L) {
SliderJoint* joint = luax_checktype(L, 1, SliderJoint);
lua_pushnumber(L, lovrSliderJointGetPosition(joint));
return 1;
}
int l_lovrSliderJointGetLowerLimit(lua_State* L) {
static int l_lovrSliderJointGetLowerLimit(lua_State* L) {
SliderJoint* joint = luax_checktype(L, 1, SliderJoint);
lua_pushnumber(L, lovrSliderJointGetLowerLimit(joint));
return 1;
}
int l_lovrSliderJointSetLowerLimit(lua_State* L) {
static int l_lovrSliderJointSetLowerLimit(lua_State* L) {
SliderJoint* joint = luax_checktype(L, 1, SliderJoint);
float limit = luax_checkfloat(L, 2);
lovrSliderJointSetLowerLimit(joint, limit);
return 0;
}
int l_lovrSliderJointGetUpperLimit(lua_State* L) {
static int l_lovrSliderJointGetUpperLimit(lua_State* L) {
SliderJoint* joint = luax_checktype(L, 1, SliderJoint);
lua_pushnumber(L, lovrSliderJointGetUpperLimit(joint));
return 1;
}
int l_lovrSliderJointSetUpperLimit(lua_State* L) {
static int l_lovrSliderJointSetUpperLimit(lua_State* L) {
SliderJoint* joint = luax_checktype(L, 1, SliderJoint);
float limit = luax_checkfloat(L, 2);
lovrSliderJointSetUpperLimit(joint, limit);
return 0;
}
int l_lovrSliderJointGetLimits(lua_State* L) {
static int l_lovrSliderJointGetLimits(lua_State* L) {
SliderJoint* joint = luax_checktype(L, 1, SliderJoint);
lua_pushnumber(L, lovrSliderJointGetLowerLimit(joint));
lua_pushnumber(L, lovrSliderJointGetUpperLimit(joint));
return 2;
}
int l_lovrSliderJointSetLimits(lua_State* L) {
static int l_lovrSliderJointSetLimits(lua_State* L) {
SliderJoint* joint = luax_checktype(L, 1, SliderJoint);
float lower = luax_checkfloat(L, 2);
float upper = luax_checkfloat(L, 3);

View File

@ -2,7 +2,7 @@
#include "api/graphics.h"
#include "graphics/material.h"
int l_lovrMaterialGetColor(lua_State* L) {
static int l_lovrMaterialGetColor(lua_State* L) {
Material* material = luax_checktype(L, 1, Material);
MaterialColor colorType = luaL_checkoption(L, 2, "diffuse", MaterialColors);
Color color = lovrMaterialGetColor(material, colorType);
@ -13,7 +13,7 @@ int l_lovrMaterialGetColor(lua_State* L) {
return 4;
}
int l_lovrMaterialSetColor(lua_State* L) {
static int l_lovrMaterialSetColor(lua_State* L) {
Material* material = luax_checktype(L, 1, Material);
MaterialColor colorType = COLOR_DIFFUSE;
int index = 2;
@ -26,7 +26,7 @@ int l_lovrMaterialSetColor(lua_State* L) {
return 0;
}
int l_lovrMaterialGetScalar(lua_State* L) {
static int l_lovrMaterialGetScalar(lua_State* L) {
Material* material = luax_checktype(L, 1, Material);
MaterialScalar scalarType = luaL_checkoption(L, 2, NULL, MaterialScalars);
float value = lovrMaterialGetScalar(material, scalarType);
@ -34,7 +34,7 @@ int l_lovrMaterialGetScalar(lua_State* L) {
return 1;
}
int l_lovrMaterialSetScalar(lua_State* L) {
static int l_lovrMaterialSetScalar(lua_State* L) {
Material* material = luax_checktype(L, 1, Material);
MaterialScalar scalarType = luaL_checkoption(L, 2, NULL, MaterialScalars);
float value = luax_checkfloat(L, 3);
@ -42,7 +42,7 @@ int l_lovrMaterialSetScalar(lua_State* L) {
return 0;
}
int l_lovrMaterialGetTexture(lua_State* L) {
static int l_lovrMaterialGetTexture(lua_State* L) {
Material* material = luax_checktype(L, 1, Material);
MaterialTexture textureType = luaL_checkoption(L, 2, "diffuse", MaterialTextures);
Texture* texture = lovrMaterialGetTexture(material, textureType);
@ -50,7 +50,7 @@ int l_lovrMaterialGetTexture(lua_State* L) {
return 1;
}
int l_lovrMaterialSetTexture(lua_State* L) {
static int l_lovrMaterialSetTexture(lua_State* L) {
Material* material = luax_checktype(L, 1, Material);
MaterialTexture textureType = TEXTURE_DIFFUSE;
int index = 2;
@ -63,7 +63,7 @@ int l_lovrMaterialSetTexture(lua_State* L) {
return 0;
}
int l_lovrMaterialGetTransform(lua_State* L) {
static int l_lovrMaterialGetTransform(lua_State* L) {
Material* material = luax_checktype(L, 1, Material);
float ox, oy, sx, sy, angle;
lovrMaterialGetTransform(material, &ox, &oy, &sx, &sy, &angle);
@ -75,7 +75,7 @@ int l_lovrMaterialGetTransform(lua_State* L) {
return 5;
}
int l_lovrMaterialSetTransform(lua_State* L) {
static int l_lovrMaterialSetTransform(lua_State* L) {
Material* material = luax_checktype(L, 1, Material);
float ox = luax_optfloat(L, 2, 0.f);
float oy = luax_optfloat(L, 3, 0.f);

View File

@ -4,7 +4,7 @@
#include "graphics/graphics.h"
#include <limits.h>
int l_lovrMeshAttachAttributes(lua_State* L) {
static int l_lovrMeshAttachAttributes(lua_State* L) {
Mesh* mesh = luax_checktype(L, 1, Mesh);
Mesh* other = luax_checktype(L, 2, Mesh);
int instanceDivisor = luaL_optinteger(L, 3, 0);
@ -44,7 +44,7 @@ int l_lovrMeshAttachAttributes(lua_State* L) {
return 0;
}
int l_lovrMeshDetachAttributes(lua_State* L) {
static int l_lovrMeshDetachAttributes(lua_State* L) {
Mesh* mesh = luax_checktype(L, 1, Mesh);
if (lua_isuserdata(L, 2)) {
Mesh* other = luax_checktype(L, 2, Mesh);
@ -71,7 +71,7 @@ int l_lovrMeshDetachAttributes(lua_State* L) {
return 0;
}
int l_lovrMeshDraw(lua_State* L) {
static int l_lovrMeshDraw(lua_State* L) {
Mesh* mesh = luax_checktype(L, 1, Mesh);
float transform[16];
int index = luax_readmat4(L, 2, transform, 1);
@ -96,20 +96,20 @@ int l_lovrMeshDraw(lua_State* L) {
return 0;
}
int l_lovrMeshGetDrawMode(lua_State* L) {
static int l_lovrMeshGetDrawMode(lua_State* L) {
Mesh* mesh = luax_checktype(L, 1, Mesh);
lua_pushstring(L, DrawModes[lovrMeshGetDrawMode(mesh)]);
return 1;
}
int l_lovrMeshSetDrawMode(lua_State* L) {
static int l_lovrMeshSetDrawMode(lua_State* L) {
Mesh* mesh = luax_checktype(L, 1, Mesh);
DrawMode mode = luaL_checkoption(L, 2, NULL, DrawModes);
lovrMeshSetDrawMode(mesh, mode);
return 0;
}
int l_lovrMeshGetVertexFormat(lua_State* L) {
static int l_lovrMeshGetVertexFormat(lua_State* L) {
Mesh* mesh = luax_checktype(L, 1, Mesh);
lua_createtable(L, mesh->attributeCount, 0);
for (int i = 0; i < mesh->attributeCount; i++) {
@ -129,13 +129,13 @@ int l_lovrMeshGetVertexFormat(lua_State* L) {
return 1;
}
int l_lovrMeshGetVertexCount(lua_State* L) {
static int l_lovrMeshGetVertexCount(lua_State* L) {
Mesh* mesh = luax_checktype(L, 1, Mesh);
lua_pushinteger(L, lovrMeshGetVertexCount(mesh));
return 1;
}
int l_lovrMeshGetVertex(lua_State* L) {
static int l_lovrMeshGetVertex(lua_State* L) {
Mesh* mesh = luax_checktype(L, 1, Mesh);
int index = luaL_checkinteger(L, 2) - 1;
@ -167,7 +167,7 @@ int l_lovrMeshGetVertex(lua_State* L) {
return components;
}
int l_lovrMeshSetVertex(lua_State* L) {
static int l_lovrMeshSetVertex(lua_State* L) {
Mesh* mesh = luax_checktype(L, 1, Mesh);
uint32_t index = luaL_checkinteger(L, 2) - 1;
lovrAssert(index >= 0 && index < lovrMeshGetVertexCount(mesh), "Invalid mesh vertex index: %d", index + 1);
@ -212,7 +212,7 @@ int l_lovrMeshSetVertex(lua_State* L) {
return 0;
}
int l_lovrMeshGetVertexAttribute(lua_State* L) {
static int l_lovrMeshGetVertexAttribute(lua_State* L) {
Mesh* mesh = luax_checktype(L, 1, Mesh);
uint32_t vertexIndex = luaL_checkinteger(L, 2) - 1;
int attributeIndex = luaL_checkinteger(L, 3) - 1;
@ -237,7 +237,7 @@ int l_lovrMeshGetVertexAttribute(lua_State* L) {
return attribute->components;
}
int l_lovrMeshSetVertexAttribute(lua_State* L) {
static int l_lovrMeshSetVertexAttribute(lua_State* L) {
Mesh* mesh = luax_checktype(L, 1, Mesh);
uint32_t vertexIndex = luaL_checkinteger(L, 2) - 1;
int attributeIndex = luaL_checkinteger(L, 3) - 1;
@ -272,7 +272,7 @@ int l_lovrMeshSetVertexAttribute(lua_State* L) {
return 0;
}
int l_lovrMeshSetVertices(lua_State* L) {
static int l_lovrMeshSetVertices(lua_State* L) {
Mesh* mesh = luax_checktype(L, 1, Mesh);
uint32_t capacity = lovrMeshGetVertexCount(mesh);
luaL_checktype(L, 2, LUA_TTABLE);
@ -322,7 +322,7 @@ int l_lovrMeshSetVertices(lua_State* L) {
return 0;
}
int l_lovrMeshGetVertexMap(lua_State* L) {
static int l_lovrMeshGetVertexMap(lua_State* L) {
Mesh* mesh = luax_checktype(L, 1, Mesh);
Buffer* buffer = lovrMeshGetIndexBuffer(mesh);
uint32_t count = lovrMeshGetIndexCount(mesh);
@ -357,7 +357,7 @@ int l_lovrMeshGetVertexMap(lua_State* L) {
return 1;
}
int l_lovrMeshSetVertexMap(lua_State* L) {
static int l_lovrMeshSetVertexMap(lua_State* L) {
Mesh* mesh = luax_checktype(L, 1, Mesh);
if (lua_isnoneornil(L, 2)) {
@ -425,14 +425,14 @@ int l_lovrMeshSetVertexMap(lua_State* L) {
return 0;
}
int l_lovrMeshIsAttributeEnabled(lua_State* L) {
static int l_lovrMeshIsAttributeEnabled(lua_State* L) {
Mesh* mesh = luax_checktype(L, 1, Mesh);
const char* attribute = luaL_checkstring(L, 2);
lua_pushboolean(L, lovrMeshIsAttributeEnabled(mesh, attribute));
return 1;
}
int l_lovrMeshSetAttributeEnabled(lua_State* L) {
static int l_lovrMeshSetAttributeEnabled(lua_State* L) {
Mesh* mesh = luax_checktype(L, 1, Mesh);
const char* attribute = luaL_checkstring(L, 2);
bool enabled = lua_toboolean(L, 3);
@ -440,7 +440,7 @@ int l_lovrMeshSetAttributeEnabled(lua_State* L) {
return 0;
}
int l_lovrMeshGetDrawRange(lua_State* L) {
static int l_lovrMeshGetDrawRange(lua_State* L) {
Mesh* mesh = luax_checktype(L, 1, Mesh);
uint32_t start, count;
lovrMeshGetDrawRange(mesh, &start, &count);
@ -455,7 +455,7 @@ int l_lovrMeshGetDrawRange(lua_State* L) {
return 2;
}
int l_lovrMeshSetDrawRange(lua_State* L) {
static int l_lovrMeshSetDrawRange(lua_State* L) {
Mesh* mesh = luax_checktype(L, 1, Mesh);
if (lua_isnoneornil(L, 2)) {
lovrMeshSetDrawRange(mesh, 0, 0);
@ -468,14 +468,14 @@ int l_lovrMeshSetDrawRange(lua_State* L) {
return 0;
}
int l_lovrMeshGetMaterial(lua_State* L) {
static int l_lovrMeshGetMaterial(lua_State* L) {
Mesh* mesh = luax_checktype(L, 1, Mesh);
Material* material = lovrMeshGetMaterial(mesh);
luax_pushobject(L, material);
return 1;
}
int l_lovrMeshSetMaterial(lua_State* L) {
static int l_lovrMeshSetMaterial(lua_State* L) {
Mesh* mesh = luax_checktype(L, 1, Mesh);
if (lua_isnoneornil(L, 2)) {
lovrMeshSetMaterial(mesh, NULL);

View File

@ -1,19 +1,19 @@
#include "api.h"
#include "audio/microphone.h"
int l_lovrMicrophoneGetBitDepth(lua_State* L) {
static int l_lovrMicrophoneGetBitDepth(lua_State* L) {
Microphone* microphone = luax_checktype(L, 1, Microphone);
lua_pushinteger(L, lovrMicrophoneGetBitDepth(microphone));
return 1;
}
int l_lovrMicrophoneGetChannelCount(lua_State* L) {
static int l_lovrMicrophoneGetChannelCount(lua_State* L) {
Microphone* microphone = luax_checktype(L, 1, Microphone);
lua_pushinteger(L, lovrMicrophoneGetChannelCount(microphone));
return 1;
}
int l_lovrMicrophoneGetData(lua_State* L) {
static int l_lovrMicrophoneGetData(lua_State* L) {
Microphone* microphone = luax_checktype(L, 1, Microphone);
SoundData* soundData = lovrMicrophoneGetData(microphone);
luax_pushobject(L, soundData);
@ -21,37 +21,37 @@ int l_lovrMicrophoneGetData(lua_State* L) {
return 1;
}
int l_lovrMicrophoneGetName(lua_State* L) {
static int l_lovrMicrophoneGetName(lua_State* L) {
Microphone* microphone = luax_checktype(L, 1, Microphone);
lua_pushstring(L, lovrMicrophoneGetName(microphone));
return 1;
}
int l_lovrMicrophoneGetSampleCount(lua_State* L) {
static int l_lovrMicrophoneGetSampleCount(lua_State* L) {
Microphone* microphone = luax_checktype(L, 1, Microphone);
lua_pushinteger(L, lovrMicrophoneGetSampleCount(microphone));
return 1;
}
int l_lovrMicrophoneGetSampleRate(lua_State* L) {
static int l_lovrMicrophoneGetSampleRate(lua_State* L) {
Microphone* microphone = luax_checktype(L, 1, Microphone);
lua_pushinteger(L, lovrMicrophoneGetSampleRate(microphone));
return 1;
}
int l_lovrMicrophoneIsRecording(lua_State* L) {
static int l_lovrMicrophoneIsRecording(lua_State* L) {
Microphone* microphone = luax_checktype(L, 1, Microphone);
lua_pushboolean(L, lovrMicrophoneIsRecording(microphone));
return 1;
}
int l_lovrMicrophoneStartRecording(lua_State* L) {
static int l_lovrMicrophoneStartRecording(lua_State* L) {
Microphone* microphone = luax_checktype(L, 1, Microphone);
lovrMicrophoneStartRecording(microphone);
return 0;
}
int l_lovrMicrophoneStopRecording(lua_State* L) {
static int l_lovrMicrophoneStopRecording(lua_State* L) {
Microphone* microphone = luax_checktype(L, 1, Microphone);
lovrMicrophoneStopRecording(microphone);
return 0;

View File

@ -2,7 +2,7 @@
#include "api/math.h"
#include "graphics/model.h"
int l_lovrModelDraw(lua_State* L) {
static int l_lovrModelDraw(lua_State* L) {
Model* model = luax_checktype(L, 1, Model);
float transform[16];
int index = luax_readmat4(L, 2, transform, 1);
@ -11,13 +11,13 @@ int l_lovrModelDraw(lua_State* L) {
return 0;
}
int l_lovrModelGetAnimator(lua_State* L) {
static int l_lovrModelGetAnimator(lua_State* L) {
Model* model = luax_checktype(L, 1, Model);
luax_pushobject(L, lovrModelGetAnimator(model));
return 1;
}
int l_lovrModelSetAnimator(lua_State* L) {
static int l_lovrModelSetAnimator(lua_State* L) {
Model* model = luax_checktype(L, 1, Model);
if (lua_isnoneornil(L, 2)) {
lovrModelSetAnimator(model, NULL);
@ -28,14 +28,14 @@ int l_lovrModelSetAnimator(lua_State* L) {
return 0;
}
int l_lovrModelGetMaterial(lua_State* L) {
static int l_lovrModelGetMaterial(lua_State* L) {
Model* model = luax_checktype(L, 1, Model);
Material* material = lovrModelGetMaterial(model);
luax_pushobject(L, material);
return 1;
}
int l_lovrModelSetMaterial(lua_State* L) {
static int l_lovrModelSetMaterial(lua_State* L) {
Model* model = luax_checktype(L, 1, Model);
if (lua_isnoneornil(L, 2)) {
lovrModelSetMaterial(model, NULL);
@ -46,7 +46,7 @@ int l_lovrModelSetMaterial(lua_State* L) {
return 0;
}
int l_lovrModelGetAABB(lua_State* L) {
static int l_lovrModelGetAABB(lua_State* L) {
Model* model = luax_checktype(L, 1, Model);
float aabb[6];
lovrModelGetAABB(model, aabb);

View File

@ -3,7 +3,7 @@
#include "math/pool.h"
#include "lib/math.h"
int l_lovrPoolVec3(lua_State* L) {
static int l_lovrPoolVec3(lua_State* L) {
Pool* pool = luax_checktype(L, 1, Pool);
vec3 v = lovrPoolAllocate(pool, MATH_VEC3);
if (v) {
@ -16,7 +16,7 @@ int l_lovrPoolVec3(lua_State* L) {
return 1;
}
int l_lovrPoolQuat(lua_State* L) {
static int l_lovrPoolQuat(lua_State* L) {
Pool* pool = luax_checktype(L, 1, Pool);
quat q = lovrPoolAllocate(pool, MATH_QUAT);
if (q) {
@ -29,7 +29,7 @@ int l_lovrPoolQuat(lua_State* L) {
return 1;
}
int l_lovrPoolMat4(lua_State* L) {
static int l_lovrPoolMat4(lua_State* L) {
Pool* pool = luax_checktype(L, 1, Pool);
mat4 m = lovrPoolAllocate(pool, MATH_MAT4);
if (m) {
@ -42,19 +42,19 @@ int l_lovrPoolMat4(lua_State* L) {
return 1;
}
int l_lovrPoolDrain(lua_State* L) {
static int l_lovrPoolDrain(lua_State* L) {
Pool* pool = luax_checktype(L, 1, Pool);
lovrPoolDrain(pool);
return 0;
}
int l_lovrPoolGetSize(lua_State* L) {
static int l_lovrPoolGetSize(lua_State* L) {
Pool* pool = luax_checktype(L, 1, Pool);
lua_pushinteger(L, lovrPoolGetSize(pool));
return 1;
}
int l_lovrPoolGetUsage(lua_State* L) {
static int l_lovrPoolGetUsage(lua_State* L) {
Pool* pool = luax_checktype(L, 1, Pool);
lua_pushinteger(L, lovrPoolGetUsage(pool));
return 1;

View File

@ -41,7 +41,7 @@ int l_lovrRandomGeneratorSetSeed(lua_State* L) {
return 0;
}
int l_lovrRandomGeneratorGetState(lua_State* L) {
static int l_lovrRandomGeneratorGetState(lua_State* L) {
RandomGenerator* generator = luax_checktype(L, 1, RandomGenerator);
size_t length = 32;
char state[32];
@ -50,7 +50,7 @@ int l_lovrRandomGeneratorGetState(lua_State* L) {
return 1;
}
int l_lovrRandomGeneratorSetState(lua_State* L) {
static int l_lovrRandomGeneratorSetState(lua_State* L) {
RandomGenerator* generator = luax_checktype(L, 1, RandomGenerator);
const char* state = luaL_checklstring(L, 2, NULL);
if (lovrRandomGeneratorSetState(generator, state)) {

View File

@ -1,43 +1,43 @@
#include "api.h"
#include "data/rasterizer.h"
int l_lovrRasterizerGetHeight(lua_State* L) {
static int l_lovrRasterizerGetHeight(lua_State* L) {
Rasterizer* rasterizer = luax_checktype(L, 1, Rasterizer);
lua_pushinteger(L, rasterizer->height);
return 1;
}
int l_lovrRasterizerGetAdvance(lua_State* L) {
static int l_lovrRasterizerGetAdvance(lua_State* L) {
Rasterizer* rasterizer = luax_checktype(L, 1, Rasterizer);
lua_pushinteger(L, rasterizer->advance);
return 1;
}
int l_lovrRasterizerGetAscent(lua_State* L) {
static int l_lovrRasterizerGetAscent(lua_State* L) {
Rasterizer* rasterizer = luax_checktype(L, 1, Rasterizer);
lua_pushinteger(L, rasterizer->ascent);
return 1;
}
int l_lovrRasterizerGetDescent(lua_State* L) {
static int l_lovrRasterizerGetDescent(lua_State* L) {
Rasterizer* rasterizer = luax_checktype(L, 1, Rasterizer);
lua_pushinteger(L, rasterizer->descent);
return 1;
}
int l_lovrRasterizerGetLineHeight(lua_State* L) {
static int l_lovrRasterizerGetLineHeight(lua_State* L) {
Rasterizer* rasterizer = luax_checktype(L, 1, Rasterizer);
lua_pushinteger(L, rasterizer->height * 1.25f);
return 1;
}
int l_lovrRasterizerGetGlyphCount(lua_State* L) {
static int l_lovrRasterizerGetGlyphCount(lua_State* L) {
Rasterizer* rasterizer = luax_checktype(L, 1, Rasterizer);
lua_pushinteger(L, rasterizer->glyphCount);
return 1;
}
int l_lovrRasterizerHasGlyphs(lua_State* L) {
static int l_lovrRasterizerHasGlyphs(lua_State* L) {
Rasterizer* rasterizer = luax_checktype(L, 1, Rasterizer);
bool hasGlyphs = true;
for (int i = 2; i <= lua_gettop(L); i++) {

View File

@ -211,20 +211,20 @@ void luax_checkuniformtype(lua_State* L, int index, UniformType* baseType, int*
}
}
int l_lovrShaderGetType(lua_State* L) {
static int l_lovrShaderGetType(lua_State* L) {
Shader* shader = luax_checktype(L, 1, Shader);
lua_pushstring(L, ShaderTypes[lovrShaderGetType(shader)]);
return 1;
}
int l_lovrShaderHasUniform(lua_State* L) {
static int l_lovrShaderHasUniform(lua_State* L) {
Shader* shader = luax_checktype(L, 1, Shader);
const char* name = luaL_checkstring(L, 2);
lua_pushboolean(L, lovrShaderHasUniform(shader, name));
return 1;
}
int l_lovrShaderSend(lua_State* L) {
static int l_lovrShaderSend(lua_State* L) {
Shader* shader = luax_checktype(L, 1, Shader);
const char* name = luaL_checkstring(L, 2);
const Uniform* uniform = lovrShaderGetUniform(shader, name);
@ -246,7 +246,7 @@ int l_lovrShaderSend(lua_State* L) {
return 0;
}
int l_lovrShaderSendBlock(lua_State* L) {
static int l_lovrShaderSendBlock(lua_State* L) {
Shader* shader = luax_checktype(L, 1, Shader);
const char* name = luaL_checkstring(L, 2);
ShaderBlock* block = luax_checktype(L, 3, ShaderBlock);
@ -256,7 +256,7 @@ int l_lovrShaderSendBlock(lua_State* L) {
return 0;
}
int l_lovrShaderSendImage(lua_State* L) {
static int l_lovrShaderSendImage(lua_State* L) {
int index = 1;
Shader* shader = luax_checktype(L, index++, Shader);
const char* name = luaL_checkstring(L, index++);

View File

@ -2,20 +2,20 @@
#include "api/graphics.h"
#include "graphics/shader.h"
int l_lovrShaderBlockGetType(lua_State* L) {
static int l_lovrShaderBlockGetType(lua_State* L) {
ShaderBlock* block = luax_checktype(L, 1, ShaderBlock);
lua_pushstring(L, BlockTypes[lovrShaderBlockGetType(block)]);
return 1;
}
int l_lovrShaderBlockGetSize(lua_State* L) {
static int l_lovrShaderBlockGetSize(lua_State* L) {
ShaderBlock* block = luax_checktype(L, 1, ShaderBlock);
Buffer* buffer = lovrShaderBlockGetBuffer(block);
lua_pushinteger(L, lovrBufferGetSize(buffer));
return 1;
}
int l_lovrShaderBlockGetOffset(lua_State* L) {
static int l_lovrShaderBlockGetOffset(lua_State* L) {
ShaderBlock* block = luax_checktype(L, 1, ShaderBlock);
const char* field = luaL_checkstring(L, 2);
const Uniform* uniform = lovrShaderBlockGetUniform(block, field);
@ -23,7 +23,7 @@ int l_lovrShaderBlockGetOffset(lua_State* L) {
return 1;
}
int l_lovrShaderBlockSend(lua_State* L) {
static int l_lovrShaderBlockSend(lua_State* L) {
ShaderBlock* block = luax_checktype(L, 1, ShaderBlock);
if (lua_type(L, 2) == LUA_TSTRING) {
const char* name = luaL_checkstring(L, 2);
@ -47,7 +47,7 @@ int l_lovrShaderBlockSend(lua_State* L) {
}
}
int l_lovrShaderBlockRead(lua_State* L) {
static int l_lovrShaderBlockRead(lua_State* L) {
ShaderBlock* block = luax_checktype(L, 1, ShaderBlock);
const char* name = luaL_checkstring(L, 2);
const Uniform* uniform = lovrShaderBlockGetUniform(block, name);
@ -97,7 +97,7 @@ int l_lovrShaderBlockRead(lua_State* L) {
return 1;
}
int l_lovrShaderBlockGetShaderCode(lua_State* L) {
static int l_lovrShaderBlockGetShaderCode(lua_State* L) {
ShaderBlock* block = luax_checktype(L, 1, ShaderBlock);
const char* blockName = luaL_checkstring(L, 2);
size_t length;

View File

@ -1,45 +1,45 @@
#include "api.h"
#include "physics/physics.h"
int l_lovrShapeDestroy(lua_State* L) {
static int l_lovrShapeDestroy(lua_State* L) {
Shape* shape = luax_checktype(L, 1, Shape);
lovrShapeDestroyData(shape);
return 0;
}
int l_lovrShapeGetType(lua_State* L) {
static int l_lovrShapeGetType(lua_State* L) {
Shape* shape = luax_checktype(L, 1, Shape);
lua_pushstring(L, ShapeTypes[lovrShapeGetType(shape)]);
return 1;
}
int l_lovrShapeGetCollider(lua_State* L) {
static int l_lovrShapeGetCollider(lua_State* L) {
Shape* shape = luax_checktype(L, 1, Shape);
luax_pushobject(L, lovrShapeGetCollider(shape));
return 1;
}
int l_lovrShapeIsEnabled(lua_State* L) {
static int l_lovrShapeIsEnabled(lua_State* L) {
Shape* shape = luax_checktype(L, 1, Shape);
lua_pushboolean(L, lovrShapeIsEnabled(shape));
return 1;
}
int l_lovrShapeSetEnabled(lua_State* L) {
static int l_lovrShapeSetEnabled(lua_State* L) {
Shape* shape = luax_checktype(L, 1, Shape);
bool enabled = lua_toboolean(L, 2);
lovrShapeSetEnabled(shape, enabled);
return 0;
}
int l_lovrShapeGetUserData(lua_State* L) {
static int l_lovrShapeGetUserData(lua_State* L) {
Shape* shape = luax_checktype(L, 1, Shape);
int ref = (int) lovrShapeGetUserData(shape);
lua_rawgeti(L, LUA_REGISTRYINDEX, ref);
return 1;
}
int l_lovrShapeSetUserData(lua_State* L) {
static int l_lovrShapeSetUserData(lua_State* L) {
Shape* shape = luax_checktype(L, 1, Shape);
uint64_t ref = (int) lovrShapeGetUserData(shape);
if (ref) {
@ -56,7 +56,7 @@ int l_lovrShapeSetUserData(lua_State* L) {
return 0;
}
int l_lovrShapeGetPosition(lua_State* L) {
static int l_lovrShapeGetPosition(lua_State* L) {
Shape* shape = luax_checktype(L, 1, Shape);
float x, y, z;
lovrShapeGetPosition(shape, &x, &y, &z);
@ -66,7 +66,7 @@ int l_lovrShapeGetPosition(lua_State* L) {
return 3;
}
int l_lovrShapeSetPosition(lua_State* L) {
static int l_lovrShapeSetPosition(lua_State* L) {
Shape* shape = luax_checktype(L, 1, Shape);
float x = luax_checkfloat(L, 2);
float y = luax_checkfloat(L, 3);
@ -75,7 +75,7 @@ int l_lovrShapeSetPosition(lua_State* L) {
return 0;
}
int l_lovrShapeGetOrientation(lua_State* L) {
static int l_lovrShapeGetOrientation(lua_State* L) {
Shape* shape = luax_checktype(L, 1, Shape);
float angle, x, y, z;
lovrShapeGetOrientation(shape, &angle, &x, &y, &z);
@ -86,7 +86,7 @@ int l_lovrShapeGetOrientation(lua_State* L) {
return 4;
}
int l_lovrShapeSetOrientation(lua_State* L) {
static int l_lovrShapeSetOrientation(lua_State* L) {
Shape* shape = luax_checktype(L, 1, Shape);
float angle = luax_checkfloat(L, 2);
float x = luax_checkfloat(L, 3);
@ -96,7 +96,7 @@ int l_lovrShapeSetOrientation(lua_State* L) {
return 0;
}
int l_lovrShapeGetMass(lua_State* L) {
static int l_lovrShapeGetMass(lua_State* L) {
Shape* shape = luax_checktype(L, 1, Shape);
float density = luax_checkfloat(L, 2);
float cx, cy, cz, mass;
@ -114,7 +114,7 @@ int l_lovrShapeGetMass(lua_State* L) {
return 5;
}
int l_lovrShapeGetAABB(lua_State* L) {
static int l_lovrShapeGetAABB(lua_State* L) {
Shape* shape = luax_checktype(L, 1, Shape);
float aabb[6];
lovrShapeGetAABB(shape, aabb);
@ -141,13 +141,13 @@ const luaL_Reg lovrShape[] = {
{ NULL, NULL }
};
int l_lovrSphereShapeGetRadius(lua_State* L) {
static int l_lovrSphereShapeGetRadius(lua_State* L) {
SphereShape* sphere = luax_checktype(L, 1, SphereShape);
lua_pushnumber(L, lovrSphereShapeGetRadius(sphere));
return 1;
}
int l_lovrSphereShapeSetRadius(lua_State* L) {
static int l_lovrSphereShapeSetRadius(lua_State* L) {
SphereShape* sphere = luax_checktype(L, 1, SphereShape);
float radius = luax_checkfloat(L, 2);
lovrSphereShapeSetRadius(sphere, radius);
@ -160,7 +160,7 @@ const luaL_Reg lovrSphereShape[] = {
{ NULL, NULL }
};
int l_lovrBoxShapeGetDimensions(lua_State* L) {
static int l_lovrBoxShapeGetDimensions(lua_State* L) {
BoxShape* box = luax_checktype(L, 1, BoxShape);
float x, y, z;
lovrBoxShapeGetDimensions(box, &x, &y, &z);
@ -170,7 +170,7 @@ int l_lovrBoxShapeGetDimensions(lua_State* L) {
return 3;
}
int l_lovrBoxShapeSetDimensions(lua_State* L) {
static int l_lovrBoxShapeSetDimensions(lua_State* L) {
BoxShape* box = luax_checktype(L, 1, BoxShape);
float x = luax_checkfloat(L, 2);
float y = luax_checkfloat(L, 3);
@ -185,26 +185,26 @@ const luaL_Reg lovrBoxShape[] = {
{ NULL, NULL }
};
int l_lovrCapsuleShapeGetRadius(lua_State* L) {
static int l_lovrCapsuleShapeGetRadius(lua_State* L) {
CapsuleShape* capsule = luax_checktype(L, 1, CapsuleShape);
lua_pushnumber(L, lovrCapsuleShapeGetRadius(capsule));
return 1;
}
int l_lovrCapsuleShapeSetRadius(lua_State* L) {
static int l_lovrCapsuleShapeSetRadius(lua_State* L) {
CapsuleShape* capsule = luax_checktype(L, 1, CapsuleShape);
float radius = luax_checkfloat(L, 2);
lovrCapsuleShapeSetRadius(capsule, radius);
return 0;
}
int l_lovrCapsuleShapeGetLength(lua_State* L) {
static int l_lovrCapsuleShapeGetLength(lua_State* L) {
CapsuleShape* capsule = luax_checktype(L, 1, CapsuleShape);
lua_pushnumber(L, lovrCapsuleShapeGetLength(capsule));
return 1;
}
int l_lovrCapsuleShapeSetLength(lua_State* L) {
static int l_lovrCapsuleShapeSetLength(lua_State* L) {
CapsuleShape* capsule = luax_checktype(L, 1, CapsuleShape);
float length = luax_checkfloat(L, 2);
lovrCapsuleShapeSetLength(capsule, length);
@ -219,26 +219,26 @@ const luaL_Reg lovrCapsuleShape[] = {
{ NULL, NULL }
};
int l_lovrCylinderShapeGetRadius(lua_State* L) {
static int l_lovrCylinderShapeGetRadius(lua_State* L) {
CylinderShape* cylinder = luax_checktype(L, 1, CylinderShape);
lua_pushnumber(L, lovrCylinderShapeGetRadius(cylinder));
return 1;
}
int l_lovrCylinderShapeSetRadius(lua_State* L) {
static int l_lovrCylinderShapeSetRadius(lua_State* L) {
CylinderShape* cylinder = luax_checktype(L, 1, CylinderShape);
float radius = luax_checkfloat(L, 2);
lovrCylinderShapeSetRadius(cylinder, radius);
return 0;
}
int l_lovrCylinderShapeGetLength(lua_State* L) {
static int l_lovrCylinderShapeGetLength(lua_State* L) {
CylinderShape* cylinder = luax_checktype(L, 1, CylinderShape);
lua_pushnumber(L, lovrCylinderShapeGetLength(cylinder));
return 1;
}
int l_lovrCylinderShapeSetLength(lua_State* L) {
static int l_lovrCylinderShapeSetLength(lua_State* L) {
CylinderShape* cylinder = luax_checktype(L, 1, CylinderShape);
float length = luax_checkfloat(L, 2);
lovrCylinderShapeSetLength(cylinder, length);

View File

@ -1,44 +1,44 @@
#include "api.h"
#include "data/soundData.h"
int l_lovrSoundDataGetBitDepth(lua_State* L) {
static int l_lovrSoundDataGetBitDepth(lua_State* L) {
SoundData* soundData = luax_checktype(L, 1, SoundData);
lua_pushinteger(L, soundData->bitDepth);
return 1;
}
int l_lovrSoundDataGetChannelCount(lua_State* L) {
static int l_lovrSoundDataGetChannelCount(lua_State* L) {
SoundData* soundData = luax_checktype(L, 1, SoundData);
lua_pushinteger(L, soundData->channelCount);
return 1;
}
int l_lovrSoundDataGetDuration(lua_State* L) {
static int l_lovrSoundDataGetDuration(lua_State* L) {
SoundData* soundData = luax_checktype(L, 1, SoundData);
lua_pushnumber(L, soundData->samples / (float) soundData->sampleRate);
return 1;
}
int l_lovrSoundDataGetSample(lua_State* L) {
static int l_lovrSoundDataGetSample(lua_State* L) {
SoundData* soundData = luax_checktype(L, 1, SoundData);
int index = luaL_checkinteger(L, 2);
lua_pushnumber(L, lovrSoundDataGetSample(soundData, index));
return 1;
}
int l_lovrSoundDataGetSampleCount(lua_State* L) {
static int l_lovrSoundDataGetSampleCount(lua_State* L) {
SoundData* soundData = luax_checktype(L, 1, SoundData);
lua_pushinteger(L, soundData->samples);
return 1;
}
int l_lovrSoundDataGetSampleRate(lua_State* L) {
static int l_lovrSoundDataGetSampleRate(lua_State* L) {
SoundData* soundData = luax_checktype(L, 1, SoundData);
lua_pushinteger(L, soundData->sampleRate);
return 1;
}
int l_lovrSoundDataSetSample(lua_State* L) {
static int l_lovrSoundDataSetSample(lua_State* L) {
SoundData* soundData = luax_checktype(L, 1, SoundData);
int index = luaL_checkinteger(L, 2);
float value = luax_checkfloat(L, 3);

View File

@ -3,19 +3,19 @@
#include "audio/audio.h"
#include <stdbool.h>
int l_lovrSourceGetBitDepth(lua_State* L) {
static int l_lovrSourceGetBitDepth(lua_State* L) {
Source* source = luax_checktype(L, 1, Source);
lua_pushinteger(L, lovrSourceGetBitDepth(source));
return 1;
}
int l_lovrSourceGetChannelCount(lua_State* L) {
static int l_lovrSourceGetChannelCount(lua_State* L) {
Source* source = luax_checktype(L, 1, Source);
lua_pushinteger(L, lovrSourceGetChannelCount(source));
return 1;
}
int l_lovrSourceGetCone(lua_State* L) {
static int l_lovrSourceGetCone(lua_State* L) {
Source* source = luax_checktype(L, 1, Source);
float innerAngle, outerAngle, outerGain;
lovrSourceGetCone(source, &innerAngle, &outerAngle, &outerGain);
@ -25,7 +25,7 @@ int l_lovrSourceGetCone(lua_State* L) {
return 3;
}
int l_lovrSourceGetDirection(lua_State* L) {
static int l_lovrSourceGetDirection(lua_State* L) {
float direction[3];
lovrSourceGetDirection(luax_checktype(L, 1, Source), &direction[0], &direction[1], &direction[2]);
lua_pushnumber(L, direction[0]);
@ -34,7 +34,7 @@ int l_lovrSourceGetDirection(lua_State* L) {
return 3;
}
int l_lovrSourceGetDuration(lua_State* L) {
static int l_lovrSourceGetDuration(lua_State* L) {
Source* source = luax_checktype(L, 1, Source);
TimeUnit unit = luaL_checkoption(L, 2, "seconds", TimeUnits);
int duration = lovrSourceGetDuration(source);
@ -48,7 +48,7 @@ int l_lovrSourceGetDuration(lua_State* L) {
return 1;
}
int l_lovrSourceGetFalloff(lua_State* L) {
static int l_lovrSourceGetFalloff(lua_State* L) {
Source* source = luax_checktype(L, 1, Source);
float reference, max, rolloff;
lovrSourceGetFalloff(source, &reference, &max, &rolloff);
@ -58,13 +58,13 @@ int l_lovrSourceGetFalloff(lua_State* L) {
return 3;
}
int l_lovrSourceGetPitch(lua_State* L) {
static int l_lovrSourceGetPitch(lua_State* L) {
Source* source = luax_checktype(L, 1, Source);
lua_pushnumber(L, lovrSourceGetPitch(source));
return 1;
}
int l_lovrSourceGetPosition(lua_State* L) {
static int l_lovrSourceGetPosition(lua_State* L) {
float position[3];
lovrSourceGetPosition(luax_checktype(L, 1, Source), &position[0], &position[1], &position[2]);
lua_pushnumber(L, position[0]);
@ -73,19 +73,19 @@ int l_lovrSourceGetPosition(lua_State* L) {
return 3;
}
int l_lovrSourceGetSampleRate(lua_State* L) {
static int l_lovrSourceGetSampleRate(lua_State* L) {
Source* source = luax_checktype(L, 1, Source);
lua_pushinteger(L, lovrSourceGetSampleRate(source));
return 1;
}
int l_lovrSourceGetType(lua_State* L) {
static int l_lovrSourceGetType(lua_State* L) {
Source* source = luax_checktype(L, 1, Source);
lua_pushstring(L, SourceTypes[lovrSourceGetType(source)]);
return 1;
}
int l_lovrSourceGetVelocity(lua_State* L) {
static int l_lovrSourceGetVelocity(lua_State* L) {
float velocity[3];
lovrSourceGetVelocity(luax_checktype(L, 1, Source), &velocity[0], &velocity[1], &velocity[2]);
lua_pushnumber(L, velocity[0]);
@ -94,13 +94,13 @@ int l_lovrSourceGetVelocity(lua_State* L) {
return 3;
}
int l_lovrSourceGetVolume(lua_State* L) {
static int l_lovrSourceGetVolume(lua_State* L) {
Source* source = luax_checktype(L, 1, Source);
lua_pushnumber(L, lovrSourceGetVolume(source));
return 1;
}
int l_lovrSourceGetVolumeLimits(lua_State* L) {
static int l_lovrSourceGetVolumeLimits(lua_State* L) {
Source* source = luax_checktype(L, 1, Source);
float min, max;
lovrSourceGetVolumeLimits(source, &min, &max);
@ -109,54 +109,54 @@ int l_lovrSourceGetVolumeLimits(lua_State* L) {
return 2;
}
int l_lovrSourceIsLooping(lua_State* L) {
static int l_lovrSourceIsLooping(lua_State* L) {
lua_pushboolean(L, lovrSourceIsLooping(luax_checktype(L, 1, Source)));
return 1;
}
int l_lovrSourceIsPaused(lua_State* L) {
static int l_lovrSourceIsPaused(lua_State* L) {
lua_pushboolean(L, lovrSourceIsPaused(luax_checktype(L, 1, Source)));
return 1;
}
int l_lovrSourceIsPlaying(lua_State* L) {
static int l_lovrSourceIsPlaying(lua_State* L) {
lua_pushboolean(L, lovrSourceIsPlaying(luax_checktype(L, 1, Source)));
return 1;
}
int l_lovrSourceIsRelative(lua_State* L) {
static int l_lovrSourceIsRelative(lua_State* L) {
lua_pushboolean(L, lovrSourceIsRelative(luax_checktype(L, 1, Source)));
return 1;
}
int l_lovrSourceIsStopped(lua_State* L) {
static int l_lovrSourceIsStopped(lua_State* L) {
lua_pushboolean(L, lovrSourceIsStopped(luax_checktype(L, 1, Source)));
return 1;
}
int l_lovrSourcePause(lua_State* L) {
static int l_lovrSourcePause(lua_State* L) {
lovrSourcePause(luax_checktype(L, 1, Source));
return 0;
}
int l_lovrSourcePlay(lua_State* L) {
static int l_lovrSourcePlay(lua_State* L) {
Source* source = luax_checktype(L, 1, Source);
lovrSourcePlay(source);
lovrAudioAdd(source);
return 0;
}
int l_lovrSourceResume(lua_State* L) {
static int l_lovrSourceResume(lua_State* L) {
lovrSourceResume(luax_checktype(L, 1, Source));
return 0;
}
int l_lovrSourceRewind(lua_State* L) {
static int l_lovrSourceRewind(lua_State* L) {
lovrSourceRewind(luax_checktype(L, 1, Source));
return 0;
}
int l_lovrSourceSeek(lua_State* L) {
static int l_lovrSourceSeek(lua_State* L) {
Source* source = luax_checktype(L, 1, Source);
TimeUnit unit = luaL_checkoption(L, 3, "seconds", TimeUnits);
@ -171,7 +171,7 @@ int l_lovrSourceSeek(lua_State* L) {
return 0;
}
int l_lovrSourceSetCone(lua_State* L) {
static int l_lovrSourceSetCone(lua_State* L) {
Source* source = luax_checktype(L, 1, Source);
float innerAngle = luax_checkfloat(L, 1);
float outerAngle = luax_checkfloat(L, 2);
@ -180,7 +180,7 @@ int l_lovrSourceSetCone(lua_State* L) {
return 0;
}
int l_lovrSourceSetFalloff(lua_State* L) {
static int l_lovrSourceSetFalloff(lua_State* L) {
Source* source = luax_checktype(L, 1, Source);
float reference = luax_checkfloat(L, 2);
float max = luax_checkfloat(L, 3);
@ -189,12 +189,12 @@ int l_lovrSourceSetFalloff(lua_State* L) {
return 0;
}
int l_lovrSourceSetLooping(lua_State* L) {
static int l_lovrSourceSetLooping(lua_State* L) {
lovrSourceSetLooping(luax_checktype(L, 1, Source), lua_toboolean(L, 2));
return 0;
}
int l_lovrSourceSetDirection(lua_State* L) {
static int l_lovrSourceSetDirection(lua_State* L) {
Source* source = luax_checktype(L, 1, Source);
float direction[3];
luax_readvec3(L, 2, direction, NULL);
@ -202,12 +202,12 @@ int l_lovrSourceSetDirection(lua_State* L) {
return 0;
}
int l_lovrSourceSetPitch(lua_State* L) {
static int l_lovrSourceSetPitch(lua_State* L) {
lovrSourceSetPitch(luax_checktype(L, 1, Source), luax_checkfloat(L, 2));
return 0;
}
int l_lovrSourceSetPosition(lua_State* L) {
static int l_lovrSourceSetPosition(lua_State* L) {
Source* source = luax_checktype(L, 1, Source);
float position[3];
luax_readvec3(L, 2, position, NULL);
@ -215,14 +215,14 @@ int l_lovrSourceSetPosition(lua_State* L) {
return 0;
}
int l_lovrSourceSetRelative(lua_State* L) {
static int l_lovrSourceSetRelative(lua_State* L) {
Source* source = luax_checktype(L, 1, Source);
bool isRelative = lua_toboolean(L, 2);
lovrSourceSetRelative(source, isRelative);
return 0;
}
int l_lovrSourceSetVelocity(lua_State* L) {
static int l_lovrSourceSetVelocity(lua_State* L) {
Source* source = luax_checktype(L, 1, Source);
float velocity[3];
luax_readvec3(L, 2, velocity, NULL);
@ -230,22 +230,22 @@ int l_lovrSourceSetVelocity(lua_State* L) {
return 0;
}
int l_lovrSourceSetVolume(lua_State* L) {
static int l_lovrSourceSetVolume(lua_State* L) {
lovrSourceSetVolume(luax_checktype(L, 1, Source), luax_checkfloat(L, 2));
return 0;
}
int l_lovrSourceSetVolumeLimits(lua_State* L) {
static int l_lovrSourceSetVolumeLimits(lua_State* L) {
lovrSourceSetVolumeLimits(luax_checktype(L, 1, Source), luax_checkfloat(L, 2), luax_checkfloat(L, 3));
return 0;
}
int l_lovrSourceStop(lua_State* L) {
static int l_lovrSourceStop(lua_State* L) {
lovrSourceStop(luax_checktype(L, 1, Source));
return 0;
}
int l_lovrSourceTell(lua_State* L) {
static int l_lovrSourceTell(lua_State* L) {
Source* source = luax_checktype(L, 1, Source);
TimeUnit unit = luaL_checkoption(L, 2, "seconds", TimeUnits);
int offset = lovrSourceTell(source);

View File

@ -1,4 +1,5 @@
#include "api.h"
#include "api/graphics.h"
#include "graphics/texture.h"
int luax_optmipmap(lua_State* L, int index, Texture* texture) {
@ -7,13 +8,13 @@ int luax_optmipmap(lua_State* L, int index, Texture* texture) {
return mipmap - 1;
}
int l_lovrTextureGetDepth(lua_State* L) {
static int l_lovrTextureGetDepth(lua_State* L) {
Texture* texture = luax_checktype(L, 1, Texture);
lua_pushnumber(L, lovrTextureGetDepth(texture, luax_optmipmap(L, 2, texture)));
return 1;
}
int l_lovrTextureGetDimensions(lua_State* L) {
static int l_lovrTextureGetDimensions(lua_State* L) {
Texture* texture = luax_checktype(L, 1, Texture);
int mipmap = luax_optmipmap(L, 2, texture);
lua_pushinteger(L, lovrTextureGetWidth(texture, mipmap));
@ -25,7 +26,7 @@ int l_lovrTextureGetDimensions(lua_State* L) {
return 2;
}
int l_lovrTextureGetFilter(lua_State* L) {
static int l_lovrTextureGetFilter(lua_State* L) {
Texture* texture = luax_checktype(L, 1, Texture);
TextureFilter filter = lovrTextureGetFilter(texture);
lua_pushstring(L, FilterModes[filter.mode]);
@ -36,37 +37,37 @@ int l_lovrTextureGetFilter(lua_State* L) {
return 1;
}
int l_lovrTextureGetFormat(lua_State* L) {
static int l_lovrTextureGetFormat(lua_State* L) {
Texture* texture = luax_checktype(L, 1, Texture);
lua_pushstring(L, TextureFormats[lovrTextureGetFormat(texture)]);
return 1;
}
int l_lovrTextureGetHeight(lua_State* L) {
static int l_lovrTextureGetHeight(lua_State* L) {
Texture* texture = luax_checktype(L, 1, Texture);
lua_pushnumber(L, lovrTextureGetHeight(texture, luax_optmipmap(L, 2, texture)));
return 1;
}
int l_lovrTextureGetMipmapCount(lua_State* L) {
static int l_lovrTextureGetMipmapCount(lua_State* L) {
Texture* texture = luax_checktype(L, 1, Texture);
lua_pushinteger(L, lovrTextureGetMipmapCount(texture));
return 1;
}
int l_lovrTextureGetType(lua_State* L) {
static int l_lovrTextureGetType(lua_State* L) {
Texture* texture = luax_checktype(L, 1, Texture);
lua_pushstring(L, TextureTypes[lovrTextureGetType(texture)]);
return 1;
}
int l_lovrTextureGetWidth(lua_State* L) {
static int l_lovrTextureGetWidth(lua_State* L) {
Texture* texture = luax_checktype(L, 1, Texture);
lua_pushnumber(L, lovrTextureGetWidth(texture, luax_optmipmap(L, 2, texture)));
return 1;
}
int l_lovrTextureGetWrap(lua_State* L) {
static int l_lovrTextureGetWrap(lua_State* L) {
Texture* texture = luax_checktype(L, 1, Texture);
TextureWrap wrap = lovrTextureGetWrap(texture);
lua_pushstring(L, WrapModes[wrap.s]);
@ -78,7 +79,7 @@ int l_lovrTextureGetWrap(lua_State* L) {
return 2;
}
int l_lovrTextureReplacePixels(lua_State* L) {
static int l_lovrTextureReplacePixels(lua_State* L) {
Texture* texture = luax_checktype(L, 1, Texture);
TextureData* textureData = luax_checktype(L, 2, TextureData);
int x = luaL_optinteger(L, 3, 0);
@ -89,7 +90,7 @@ int l_lovrTextureReplacePixels(lua_State* L) {
return 0;
}
int l_lovrTextureSetFilter(lua_State* L) {
static int l_lovrTextureSetFilter(lua_State* L) {
Texture* texture = luax_checktype(L, 1, Texture);
FilterMode mode = luaL_checkoption(L, 2, NULL, FilterModes);
float anisotropy = luax_optfloat(L, 3, 1.f);
@ -98,7 +99,7 @@ int l_lovrTextureSetFilter(lua_State* L) {
return 0;
}
int l_lovrTextureSetWrap(lua_State* L) {
static int l_lovrTextureSetWrap(lua_State* L) {
Texture* texture = luax_checktype(L, 1, Texture);
TextureWrap wrap;
wrap.s = luaL_checkoption(L, 2, NULL, WrapModes);

View File

@ -1,7 +1,7 @@
#include "api.h"
#include "data/textureData.h"
int l_lovrTextureDataEncode(lua_State* L) {
static int l_lovrTextureDataEncode(lua_State* L) {
TextureData* textureData = luax_checktype(L, 1, TextureData);
const char* filename = luaL_checkstring(L, 2);
bool success = lovrTextureDataEncode(textureData, filename);
@ -9,26 +9,26 @@ int l_lovrTextureDataEncode(lua_State* L) {
return 1;
}
int l_lovrTextureDataGetWidth(lua_State* L) {
static int l_lovrTextureDataGetWidth(lua_State* L) {
TextureData* textureData = luax_checktype(L, 1, TextureData);
lua_pushinteger(L, textureData->width);
return 1;
}
int l_lovrTextureDataGetHeight(lua_State* L) {
static int l_lovrTextureDataGetHeight(lua_State* L) {
TextureData* textureData = luax_checktype(L, 1, TextureData);
lua_pushinteger(L, textureData->height);
return 1;
}
int l_lovrTextureDataGetDimensions(lua_State* L) {
static int l_lovrTextureDataGetDimensions(lua_State* L) {
TextureData* textureData = luax_checktype(L, 1, TextureData);
lua_pushinteger(L, textureData->width);
lua_pushinteger(L, textureData->height);
return 2;
}
int l_lovrTextureDataGetPixel(lua_State* L) {
static int l_lovrTextureDataGetPixel(lua_State* L) {
TextureData* textureData = luax_checktype(L, 1, TextureData);
int x = luaL_checkinteger(L, 2);
int y = luaL_checkinteger(L, 3);
@ -40,7 +40,7 @@ int l_lovrTextureDataGetPixel(lua_State* L) {
return 4;
}
int l_lovrTextureDataSetPixel(lua_State* L) {
static int l_lovrTextureDataSetPixel(lua_State* L) {
TextureData* textureData = luax_checktype(L, 1, TextureData);
int x = luaL_checkinteger(L, 2);
int y = luaL_checkinteger(L, 3);

View File

@ -1,19 +1,19 @@
#include "api.h"
#include "thread/thread.h"
int l_lovrThreadStart(lua_State* L) {
static int l_lovrThreadStart(lua_State* L) {
Thread* thread = luax_checktype(L, 1, Thread);
lovrThreadStart(thread);
return 0;
}
int l_lovrThreadWait(lua_State* L) {
static int l_lovrThreadWait(lua_State* L) {
Thread* thread = luax_checktype(L, 1, Thread);
lovrThreadWait(thread);
return 0;
}
int l_lovrThreadGetError(lua_State* L) {
static int l_lovrThreadGetError(lua_State* L) {
Thread* thread = luax_checktype(L, 1, Thread);
const char* error = lovrThreadGetError(thread);
if (error) {
@ -24,7 +24,7 @@ int l_lovrThreadGetError(lua_State* L) {
return 1;
}
int l_lovrThreadIsRunning(lua_State* L) {
static int l_lovrThreadIsRunning(lua_State* L) {
Thread* thread = luax_checktype(L, 1, Thread);
lua_pushboolean(L, thread->running);
return 1;

View File

@ -37,7 +37,7 @@ static void raycastCallback(Shape* shape, float x, float y, float z, float nx, f
lua_call(L, 7, 0);
}
int l_lovrWorldNewCollider(lua_State* L) {
static int l_lovrWorldNewCollider(lua_State* L) {
World* world = luax_checktype(L, 1, World);
float x = luax_optfloat(L, 2, 0.f);
float y = luax_optfloat(L, 3, 0.f);
@ -48,7 +48,7 @@ int l_lovrWorldNewCollider(lua_State* L) {
return 1;
}
int l_lovrWorldNewBoxCollider(lua_State* L) {
static int l_lovrWorldNewBoxCollider(lua_State* L) {
World* world = luax_checktype(L, 1, World);
float x = luax_optfloat(L, 2, 0.f);
float y = luax_optfloat(L, 3, 0.f);
@ -65,7 +65,7 @@ int l_lovrWorldNewBoxCollider(lua_State* L) {
return 1;
}
int l_lovrWorldNewCapsuleCollider(lua_State* L) {
static int l_lovrWorldNewCapsuleCollider(lua_State* L) {
World* world = luax_checktype(L, 1, World);
float x = luax_optfloat(L, 2, 0.f);
float y = luax_optfloat(L, 3, 0.f);
@ -81,7 +81,7 @@ int l_lovrWorldNewCapsuleCollider(lua_State* L) {
return 1;
}
int l_lovrWorldNewCylinderCollider(lua_State* L) {
static int l_lovrWorldNewCylinderCollider(lua_State* L) {
World* world = luax_checktype(L, 1, World);
float x = luax_optfloat(L, 2, 0.f);
float y = luax_optfloat(L, 3, 0.f);
@ -97,7 +97,7 @@ int l_lovrWorldNewCylinderCollider(lua_State* L) {
return 1;
}
int l_lovrWorldNewSphereCollider(lua_State* L) {
static int l_lovrWorldNewSphereCollider(lua_State* L) {
World* world = luax_checktype(L, 1, World);
float x = luax_optfloat(L, 2, 0.f);
float y = luax_optfloat(L, 3, 0.f);
@ -112,13 +112,13 @@ int l_lovrWorldNewSphereCollider(lua_State* L) {
return 1;
}
int l_lovrWorldDestroy(lua_State* L) {
static int l_lovrWorldDestroy(lua_State* L) {
World* world = luax_checktype(L, 1, World);
lovrWorldDestroyData(world);
return 0;
}
int l_lovrWorldUpdate(lua_State* L) {
static int l_lovrWorldUpdate(lua_State* L) {
lua_settop(L, 3);
World* world = luax_checktype(L, 1, World);
float dt = luax_checkfloat(L, 2);
@ -127,20 +127,20 @@ int l_lovrWorldUpdate(lua_State* L) {
return 0;
}
int l_lovrWorldComputeOverlaps(lua_State* L) {
static int l_lovrWorldComputeOverlaps(lua_State* L) {
World* world = luax_checktype(L, 1, World);
lovrWorldComputeOverlaps(world);
return 0;
}
int l_lovrWorldOverlaps(lua_State* L) {
static int l_lovrWorldOverlaps(lua_State* L) {
luax_checktype(L, 1, World);
lua_settop(L, 1);
lua_pushcclosure(L, nextOverlap, 1);
return 1;
}
int l_lovrWorldCollide(lua_State* L) {
static int l_lovrWorldCollide(lua_State* L) {
World* world = luax_checktype(L, 1, World);
Shape* a = luax_checktype(L, 2, Shape);
Shape* b = luax_checktype(L, 3, Shape);
@ -150,7 +150,7 @@ int l_lovrWorldCollide(lua_State* L) {
return 1;
}
int l_lovrWorldGetGravity(lua_State* L) {
static int l_lovrWorldGetGravity(lua_State* L) {
World* world = luax_checktype(L, 1, World);
float x, y, z;
lovrWorldGetGravity(world, &x, &y, &z);
@ -160,7 +160,7 @@ int l_lovrWorldGetGravity(lua_State* L) {
return 3;
}
int l_lovrWorldSetGravity(lua_State* L) {
static int l_lovrWorldSetGravity(lua_State* L) {
World* world = luax_checktype(L, 1, World);
float x = luax_checkfloat(L, 2);
float y = luax_checkfloat(L, 3);
@ -169,7 +169,7 @@ int l_lovrWorldSetGravity(lua_State* L) {
return 0;
}
int l_lovrWorldGetLinearDamping(lua_State* L) {
static int l_lovrWorldGetLinearDamping(lua_State* L) {
World* world = luax_checktype(L, 1, World);
float damping, threshold;
lovrWorldGetLinearDamping(world, &damping, &threshold);
@ -178,7 +178,7 @@ int l_lovrWorldGetLinearDamping(lua_State* L) {
return 2;
}
int l_lovrWorldSetLinearDamping(lua_State* L) {
static int l_lovrWorldSetLinearDamping(lua_State* L) {
World* world = luax_checktype(L, 1, World);
float damping = luax_checkfloat(L, 2);
float threshold = luax_optfloat(L, 3, .01f);
@ -186,7 +186,7 @@ int l_lovrWorldSetLinearDamping(lua_State* L) {
return 0;
}
int l_lovrWorldGetAngularDamping(lua_State* L) {
static int l_lovrWorldGetAngularDamping(lua_State* L) {
World* world = luax_checktype(L, 1, World);
float damping, threshold;
lovrWorldGetAngularDamping(world, &damping, &threshold);
@ -195,7 +195,7 @@ int l_lovrWorldGetAngularDamping(lua_State* L) {
return 2;
}
int l_lovrWorldSetAngularDamping(lua_State* L) {
static int l_lovrWorldSetAngularDamping(lua_State* L) {
World* world = luax_checktype(L, 1, World);
float damping = luax_checkfloat(L, 2);
float threshold = luax_optfloat(L, 3, .01f);
@ -203,20 +203,20 @@ int l_lovrWorldSetAngularDamping(lua_State* L) {
return 0;
}
int l_lovrWorldIsSleepingAllowed(lua_State* L) {
static int l_lovrWorldIsSleepingAllowed(lua_State* L) {
World* world = luax_checktype(L, 1, World);
lua_pushboolean(L, lovrWorldIsSleepingAllowed(world));
return 1;
}
int l_lovrWorldSetSleepingAllowed(lua_State* L) {
static int l_lovrWorldSetSleepingAllowed(lua_State* L) {
World* world = luax_checktype(L, 1, World);
bool allowed = lua_toboolean(L, 2);
lovrWorldSetSleepingAllowed(world, allowed);
return 0;
}
int l_lovrWorldRaycast(lua_State* L) {
static int l_lovrWorldRaycast(lua_State* L) {
World* world = luax_checktype(L, 1, World);
float x1 = luax_checkfloat(L, 2);
float y1 = luax_checkfloat(L, 3);
@ -230,7 +230,7 @@ int l_lovrWorldRaycast(lua_State* L) {
return 0;
}
int l_lovrWorldDisableCollisionBetween(lua_State* L) {
static int l_lovrWorldDisableCollisionBetween(lua_State* L) {
World* world = luax_checktype(L, 1, World);
const char* tag1 = luaL_checkstring(L, 2);
const char* tag2 = luaL_checkstring(L, 3);
@ -238,7 +238,7 @@ int l_lovrWorldDisableCollisionBetween(lua_State* L) {
return 0;
}
int l_lovrWorldEnableCollisionBetween(lua_State* L) {
static int l_lovrWorldEnableCollisionBetween(lua_State* L) {
World* world = luax_checktype(L, 1, World);
const char* tag1 = luaL_checkstring(L, 2);
const char* tag2 = luaL_checkstring(L, 3);
@ -246,7 +246,7 @@ int l_lovrWorldEnableCollisionBetween(lua_State* L) {
return 0;
}
int l_lovrWorldIsCollisionEnabledBetween(lua_State* L) {
static int l_lovrWorldIsCollisionEnabledBetween(lua_State* L) {
World* world = luax_checktype(L, 1, World);
const char* tag1 = luaL_checkstring(L, 2);
const char* tag2 = luaL_checkstring(L, 3);

View File

@ -21,10 +21,6 @@ size_t lovrMeshGetIndexSize(Mesh* mesh) {
return mesh->indexSize;
}
int lovrMeshGetAttributeCount(Mesh* mesh) {
return mesh->attributeCount;
}
void lovrMeshAttachAttribute(Mesh* mesh, const char* name, MeshAttribute* attribute) {
lovrAssert(!map_get(&mesh->attributeMap, name), "Mesh already has an attribute named '%s'", name);
lovrAssert(mesh->attributeCount < MAX_ATTRIBUTES, "Mesh already has the max number of attributes (%d)", MAX_ATTRIBUTES);