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
|
pass
|
||||||
return locals()
|
return locals()
|
||||||
height = property(**height())
|
height = property(**height())
|
||||||
def contains(self, xorect, y=None):
|
def collide(self, x):
|
||||||
if type(xorect) == rect and y == None:
|
return pg.Rect(self.x,self.y,self.w,self.h).colliderect(pg.Rect(x.x,x.y,x.w,x.h))
|
||||||
return pg.Rect(self.x,self.y,
|
def contains(self, x, y):
|
||||||
self.w,self.h).contains(pg.Rect(
|
return pg.Rect(self.x,self.y,self.w,self.h).collidepoint(x,y)
|
||||||
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))
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from pygwin.rect import rect as _r
|
||||||
from pygwin._pg import pg as _pg
|
from pygwin._pg import pg as _pg
|
||||||
|
|
||||||
class surface:
|
class surface:
|
||||||
|
@ -69,6 +70,13 @@ class surface:
|
||||||
self._orig = _pg.transform.smoothscale(self._orig,scale)
|
self._orig = _pg.transform.smoothscale(self._orig,scale)
|
||||||
self._orig = _pg.transform.smoothscale(self._orig,self._orig.get_size())
|
self._orig = _pg.transform.smoothscale(self._orig,self._orig.get_size())
|
||||||
return self.copy()
|
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:
|
class _draw:
|
||||||
def __init__(self,surface):
|
def __init__(self,surface):
|
||||||
self._surf = surface
|
self._surf = surface
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue