- # import core classes
- from edu.cmu.cs.stage3.alice.core import *
- from edu.cmu.cs.stage3.alice.core.event import *
- from edu.cmu.cs.stage3.alice.core.response import *
- from edu.cmu.cs.stage3.alice.core.property import *
- from edu.cmu.cs.stage3.alice.core.question import *
- # import constants
- from edu.cmu.cs.stage3.alice.core.Direction import *
- from edu.cmu.cs.stage3.alice.core.style.TraditionalAnimationStyle import *
- # import image
- from java.awt.image import *
- # import misc
- from edu.cmu.cs.stage3.alice.authoringtool import *
- from edu.cmu.cs.stage3.alice.authoringtool.util import *
- # constants
- WIDTH_IN_PIXELS = 640
- HEIGHT_IN_PIXELS = int(round(WIDTH_IN_PIXELS / 4 * 3.0))
- WIDTH_IN_CELLS = 40
- HEIGHT_IN_CELLS = int(round(WIDTH_IN_CELLS / 4 * 3.0))
- # variables
- screenObj = None # the Billboard object that represents the screen
- img = None # a BufferedImage that is passed to setTexture
- mImg = None # modifiable image, a Graphics2D object
- # textures
- def setTexture(object, image):
- '''
- takes java.awt.Image, makes it texture of object
- '''
- texture = TextureMap()
- texture.propertyChanged(PropertyEvent(texture.image, image))
- object.propertyChanged(PropertyEvent(object._diffuseColorMap, texture))
- def getTextureImage(object):
- '''
- returns java.awt.Image
- '''
- return object.diffuseColorMap.image
- #mouse
- def handleMouseClick():
- pass
- #misc
- def onScreen(obj):
- world.bool = camera.canSee(obj, false)
- def main(screen):
- global screenObj
- global img
- global mImg
- screenObj = screen
- # lol even the almighty alice programmers used hacks
- img = AuthoringTool.getHack().getJAliceFrame().getGraphicsConfiguration().createCompatibleImage(WIDTH_IN_PIXELS, HEIGHT_IN_PIXELS)
- mImg = img.createGraphics()
- setTexture(screen, img)
Untitled
Posted by Anonymous on Sat 11th Dec 2010 23:01
raw | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.