Add files via upload
This commit is contained in:
parent
1f5814c622
commit
97c52dd9da
2 changed files with 12 additions and 8 deletions
|
@ -24,11 +24,7 @@ class rect:
|
|||
pass
|
||||
return locals()
|
||||
height = property(**height())
|
||||
def contains(self, xorect, y=None):
|
||||
if type(xorect) == rect and y == None:
|
||||
return pg.Rect(self.x,self.y,
|
||||
self.w,self.h).contains(pg.Rect(
|
||||
xorect.x,xorect.y,xorect.w,xorect.h))
|
||||
elif type(xorect) != rect and y != None:
|
||||
return pg.Rect(self.x,self.y,self.w,
|
||||
self.h).collidepoint((xorect,y))
|
||||
def collide(self, x):
|
||||
return pg.Rect(self.x,self.y,self.w,self.h).colliderect(pg.Rect(x.x,x.y,x.w,x.h))
|
||||
def contains(self, x, y):
|
||||
return pg.Rect(self.x,self.y,self.w,self.h).collidepoint(x,y)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from pygwin.rect import rect as _r
|
||||
from pygwin._pg import pg as _pg
|
||||
|
||||
class surface:
|
||||
|
@ -69,6 +70,13 @@ class surface:
|
|||
self._orig = _pg.transform.smoothscale(self._orig,scale)
|
||||
self._orig = _pg.transform.smoothscale(self._orig,self._orig.get_size())
|
||||
return self.copy()
|
||||
def rect(self, x=0, y=0, center=None):
|
||||
if center == None:
|
||||
return _r(x, y, self.size[0], self.size[1])
|
||||
else:
|
||||
return _r(center[0]-(self.size[0]/2),
|
||||
center[1]-(self.size[1]/2),
|
||||
self.size[0], self.size[1])
|
||||
class _draw:
|
||||
def __init__(self,surface):
|
||||
self._surf = surface
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue