pastebin - collaborative debugging tool
alicesucks.kpaste.net RSS


Untitled
Posted by Anonymous on Sat 11th Dec 2010 23:01
raw | new post

  1. # import core classes
  2. from edu.cmu.cs.stage3.alice.core import *
  3. from edu.cmu.cs.stage3.alice.core.event import *
  4. from edu.cmu.cs.stage3.alice.core.response import *
  5. from edu.cmu.cs.stage3.alice.core.property import *
  6. from edu.cmu.cs.stage3.alice.core.question import *
  7.  
  8. # import constants
  9. from edu.cmu.cs.stage3.alice.core.Direction import *
  10. from edu.cmu.cs.stage3.alice.core.style.TraditionalAnimationStyle import *
  11.  
  12. # import image
  13. from java.awt.image import *
  14.  
  15. # import misc
  16. from edu.cmu.cs.stage3.alice.authoringtool import *
  17. from edu.cmu.cs.stage3.alice.authoringtool.util import *
  18.  
  19. # constants
  20. WIDTH_IN_PIXELS = 640
  21. HEIGHT_IN_PIXELS = int(round(WIDTH_IN_PIXELS / 4 * 3.0))
  22.  
  23. WIDTH_IN_CELLS = 40
  24. HEIGHT_IN_CELLS = int(round(WIDTH_IN_CELLS / 4 * 3.0))
  25.  
  26. # variables
  27. screenObj = None        # the Billboard object that represents the screen
  28. img = None              # a BufferedImage that is passed to setTexture
  29. mImg = None             # modifiable image, a Graphics2D object
  30.  
  31. # textures
  32. def setTexture(object, image):
  33.         '''
  34.         takes java.awt.Image, makes it texture of object
  35.         '''
  36.         texture = TextureMap()
  37.         texture.propertyChanged(PropertyEvent(texture.image, image))
  38.         object.propertyChanged(PropertyEvent(object._diffuseColorMap, texture))
  39.  
  40. def getTextureImage(object):
  41.         '''
  42.         returns java.awt.Image
  43.         '''
  44.         return object.diffuseColorMap.image
  45.  
  46. #mouse
  47. def handleMouseClick():
  48.         pass
  49.  
  50. #misc
  51. def onScreen(obj):
  52.         world.bool = camera.canSee(obj, false)
  53.  
  54. def main(screen):
  55.         global screenObj
  56.         global img
  57.         global mImg
  58.         screenObj = screen
  59.         # lol even the almighty alice programmers used hacks
  60.         img = AuthoringTool.getHack().getJAliceFrame().getGraphicsConfiguration().createCompatibleImage(WIDTH_IN_PIXELS, HEIGHT_IN_PIXELS)
  61.         mImg = img.createGraphics()
  62.         setTexture(screen, img)

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.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at