Operation | complex128 | struct |
---|---|---|
New vector | pixel.V(x, y) | pixel.Vec{X: x, Y: y} or pixel.V(x, y) |
Get coord | u.X() | u.X |
Set coord | u = u.WithX(x) | u.X = x |
Add to coord | u += pixel.X(x) | u.X += x |
Mul coord | u = u.ScaledXY(pixel.V(c, 1)) | u.X *= c |
Add vectors | u + v | u.Add(v) |
Scale vector | u = u.Scaled(c) | u = u.Scaled(c) |
Mul vectors | u = u.ScaledXY(v) | u = u.ScaledXY(v) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"io/ioutil" | |
"math/rand" | |
"os" | |
"time" | |
_ "image/jpeg" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"io/ioutil" | |
"math/rand" | |
"os" | |
"time" | |
_ "image/jpeg" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"image" | |
"image/draw" | |
"math/rand" | |
"golang.org/x/image/colornames" | |
"github.com/faiface/pixel" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmd1 := exec.Command("cmd1") | |
cmd2 := exec.Command("cmd2") | |
cmd1.Stdin = cmd2.Stdout | |
cmd2.Stdin = cmd1.Stdout | |
cmd1.Start() | |
cmd2.Start() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Proboj interface { | |
ReadPlayer(r io.Reader) interface{} | |
ActPlayer(i int, turn interface{}) | |
WriteState(w io.Writer) | |
Update() | |
} | |
func RunProboj(proboj Proboj, players []string) { | |
turnChans := make([]chan interface{}, len(players)) | |
playerIns := make([]io.Writer, len(players)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"math" | |
"time" | |
"github.com/faiface/pixel/audio" | |
"github.com/faiface/pixel/audio/speaker" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"math" | |
"time" | |
"github.com/faiface/pixel/audio" | |
"github.com/faiface/pixel/audio/speaker" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"math" | |
"time" | |
"github.com/faiface/pixel" | |
"github.com/faiface/pixel/audio" | |
"github.com/faiface/pixel/audio/speaker" | |
"github.com/faiface/pixel/pixelgl" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"math" | |
"time" | |
"github.com/faiface/pixel" | |
"github.com/faiface/pixel/audio" | |
"github.com/faiface/pixel/audio/speaker" | |
"github.com/faiface/pixel/pixelgl" |
OlderNewer