File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ static constexpr char PSYQO_FIXEDPOINT_METATABLE[] = "psyqo.FixedPoint";
46
46
void psyqo::Lua::push (FixedPoint<> fp) {
47
47
// Get the FixedPoint constructor from registry
48
48
getMetatable (PSYQO_FIXEDPOINT_METATABLE);
49
- getField (-1 , " new " );
49
+ getField (-1 , " newFromRaw " );
50
50
pushNumber (fp.raw ());
51
51
call (1 , 1 ); // Create new FixedPoint table
52
52
remove (-2 ); // Remove metatable from stack
@@ -329,9 +329,15 @@ void psyqo::Lua::setupFixedPointMetatable() {
329
329
end
330
330
331
331
-- Create a new FixedPoint from raw value
332
- function FixedPoint.new (raw_value)
332
+ function FixedPoint.newFromRaw (raw_value)
333
333
return setmetatable({_raw = raw_value}, FixedPoint)
334
334
end
335
+
336
+ -- Create a new FixedPoint
337
+ function FixedPoint.new(integer, fraction)
338
+ if fraction == nil then fraction = 0 end
339
+ return setmetatable({_raw = bit.lshift(integer, 12) + fraction}, FixedPoint)
340
+ end
335
341
end
336
342
)lua" ;
337
343
You can’t perform that action at this time.
0 commit comments