File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- Go SDK for Pocketbook based on libinkview.
1+ Go SDK for Pocketbook based on libinkview.
2+
3+ To build your app or examples, run:
4+
5+ ``` bash
6+ cd ./go_app_path/
7+ docker run --rm -v $PWD :/app dennwc/pocketbook-go-sdk main.go
8+ ```
Original file line number Diff line number Diff line change 1+ package main
2+
3+ import (
4+ "github.com/dennwc/inkview"
5+ )
6+
7+ func main () {
8+ var (
9+ log * ink.Log
10+ )
11+ ink .Run (func (e ink.Event ) {
12+ switch e := e .(type ) {
13+ case ink.InitEvent :
14+ ink .ClearScreen ()
15+ log = ink .NewLog (ink .Pad (ink .Screen (), 10 ), 14 )
16+
17+ log .Println ("Device:" )
18+ log .Println (ink .DeviceModel ())
19+ log .Println (ink .SoftwareVersion ())
20+ log .Println (ink .HwAddress ())
21+ log .Println ()
22+
23+ for _ , name := range ink .Connections () {
24+ log .Printf ("conn: %q" , name )
25+ }
26+ log .Draw ()
27+
28+ ink .FullUpdate ()
29+ case ink.ExitEvent :
30+ log .Close ()
31+ case ink.PointerEvent :
32+ if e .State == ink .PointerDown {
33+ log .Printf ("click: %v" , e .Point )
34+ log .Draw ()
35+ ink .SoftUpdate ()
36+ }
37+ case ink.KeyEvent :
38+ if e .Key == ink .KeyPrev && e .State == ink .KeyStateDown {
39+ ink .Close ()
40+ }
41+ }
42+ })
43+ }
You can’t perform that action at this time.
0 commit comments