Cosmic Unicorn: Port paint example.

patch-cosmic-paint
Phil Howard 2023-02-27 12:28:25 +00:00
rodzic d4bb43a537
commit c9d39d813c
6 zmienionych plików z 16 dodań i 14 usunięć

Wyświetl plik

@ -1,6 +1,6 @@
# Galactic Paint
# Cosmic Paint
Galactic Paint lets you paint pixels onto your Galatic Unicorn over WiFi, in realtime!
Cosmic Paint lets you paint pixels onto your Cosmic Unicorn over WiFi, in realtime!
## Setting Up

Wyświetl plik

@ -2,15 +2,15 @@ import os
from microdot_asyncio import Microdot, send_file
from microdot_asyncio_websocket import with_websocket
from phew import connect_to_wifi
from galactic import GalacticUnicorn
from picographics import PicoGraphics, DISPLAY_GALACTIC_UNICORN as DISPLAY
from cosmic import CosmicUnicorn
from picographics import PicoGraphics, DISPLAY_COSMIC_UNICORN as DISPLAY
from WIFI_CONFIG import SSID, PSK
gu = GalacticUnicorn()
cu = CosmicUnicorn()
graphics = PicoGraphics(DISPLAY)
mv_graphics = memoryview(graphics)
gu.set_brightness(0.5)
cu.set_brightness(0.5)
WIDTH, HEIGHT = graphics.get_bounds()
@ -24,12 +24,12 @@ server = Microdot()
@server.route("/", methods=["GET"])
def route_index(request):
return send_file("galactic_paint/index.html")
return send_file("cosmic_paint/index.html")
@server.route("/static/<path:path>", methods=["GET"])
def route_static(request, path):
return send_file(f"galactic_paint/static/{path}")
return send_file(f"cosmic_paint/static/{path}")
def get_pixel(x, y):
@ -86,7 +86,7 @@ async def echo(request, ws):
except ValueError:
if data == "show":
gu.update(graphics)
cu.update(graphics)
if data == "fill":
data = await ws.receive()

Wyświetl plik

@ -2,14 +2,14 @@
<html>
<head>
<meta charset="utf-8">
<title>Galactic Paint</title>
<title>Cosmic Paint</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="//cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="/static/paint.css">
</head>
<body>
<div class="window">
<h1>Galactic Paint</h1>
<h1>Cosmic Paint</h1>
<table cellspacing="0" cellpadding="0" border-collapse="collapse">
<tbody></tbody>
</table>

Wyświetl plik

@ -64,7 +64,7 @@ body {
}
.window {
width: 976px;
width: 640px;
position: relative;
background: #0E071A;
box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.5);

Wyświetl plik

@ -1,5 +1,7 @@
'use strict';
var WIDTH = 32;
var HEIGHT = 32;
var md = false;
var color = tinycolor('#840000');
var update;
@ -20,9 +22,9 @@ $(document).ready(function(){
return false;
});
for (var y = 0; y < 11; y++) {
for (var y = 0; y < HEIGHT; y++) {
var row = $('<tr></tr>');
for (var x = 0; x < 53; x++) {
for (var x = 0; x < WIDTH; x++) {
row.append('<td></td>');
}
$('tbody').append(row);