package main
import (
"image"
"image/color"
"github.com/codeation/impress"
"github.com/codeation/impress/event"
_ "github.com/codeation/impress/duo"
)
func main() {
app := impress.NewApplication(image.Rect(0, 0, 480, 240), "Hello World Application")
defer app.Close()
font := app.NewFont(15, map[string]string{"family": "Verdana"})
defer font.Close()
w := app.NewWindow(image.Rect(0, 0, 480, 240), color.RGBA{255, 255, 255, 255})
defer w.Drop()
w.Text("Hello, world!", font, image.Pt(200, 100), color.RGBA{0, 0, 0, 255})
w.Line(image.Pt(200, 120), image.Pt(300, 120), color.RGBA{255, 0, 0, 255})
w.Show()
app.Sync()
for {
e := <-app.Chan()
if e == event.DestroyEvent || e == event.KeyExit {
break
}
}
}
See an explanation of the source code in a library overview.
Install gcc
, make
, pkg-config
if you don't have them installed.
Install GTK+ 3 libraries if you don't have them installed:
sudo apt-get install libgtk-3-dev
git clone https://github.com/codeation/it.git
cd it
make
cd ..
git clone https://github.com/codeation/impress.git
cd impress
IMPRESS_TERMINAL_PATH=../it/it go run ./examples/simple/
Steps 0-2 are needed to build a impress terminal binary. See impress terminal page for other options for downloading or building impress terminal app.