Ejemplo n.º 1
0
    def __init__(self, w, h, game):
        """ Initialize and resize the canvas; load the game.

        :param w:  The width of the canvas in pixels
        :type w: int
        :param h:  The height of the canvas in pixels
        :type h: int
        
        """
        GWTCanvas.__init__(self, w, h)
        
        self.setSize(w,h)
        self.setStyleName('drophere')
        self.setStyleAttribute('position', 'relative')
        
        self.width = w
        self.height = h
        self.images = []
        self.img_dict = []
        for x in range(game.num_players):
            self.img_dict.append({})
            
        self.run = False
        self.resize(self.width, self.height)
        self.run = True
Ejemplo n.º 2
0
    def __init__(self, img_url):
        GWTCanvas.__init__(self, 300, 300, 300, 300)
        loadImages([img_url], self)
        self.width = 150
        self.height = 150

        self.isActive = True
        self.onTimer()
Ejemplo n.º 3
0
 def __init__(self, img_url):
     GWTCanvas.__init__(self, 300, 300, 300, 300)
     loadImages([img_url], self)
     self.width = 150
     self.height = 150
     
     self.isActive = True
     self.onTimer()
Ejemplo n.º 4
0
 def __init__(self):
     GWTCanvas.__init__(self, 300, 300, 300, 300)
     loadImages(
         [
             'images/sun.png',
             'images/moon.png',
             'images/earth.png',
         ],
         self,
     )
     
     self.isActive = True
     self.onTimer()
Ejemplo n.º 5
0
    def __init__(self, w, h):
        self.w = w
        self.h = h
        self.classify = False
        self.color = [(random.randint(0,256), random.randint(0,256), random.randint(0,256)),]
        self.PointList = []
        GWTCanvas.__init__(self, self.w, self.h)
        
        self.sinkEvents (Event.KEYEVENTS | Event.MOUSEEVENTS)
        self.clear()

        self.onTimer()
        self.resize(self.w, self.h)
Ejemplo n.º 6
0
    def __init__(self):
        GWTCanvas.__init__(self, 300, 300, 300, 300)
        loadImages(
            [
                'images/sun.png',
                'images/moon.png',
                'images/earth.png',
            ],
            self,
        )

        self.isActive = True
        self.onTimer()
Ejemplo n.º 7
0
Archivo: Space.py Proyecto: Afey/pyjs
    def __init__(self, w, h):
        GWTCanvas.__init__(self, w, h)
        self.width = w
        self.height = h
        
        self.model = Model(w, h)
        self.controller = Controller(self.model)

        images = ['./images/ship1.png',
                  './images/ship2.png',
                  './images/asteroid.png']
        loadImages(images, self)

        self.sinkEvents(Event.KEYEVENTS)
Ejemplo n.º 8
0
    def __init__(self, w, h):
        GWTCanvas.__init__(self, w, h)
        self.width = w
        self.height = h

        self.model = Model(w, h)
        self.controller = Controller(self.model)

        images = [
            './images/ship1.png', './images/ship2.png', './images/asteroid.png'
        ]
        loadImages(images, self)

        self.sinkEvents(Event.KEYEVENTS)
Ejemplo n.º 9
0
    def __init__(self, w, h):
        GWTCanvas.__init__(self, w, h)

        self.width = w
        self.height = h
        self.key_up = self.key_down = self.key_left = self.key_right = self.key_fire = False        

        images = ['./images/Ship1.png', './images/Ship2.png', './images/Asteroid.png']
        loadImages(images, self)
        self.run = False
        #self.ship = CanvasImage('images/Ship1.png')
        #self.ship_thrust = CanvasImage('images/Ship2.png')
        #self.asteroid = CanvasImage('images/Asteroid.png')
        #self.loader = ImageLoadListener()
        #self.loader.add(self.ship)
        #self.loader.add(self.ship_thrust)
        #self.loader.add(self.asteroid)

        self.num_asteroids = NUM_ASTEROIDS

        self.sinkEvents(Event.KEYEVENTS) 
        self.onTimer()
Ejemplo n.º 10
0
    def __init__(self, w, h):
        GWTCanvas.__init__(self, w, h)

        self.width = w
        self.height = h
        self.key_up = self.key_down = self.key_left = self.key_right = self.key_fire = False

        images = [
            './images/Ship1.png', './images/Ship2.png', './images/Asteroid.png'
        ]
        loadImages(images, self)
        self.run = False
        #self.ship = CanvasImage('images/Ship1.png')
        #self.ship_thrust = CanvasImage('images/Ship2.png')
        #self.asteroid = CanvasImage('images/Asteroid.png')
        #self.loader = ImageLoadListener()
        #self.loader.add(self.ship)
        #self.loader.add(self.ship_thrust)
        #self.loader.add(self.asteroid)

        self.num_asteroids = NUM_ASTEROIDS

        self.sinkEvents(Event.KEYEVENTS)
        self.onTimer()
Ejemplo n.º 11
0
 def __init__(self):
     GWTCanvas.__init__(self, 300, 300, 300, 300)
     self.draw()     
Ejemplo n.º 12
0
 def __init__(self):
     GWTCanvas.__init__(self, 150, 150, 150, 150)
     loadImages(['images/wallpaper.png'], self)
Ejemplo n.º 13
0
 def __init__(self):
     GWTCanvas.__init__(self, 150, 150, 150, 150)
     self.draw()
Ejemplo n.º 14
0
 def __init__(self):
     GWTCanvas.__init__(self, 150, 150, 150, 150)
     self.translate(75,75)
     self.draw()
Ejemplo n.º 15
0
 def __init__(self):
     GWTCanvas.__init__(self, 150, 150, 150, 150)
     self.translate(75, 75)
     self.draw()
Ejemplo n.º 16
0
 def __init__(self):
     GWTCanvas.__init__(self, 150, 150, 150, 150)
     self.c = getFirstChild(self.getElement())
     self.p = Processing(self.c)
     global p
     p = self.p
Ejemplo n.º 17
0
 def __init__(self):
     GWTCanvas.__init__(self, 150, 150, 150, 150)
     self.draw()
Ejemplo n.º 18
0
 def __init__(self):
     GWTCanvas.__init__(self, 150, 150, 150, 150)
     self.draw()
     self.addMouseListener(self)
     self.addKeyboardListener(self)
Ejemplo n.º 19
0
 def __init__(self):
     GWTCanvas.__init__(self, 150, 150, 150, 150)
     loadImages(['images/wallpaper.png'], self)
Ejemplo n.º 20
0
 def __init__(self):
     GWTCanvas.__init__(self, 150, 150, 150, 150)
     self.draw()
     self.addMouseListener(self)
     self.addKeyboardListener(self)
Ejemplo n.º 21
0
 def __init__(self):
     GWTCanvas.__init__(self, 300, 300, 300, 300)
     self.draw()
Ejemplo n.º 22
0
 def __init__(self):
     GWTCanvas.__init__(self, 150, 150, 150, 150)
     self.c = self.getCanvasElement()
     self.p = Processing(self.c)
     global p
     p = self.p
Ejemplo n.º 23
0
 def __init__(self):
     GWTCanvas.__init__(self, 150, 150, 150, 150)
     self.c = self.getCanvasElement()
     self.p = Processing (self.c)
     global p
     p = self.p