Example #1
0
    def setup(self):
        pyg.setSize((256, 128), (512, 256))
        pyg.setTitle("3D Demo")
        self.ball = pyg.loadImage("res/ball.png")
        font = pyg.font8x8.Font(pyg)

        msg = "Welcome to pyg!"
        msg2 = "pyg is an easy-to-use solution"
        msg3 = "for PyGame."
        self.msgImg = pyg.createImage(len(msg2) * 8, 25)
        font.setPos(1, 1)
        font.setColor(pyg.Color(0, 0, 0))
        font.printStr(msg, surf=self.msgImg)
        font.setPos(1, 9)
        font.printStr(msg2, surf=self.msgImg)
        font.setPos(1, 17)
        font.printStr(msg3, surf=self.msgImg)

        font.setPos(0, 0)
        font.setColor(pyg.Color(255, 255, 255))
        font.printStr(msg, surf=self.msgImg)
        font.setPos(0, 8)
        font.printStr(msg2, surf=self.msgImg)
        font.setPos(0, 16)
        font.printStr(msg3, surf=self.msgImg)

        self.ra = 0
        self.rb = 0

        self.b = [[0, 0, 0]] * 5 * 5 * 5
        for z in range(5):
            for y in range(5):
                for x in range(5):
                    self.b[z * 25 + y * 5 + x] = [(x - 2) * 2, (y - 2) * 2,
                                                  (z - 2) * 2]
Example #2
0
	def setup(self):
		pyg.setSize((160,160),(320,320))
		pyg.setTitle("PYG2 Test")	
		
		self.img = pyg.loadImage("res/pic.png")
		
		f = font.Font(pyg)
		self.img_shake = pyg.createImage(48, 8)
		f.printStr("Shake!",surf=self.img_shake, pos=(0,0))

		self.img_flip = pyg.createImage(32,8)
		f.printStr("Flip",surf=self.img_flip, pos=(0,0))

		self.img_rot = pyg.createImage(48,8)
		f.printStr("Rotate",surf=self.img_rot, pos=(0,0))

		self.img_msg = pyg.createImage(160,24)
		f.printStr("Let'sTry MouseMotion", surf=self.img_msg, pos=(0,0))
		f.printStr("[F11] ToggleFullScr.", surf=self.img_msg, pos=(0,8))
		f.printStr("[ESC] Quit App.", surf=self.img_msg, pos=(0,16))

		self.sp = {
			"player":(0,0,8,8),
			"tomato":(8,0,8,8),
			"block":(16,0,8,8),
			}
Example #3
0
 def setup(self):
     pyg.setSize((128, 128), (256, 256))
     pyg.setTitle("hello world")
     self.img = pyg.createImage(88, 8)
     font = pyg.font8x8.Font(pyg)
     font.printStr("Hello World", surf=self.img)
     self.r = 0
Example #4
0
 def setup(self):
     pyg.setSize((320, 320))
     pyg.setTitle("polygon")
     self.rx = 0
     self.ry = 0
     self.rz = 0
     self.p = (-1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 1, -1,
               1, -1, -1, -1, -1, -1)
     self.link = ((0, 1, 2), (0, 2, 3), (1, 5, 6), (1, 6, 2), (5, 4, 7),
                  (5, 7, 6), (4, 0, 3), (4, 3, 7), (4, 1, 0), (4, 5, 1),
                  (3, 2, 6), (3, 6, 7))
Example #5
0
 def setup(self):
     pyg.setSize((128, 128))
     pyg.setTitle("Simple")
Example #6
0
 def setup(self):
     pyg.setSize((512, 256))
     imgAddr = "https://www.python.org/static/img/python-logo.png"
     res = net.urlopen(imgAddr).read()
     imgfile = io.BytesIO(res)
     self.img = pyg.loadImage(imgfile)