Example #1
0
        
bitmap = caca.create_bitmap(32,32,32,32*4,0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000)
#caca.set_bitmap_palette(bitmap, r, g, b, a)


color = 0

while caca.get_event(caca.CACA_EVENT_KEY_PRESS) != caca.CACA_EVENT_KEY_PRESS|caca.CACA_KEY_ESCAPE:

    for y in range(0,32):
         for x in range(0,(32*4), 4):
            offset = x + y * (32*4)
            pixels[offset]   = rand.random()*256
            pixels[offset+1] = rand.random()*256
            pixels[offset+2] = rand.random()*256
            pixels[offset+3] = 128
            

        
    color = color + 1

    caca.draw_bitmap(0,0,caca.get_width() - 1, caca.get_height() - 1,
                     bitmap, pixels)
        
    caca.refresh();



caca.end();
Example #2
0
#!/usr/bin/python2.4

import caca
import math
from random import Random
from math import *


ret = caca.init()
print "caca.init() returned ", ret
print "Window size is ",caca.get_window_width(),"x",caca.get_window_height()
print "Buffer size is ",caca.get_width(),"x",caca.get_height()

caca.set_size(80,25)
print "Buffer size is now",caca.get_width(),"x",caca.get_height()


print "Feature name for CACA_DITHERING_FSTEIN is "+caca.get_feature_name(caca.CACA_DITHERING_FSTEIN)


sprite = int(caca.load_sprite("./caca.txt"))


rand = Random()

i = 0
while caca.get_event(caca.CACA_EVENT_KEY_PRESS) != caca.CACA_EVENT_KEY_PRESS|caca.CACA_KEY_ESCAPE:


    i=i+1;