File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ static constexpr char PSYQO_FIXEDPOINT_METATABLE[] = "psyqo.FixedPoint";
4646void psyqo::Lua::push (FixedPoint<> fp) {
4747 // Get the FixedPoint constructor from registry
4848 getMetatable (PSYQO_FIXEDPOINT_METATABLE);
49- getField (-1 , " new " );
49+ getField (-1 , " newFromRaw " );
5050 pushNumber (fp.raw ());
5151 call (1 , 1 ); // Create new FixedPoint table
5252 remove (-2 ); // Remove metatable from stack
@@ -329,9 +329,15 @@ void psyqo::Lua::setupFixedPointMetatable() {
329329 end
330330
331331 -- Create a new FixedPoint from raw value
332- function FixedPoint.new (raw_value)
332+ function FixedPoint.newFromRaw (raw_value)
333333 return setmetatable({_raw = raw_value}, FixedPoint)
334334 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
335341 end
336342 )lua" ;
337343
You can’t perform that action at this time.
0 commit comments