diff --git a/.travis.yml b/.travis.yml index e9613ac..ca39e27 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,14 +18,17 @@ addons: services: - xvfb +env: + - GO111MODULE=on + go: - tip - - 1.8.x - - 1.7.4 + - 1.12.x install: - - go get -t ./... + - # Do nothing. This is needed to prevent the default install action + # "go get -t -v ./..." from happening here because we want it to happen + # inside script step. script: - - go test -i -race ./... - - go test -v -race ./... + - go test -v -race -mod=readonly ./... diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..f3762f9 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,29 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] +- Add more examples +- Add position as out variable from vertex shader +- Add experimental joystick support +- Add mouse cursor operations +- Add `Vec.Floor(…)` function +- Add circle geometry +- Fix `Matrix.Unproject(…)` for rotated matrix +- Add 2D Line geometry +- Add floating point round error correction +- Performance improvements +- Fix race condition in `NewGLTriangles(…)` +- Add `TriangleData` benchmarks and improvements +- Add zero rectangle variable for utility and consistency +- Add support for Go Modules +- Add `NoIconify` and `AlwaysOnTop` window hints + +## [v0.8.0] - 2018-10-10 +Changelog for this and older versions can be found on the corresponding [GitHub +releases](https://github.com/faiface/pixel/releases). + +[Unreleased]: https://github.com/faiface/pixel/compare/v0.8.0...HEAD +[v0.8.0]: https://github.com/faiface/pixel/releases/tag/v0.8.0 diff --git a/README.md b/README.md index 0e5b038..a949c2e 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,18 @@ do. go get github.com/faiface/pixel ``` +If you are using Modules (Go 1.11 or higher) and want a mutable copy of the source code: + +``` +git clone https://github.com/faiface/pixel # clone outside of $GOPATH +cd pixel +go install ./... +``` + See [requirements](#requirements) for the list of libraries necessary for compilation. +All significant changes are documented in [CHANGELOG.md](CHANGELOG.md). + ## Tutorial The [Wiki of this repo](https://github.com/faiface/pixel/wiki) contains an extensive tutorial diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..c9d5ef2 --- /dev/null +++ b/go.mod @@ -0,0 +1,15 @@ +module github.com/faiface/pixel + +go 1.12 + +require ( + github.com/faiface/glhf v0.0.0-20181018222622-82a6317ac380 + github.com/faiface/mainthread v0.0.0-20171120011319-8b78f0a41ae3 + github.com/go-gl/gl v0.0.0-20190320180904-bf2b1f2f34d7 // indirect + github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1 + github.com/go-gl/mathgl v0.0.0-20190416160123-c4601bc793c7 + github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 + github.com/pkg/errors v0.8.1 + github.com/stretchr/testify v1.3.0 + golang.org/x/image v0.0.0-20190523035834-f03afa92d3ff +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..20d14f9 --- /dev/null +++ b/go.sum @@ -0,0 +1,25 @@ +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/faiface/glhf v0.0.0-20181018222622-82a6317ac380 h1:FvZ0mIGh6b3kOITxUnxS3tLZMh7yEoHo75v3/AgUqg0= +github.com/faiface/glhf v0.0.0-20181018222622-82a6317ac380/go.mod h1:zqnPFFIuYFFxl7uH2gYByJwIVKG7fRqlqQCbzAnHs9g= +github.com/faiface/mainthread v0.0.0-20171120011319-8b78f0a41ae3 h1:baVdMKlASEHrj19iqjARrPbaRisD7EuZEVJj6ZMLl1Q= +github.com/faiface/mainthread v0.0.0-20171120011319-8b78f0a41ae3/go.mod h1:VEPNJUlxl5KdWjDvz6Q1l+rJlxF2i6xqDeGuGAxa87M= +github.com/go-gl/gl v0.0.0-20190320180904-bf2b1f2f34d7 h1:SCYMcCJ89LjRGwEa0tRluNRiMjZHalQZrVrvTbPh+qw= +github.com/go-gl/gl v0.0.0-20190320180904-bf2b1f2f34d7/go.mod h1:482civXOzJJCPzJ4ZOX/pwvXBWSnzD4OKMdH4ClKGbk= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1 h1:QbL/5oDUmRBzO9/Z7Seo6zf912W/a6Sr4Eu0G/3Jho0= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/mathgl v0.0.0-20190416160123-c4601bc793c7 h1:THttjeRn1iiz69E875U6gAik8KTWk/JYAHoSVpUxBBI= +github.com/go-gl/mathgl v0.0.0-20190416160123-c4601bc793c7/go.mod h1:yhpkQzEiH9yPyxDUGzkmgScbaBVlhC06qodikEM0ZwQ= +github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g= +github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +golang.org/x/image v0.0.0-20190321063152-3fc05d484e9f/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190523035834-f03afa92d3ff h1:+2zgJKVDVAz/BWSsuniCmU1kLCjL88Z8/kv39xCI9NQ= +golang.org/x/image v0.0.0-20190523035834-f03afa92d3ff/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/pixelgl/window.go b/pixelgl/window.go index 8e65277..10c16ce 100644 --- a/pixelgl/window.go +++ b/pixelgl/window.go @@ -46,6 +46,16 @@ type WindowConfig struct { // Undecorated Window ommits the borders and decorations (close button, etc.). Undecorated bool + // NoIconify specifies whether fullscreen windows should not automatically + // iconify (and restore the previous video mode) on focus loss. + NoIconify bool + + // AlwaysOnTop specifies whether the windowed mode window will be floating + // above other regular windows, also called topmost or always-on-top. + // This is intended primarily for debugging purposes and cannot be used to + // implement proper full screen windows. + AlwaysOnTop bool + // VSync (vertical synchronization) synchronizes Window's framerate with the framerate of // the monitor. VSync bool @@ -100,6 +110,8 @@ func NewWindow(cfg WindowConfig) (*Window, error) { glfw.WindowHint(glfw.Resizable, bool2int[cfg.Resizable]) glfw.WindowHint(glfw.Decorated, bool2int[!cfg.Undecorated]) + glfw.WindowHint(glfw.Floating, bool2int[cfg.AlwaysOnTop]) + glfw.WindowHint(glfw.AutoIconify, bool2int[!cfg.NoIconify]) var share *glfw.Window if currWin != nil {