Ejemplo n.º 1
0
def chess(screen, cola, colb):
    for i in xrange(WIDTH):
        for j in xrange(HEIGHT):
            if (i + j) % 2:
                c = cola
            else:
                c = colb
            RSDL_helper.set_pixel(screen, i, j, c)
Ejemplo n.º 2
0
def stripes_m(screen, cola, colb):
    for j in xrange(WIDTH):
        for i in xrange(HEIGHT):
            k = j * WIDTH + i
            if k % 2:
                c = cola
            else:
                c = colb
            RSDL_helper.set_pixel(screen, i, j, c)
Ejemplo n.º 3
0
 def draw_pixels(self):
     #pass
     str = ""
     for y in range(self.height):
         # str += "\n"
         for x in range(self.width):
             #if y%2 == 0 or True:
             #    px = self.get_pixel_color(x, y)
             #    str += ["#", "%", "+", " ", " "][px]
             RSDL_helper.set_pixel(self.screen, x, y,
                                   self.get_pixel_color(x, y))
Ejemplo n.º 4
0
    def draw_pixel(self, x, y, color):
        color = self.COLOR_MAP[color]
        start_x = x * self.scale
        start_y = y * self.scale

        if self.scale > 1:
            for x in range(self.scale):
                for y in range(self.scale):
                    RSDL_helper.set_pixel(self.screen, start_x + x,
                                          start_y + y, color)
        else:
            RSDL_helper.set_pixel(self.screen, start_x, start_y, color)
Ejemplo n.º 5
0
 def test_bit_pattern(self):
     HEIGHT = WIDTH = 10
     fmt = self.screen.c_format
     white = RSDL.MapRGB(fmt, 255, 255, 255)
     black = RSDL.MapRGB(fmt, 0, 0, 0)
     RSDL.LockSurface(self.screen)
     for i in xrange(WIDTH):
         for j in xrange(HEIGHT):
             k = j*WIDTH + i
             if k % 2:
                 c = white
             else:
                 c = black
             RSDL_helper.set_pixel(self.screen, i, j, c)
     RSDL.UnlockSurface(self.screen)
     RSDL.Flip(self.screen)
     self.check("Upper left corner 10x10 field with vertical black/white stripes")
Ejemplo n.º 6
0
 def draw_pixels(self):
     for x in range(self.width):
         for y in range(self.height):
             RSDL_helper.set_pixel(screen, x, y, self.get_pixel_color(x, y))
Ejemplo n.º 7
0
def black(screen, cola, colb):
    for i in xrange(WIDTH):
        for j in xrange(HEIGHT):
            RSDL_helper.set_pixel(screen, i, j, cola)