예제 #1
0
파일: move.py 프로젝트: elout/lewd
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with lewd.  If not, see <http://www.gnu.org/licenses/>.

  See the file COPYING, included in this distribution,
  for details about the copyright.
"""
""" Simple ``move'' animation. Use w,a,s,d to move, q to stop"""
import led
import sync
import curses

s = led.LedScreen()

ci = CursesInput()

pos = (0, 0)

lastch = -1

metronome = sync.Metronome(fps=25.)
metronome.start()

try:
    while True:
        for x in range(12):
            for y in range(10):
                s[(x, y)] = 25, 25, 25
예제 #2
0
        asyncore.dispatcher_with_send.__init__(self, sock)
        self.data = ''

    def handle_read(self):
        data = self.recv(12*10*3)
        self.data += data
        if len(self.data) < 12*10*3:
            return

        screen.push_data(self.data[:12*10*3])
        self.data = self.data[12*10*3:]

class SocketServer(asyncore.dispatcher):

    def __init__(self, port):
        asyncore.dispatcher.__init__(self)
        self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
        self.bind(('', port))
        self.listen(5)

    def handle_accept(self):
        conn, addr = self.accept()
        LEDConnection(self, conn, addr)


screen = led.LedScreen()
s = SocketServer(8000)
asyncore.loop()