ENTRY | DOWNLOAD | MANUAL | ONGOING | |
context.py"""Use a Context to set sprite attributes. by stephan) """ from slut import * class Atlantis(World): def onSetup(self): Sphere(self, 'sph1') redContext = ColorContext('redctxt') asphere = Sphere(self, 'sph2') asphere.addContext(redContext) asphere.moveBy(0.5, 0.0, 0.0) anothersphere = Sphere(self, 'sph3') anothersphere.addContext(redContext) anothersphere.moveBy(1.0, 0.0, 0.0) class Sphere(Sprite): def onDraw(self): circle(0, 0, 0, 1) class ColorContext(Context): def onPreDraw(self): glPushAttrib(GL_CURRENT_BIT) glColor4f(1.0, 0.5, 0.5, 1.0) def onPostDraw(self): glPopAttrib() atlantis = Atlantis() atlantis.run() |
|
Initiated by Stephan Hechenberger Thanks to CADRE's 103 |