Merge simpler import path
This commit is contained in:
parent
870a1a827e
commit
b4f19d35fe
49 changed files with 101 additions and 24 deletions
15
Makefile
15
Makefile
|
@ -4,14 +4,10 @@
|
|||
all: install test
|
||||
|
||||
install:
|
||||
cd draw2d && go install
|
||||
cd draw2dgl && go install
|
||||
# cd wingui && make install
|
||||
go install ./...
|
||||
|
||||
build:
|
||||
cd draw2d && go build
|
||||
cd draw2dgl && go build
|
||||
# cd wingui && make build
|
||||
go build ./...
|
||||
|
||||
test:
|
||||
cd cmd && go build draw2dgl.go
|
||||
|
@ -23,14 +19,9 @@ test:
|
|||
#cd cmd && go build testX11draw.go
|
||||
|
||||
clean:
|
||||
cd draw2d && go clean
|
||||
# cd draw2dgl && make clean
|
||||
cd cmd && go clean
|
||||
go clean ./...
|
||||
# cd wingui && make clean
|
||||
|
||||
command:
|
||||
cd cmd && make
|
||||
|
||||
fmt:
|
||||
gofmt -w .
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ Some algorithms have been translated from the [antigrain.com](http://www.antigra
|
|||
Once you have Go installed, to install `draw2d`:
|
||||
|
||||
```sh
|
||||
$ go get github.com/llgcode/draw2d/draw2d
|
||||
$ go get github.com/llgcode/draw2d
|
||||
```
|
||||
|
||||
a good starting point is the [getting started](http://github.com/llgcode/draw2d/wiki/GettingStarted) wiki page.
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// +build ignore
|
||||
|
||||
// Ported from GLUT's samples. Original copyright below applies.
|
||||
|
||||
/* Copyright (c) Mark J. Kilgard, 1996. */
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
// Copyright 2010 The draw2d Authors. All rights reserved.
|
||||
// created: 21/11/2010 by Laurent Le Goff
|
||||
|
||||
// +build ignore
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
|
@ -11,7 +13,7 @@ import (
|
|||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/llgcode/draw2d/draw2d"
|
||||
"github.com/llgcode/draw2d"
|
||||
)
|
||||
|
||||
func saveToPngFile(filePath string, m image.Image) {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// +build ignore
|
||||
|
||||
// Ported from GLUT's samples. Original copyright below applies.
|
||||
|
||||
/* Copyright (c) Mark J. Kilgard, 1996. */
|
||||
|
@ -24,7 +26,7 @@ import (
|
|||
|
||||
"github.com/go-gl/gl/v2.1/gl"
|
||||
"github.com/go-gl/glfw/v3.1/glfw"
|
||||
"github.com/llgcode/draw2d/draw2d"
|
||||
"github.com/llgcode/draw2d"
|
||||
"github.com/llgcode/draw2d/draw2dgl"
|
||||
)
|
||||
|
||||
|
|
60
cmd/testX11draw.go
Normal file
60
cmd/testX11draw.go
Normal file
|
@ -0,0 +1,60 @@
|
|||
// +build ignore
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"exp/gui"
|
||||
"exp/gui/x11"
|
||||
"fmt"
|
||||
"image"
|
||||
"math"
|
||||
|
||||
"github.com/llgcode/draw2d"
|
||||
)
|
||||
|
||||
func main() {
|
||||
window, err := x11.NewWindow()
|
||||
if err != nil {
|
||||
fmt.Printf("Cannot open an x11 window\n")
|
||||
return
|
||||
}
|
||||
screen := window.Screen()
|
||||
gc := draw2d.NewGraphicContext(screen)
|
||||
gc.SetStrokeColor(image.Black)
|
||||
gc.SetFillColor(image.White)
|
||||
gc.Clear()
|
||||
for i := 0.0; i < 360; i = i + 10 { // Go from 0 to 360 degrees in 10 degree steps
|
||||
gc.BeginPath() // Start a new path
|
||||
gc.Save() // Keep rotations temporary
|
||||
gc.MoveTo(144, 144)
|
||||
gc.Rotate(i * (math.Pi / 180.0)) // Rotate by degrees on stack from 'for'
|
||||
gc.RLineTo(72, 0)
|
||||
gc.Stroke()
|
||||
gc.Restore() // Get back the unrotated state
|
||||
}
|
||||
|
||||
window.FlushImage()
|
||||
|
||||
gc.SetLineWidth(3)
|
||||
nbclick := 0
|
||||
for {
|
||||
|
||||
switch evt := (<-window.EventChan()).(type) {
|
||||
case gui.KeyEvent:
|
||||
if evt.Key == 'q' {
|
||||
window.Close()
|
||||
}
|
||||
case gui.MouseEvent:
|
||||
if evt.Buttons&1 != 0 {
|
||||
if nbclick%2 == 0 {
|
||||
gc.MoveTo(float64(evt.Loc.X), float64(evt.Loc.Y))
|
||||
} else {
|
||||
gc.LineTo(float64(evt.Loc.X), float64(evt.Loc.Y))
|
||||
gc.Stroke()
|
||||
window.FlushImage()
|
||||
}
|
||||
nbclick = nbclick + 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,3 +1,5 @@
|
|||
// +build ignore
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
|
@ -10,7 +12,7 @@ import (
|
|||
"math"
|
||||
"os"
|
||||
|
||||
"github.com/llgcode/draw2d/draw2d"
|
||||
"github.com/llgcode/draw2d"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
// Copyright 2010 The draw2d Authors. All rights reserved.
|
||||
// created: 21/11/2010 by Laurent Le Goff
|
||||
|
||||
// +build ignore
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
|
@ -13,7 +15,7 @@ import (
|
|||
"math"
|
||||
"os"
|
||||
|
||||
"github.com/llgcode/draw2d/draw2d"
|
||||
"github.com/llgcode/draw2d"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// +build ignore
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
|
@ -10,7 +12,7 @@ import (
|
|||
"math"
|
||||
"os"
|
||||
|
||||
"github.com/llgcode/draw2d/draw2d"
|
||||
"github.com/llgcode/draw2d"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// +build ignore
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
|
@ -10,7 +12,7 @@ import (
|
|||
"math"
|
||||
"os"
|
||||
|
||||
"github.com/llgcode/draw2d/draw2d"
|
||||
"github.com/llgcode/draw2d"
|
||||
)
|
||||
|
||||
func saveToPngFile(filePath string, m image.Image) {
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/llgcode/draw2d/draw2d/raster"
|
||||
"github.com/llgcode/draw2d/raster"
|
||||
)
|
||||
|
||||
var (
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"code.google.com/p/freetype-go/freetype/raster"
|
||||
"github.com/go-gl/gl/v2.1/gl"
|
||||
"github.com/llgcode/draw2d/draw2d"
|
||||
"github.com/llgcode/draw2d"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
"math"
|
||||
"os"
|
||||
|
||||
"github.com/llgcode/draw2d/draw2d"
|
||||
"github.com/llgcode/draw2d"
|
||||
)
|
||||
|
||||
func saveToPngFile(filePath string, m image.Image) {
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
// Copyright 2011 The draw2d Authors. All rights reserved.
|
||||
// created: 27/05/2011 by Laurent Le Goff
|
||||
|
||||
// +build ignore
|
||||
|
||||
package raster
|
||||
|
||||
import (
|
|
@ -1,5 +1,8 @@
|
|||
// Copyright 2011 The draw2d Authors. All rights reserved.
|
||||
// created: 27/05/2011 by Laurent Le Goff
|
||||
|
||||
// +build ignore
|
||||
|
||||
package raster
|
||||
|
||||
import (
|
|
@ -10,7 +10,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"code.google.com/p/freetype-go/freetype/raster"
|
||||
"github.com/llgcode/draw2d/draw2d/curve"
|
||||
"github.com/llgcode/draw2d/curve"
|
||||
)
|
||||
|
||||
var flattening_threshold float64 = 0.5
|
|
@ -1,3 +1,5 @@
|
|||
// +build windows
|
||||
|
||||
package wingui
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// +build ignore
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build ignore
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
|
@ -15,7 +17,7 @@ import (
|
|||
"time"
|
||||
"unsafe"
|
||||
|
||||
"github.com/llgcode/draw2d/draw2d"
|
||||
"github.com/llgcode/draw2d"
|
||||
"github.com/llgcode/draw2d/wingui"
|
||||
"github.com/llgcode/ps"
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue