Browse Source

messing around with example code

master
Brennen Bearnes 6 years ago
commit
250e5c3030
3 changed files with 74 additions and 0 deletions
  1. +25
    -0
      listener.js
  2. +3
    -0
      listener.sh
  3. +46
    -0
      raspipe.py

+ 25
- 0
listener.js View File

@ -0,0 +1,25 @@
#!/usr/bin/env node
var net = require('net'),
sys = require('sys');
net.createServer(onConnection).listen(5280);
function onConnection(socket) {
socket.setNoDelay(true);
socket.addListener("connect", function () {
// sys.puts('client connected: ' + this.remoteAddress);
});
socket.addListener("data", function (data) {
sys.puts(data);
});
socket.addListener("end", function () {
// sys.puts('end of connection');
this.end();
});
}
sys.puts('Server running at 127.0.0.1:8124');

+ 3
- 0
listener.sh View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
export SDL_FBDEV=/dev/fb1
./listener.js | ./raspipe.py

+ 46
- 0
raspipe.py View File

@ -0,0 +1,46 @@
#!/usr/bin/env python
# encoding: utf-8
import sys
import pygame
import re
pygame.init()
size = width, height = 320, 240
black = (0, 0, 0)
white = (255,255,255)
font_big = pygame.font.Font(None, 40)
screen = pygame.display.set_mode(size)
line = sys.stdin.readline()
while line:
stars = re.sub('\S', '', line)
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
screen.fill(black)
text_surface = font_big.render(line, True, white)
rect = text_surface.get_rect(center=(160,120))
screen.blit(text_surface, rect)
# a = 100
# if pygame.key.get_focused():
# press = pygame.key.get_pressed()
# for i in xrange(0,len(press)):
# if press[i] == 1:
# name = pygame.key.name(i)
# text = font_big.render(name, True, white)
# screen.blit(text, (100, a))
# a=a+100
# if name == "q":
# sys.exit()
pygame.display.flip()
line = sys.stdin.readline()

Loading…
Cancel
Save