| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- require "Polycode/Event"
- class "PhysicsScreenEvent" (Event)
- EVENT_NEW_SHAPE_COLLISION = 0
- EVENT_END_SHAPE_COLLISION = 1
- function PhysicsScreenEvent:__index__(name)
- if name == "localCollisionNormal" then
- retVal = Physics2D.PhysicsScreenEvent_get_localCollisionNormal(self.__ptr)
- if Polycore.__ptr_lookup[retVal] ~= nil then
- return Polycore.__ptr_lookup[retVal]
- else
- Polycore.__ptr_lookup[retVal] = Vector2("__skip_ptr__")
- Polycore.__ptr_lookup[retVal].__ptr = retVal
- return Polycore.__ptr_lookup[retVal]
- end
- elseif name == "worldCollisionNormal" then
- retVal = Physics2D.PhysicsScreenEvent_get_worldCollisionNormal(self.__ptr)
- if Polycore.__ptr_lookup[retVal] ~= nil then
- return Polycore.__ptr_lookup[retVal]
- else
- Polycore.__ptr_lookup[retVal] = Vector2("__skip_ptr__")
- Polycore.__ptr_lookup[retVal].__ptr = retVal
- return Polycore.__ptr_lookup[retVal]
- end
- elseif name == "localCollisionPoint" then
- retVal = Physics2D.PhysicsScreenEvent_get_localCollisionPoint(self.__ptr)
- if Polycore.__ptr_lookup[retVal] ~= nil then
- return Polycore.__ptr_lookup[retVal]
- else
- Polycore.__ptr_lookup[retVal] = Vector2("__skip_ptr__")
- Polycore.__ptr_lookup[retVal].__ptr = retVal
- return Polycore.__ptr_lookup[retVal]
- end
- elseif name == "impactStrength" then
- return Physics2D.PhysicsScreenEvent_get_impactStrength(self.__ptr)
- elseif name == "frictionStrength" then
- return Physics2D.PhysicsScreenEvent_get_frictionStrength(self.__ptr)
- end
- end
- function PhysicsScreenEvent:__set_callback(name,value)
- if name == "impactStrength" then
- Physics2D.PhysicsScreenEvent_set_impactStrength(self.__ptr, value)
- return true
- elseif name == "frictionStrength" then
- Physics2D.PhysicsScreenEvent_set_frictionStrength(self.__ptr, value)
- return true
- end
- return false
- end
- function PhysicsScreenEvent:PhysicsScreenEvent(...)
- if type(arg[1]) == "table" and count(arg) == 1 then
- if ""..arg[1]:class() == "Event" then
- self.__ptr = arg[1].__ptr
- return
- end
- end
- for k,v in pairs(arg) do
- if type(v) == "table" then
- if v.__ptr ~= nil then
- arg[k] = v.__ptr
- end
- end
- end
- if self.__ptr == nil and arg[1] ~= "__skip_ptr__" then
- self.__ptr = Physics2D.PhysicsScreenEvent(unpack(arg))
- Polycore.__ptr_lookup[self.__ptr] = self
- end
- end
- function PhysicsScreenEvent:getFirstEntity()
- local retVal = Physics2D.PhysicsScreenEvent_getFirstEntity(self.__ptr)
- if retVal == nil then return nil end
- if Polycore.__ptr_lookup[retVal] ~= nil then
- return Polycore.__ptr_lookup[retVal]
- else
- Polycore.__ptr_lookup[retVal] = ScreenEntity("__skip_ptr__")
- Polycore.__ptr_lookup[retVal].__ptr = retVal
- return Polycore.__ptr_lookup[retVal]
- end
- end
- function PhysicsScreenEvent:getSecondEntity()
- local retVal = Physics2D.PhysicsScreenEvent_getSecondEntity(self.__ptr)
- if retVal == nil then return nil end
- if Polycore.__ptr_lookup[retVal] ~= nil then
- return Polycore.__ptr_lookup[retVal]
- else
- Polycore.__ptr_lookup[retVal] = ScreenEntity("__skip_ptr__")
- Polycore.__ptr_lookup[retVal].__ptr = retVal
- return Polycore.__ptr_lookup[retVal]
- end
- end
- function PhysicsScreenEvent:__delete()
- Polycore.__ptr_lookup[self.__ptr] = nil
- Physics2D.delete_PhysicsScreenEvent(self.__ptr)
- end
|