| 155 | } |
| 156 | |
| 157 | void LuaVM::InitEngineModule(const GameWorld *gameWorld) { |
| 158 | LuaVM::gameWorld = gameWorld; |
| 159 | |
| 160 | state->RegisterModule("blueshift", [this](LuaCpp::Module &module) { |
| 161 | module["log"].SetFunc([](const std::string &msg) { |
| 162 | BE_LOG("%s\n", msg.c_str()); |
| 163 | }); |
| 164 | module["unit_to_centi"].SetFunc(static_cast<float(*)(float)>(&UnitToCenti)); |
| 165 | module["unit_to_meter"].SetFunc(static_cast<float(*)(float)>(&UnitToMeter)); |
| 166 | module["centi_to_unit"].SetFunc(static_cast<float(*)(float)>(&CentiToUnit)); |
| 167 | module["meter_to_unit"].SetFunc(static_cast<float(*)(float)>(&MeterToUnit)); |
| 168 | |
| 169 | // Math |
| 170 | RegisterMath(module); |
| 171 | RegisterComplex(module); |
| 172 | RegisterVec2(module); |
| 173 | RegisterVec3(module); |
| 174 | RegisterVec4(module); |
| 175 | RegisterColor3(module); |
| 176 | RegisterColor4(module); |
| 177 | RegisterMat2(module); |
| 178 | RegisterMat3(module); |
| 179 | RegisterMat3x4(module); |
| 180 | RegisterMat4(module); |
| 181 | RegisterQuaternion(module); |
| 182 | RegisterAngles(module); |
| 183 | RegisterRotation(module); |
| 184 | RegisterPlane(module); |
| 185 | RegisterSphere(module); |
| 186 | RegisterCylinder(module); |
| 187 | RegisterAABB(module); |
| 188 | RegisterOBB(module); |
| 189 | RegisterFrustum(module); |
| 190 | RegisterRay(module); |
| 191 | RegisterPoint(module); |
| 192 | RegisterPointF(module); |
| 193 | RegisterSize(module); |
| 194 | RegisterSizeF(module); |
| 195 | RegisterRect(module); |
| 196 | RegisterRectF(module); |
| 197 | // Common |
| 198 | RegisterCommon(module); |
| 199 | // Input |
| 200 | RegisterInput(module); |
| 201 | // Screen |
| 202 | RegisterScreen(module); |
| 203 | // Physics |
| 204 | RegisterPhysics(module); |
| 205 | // Str |
| 206 | RegisterStr(module); |
| 207 | // Guid |
| 208 | RegisterGuid(module); |
| 209 | // File |
| 210 | RegisterFile(module); |
| 211 | RegisterFileSystem(module); |
| 212 | // Object |
| 213 | RegisterObject(module); |
| 214 | // Asset |