Merge branch 'master' into window-initial-position
This commit is contained in:
commit
70eff126da
10
CHANGELOG.md
10
CHANGELOG.md
|
@ -3,10 +3,15 @@ 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]
|
||||
- Gamepad API?
|
||||
- Pending physical testing, Gamepad API support from [PR-233](https://github.com/faiface/pixel/pull/233)
|
||||
- Support setting an initial window position
|
||||
|
||||
## [v0.10.0-beta] 2020-05-10
|
||||
- Add `WindowConfig.TransparentFramebuffer` option to support window transparency onto the background
|
||||
- Fixed Line intersects failing on lines passing through (0, 0)
|
||||
|
||||
## [v0.10.0-alpha] 2020-05-08
|
||||
- Upgrade to GLFW 3.3! :tada:
|
||||
- Closes https://github.com/faiface/pixel/issues/137
|
||||
|
@ -37,7 +42,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
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.10.0-alpha...HEAD
|
||||
[Unreleased]: https://github.com/faiface/pixel/compare/v0.10.0-beta...HEAD
|
||||
[v0.10.0-beta]: https://github.com/faiface/pixel/compare/v0.10.0-alpha...v0.10.0-beta
|
||||
[v0.10.0-alpha]: https://github.com/faiface/pixel/compare/v0.9.0...v0.10.0-alpha
|
||||
[v0.9.0]: https://github.com/faiface/pixel/compare/v0.8.0...v0.9.0
|
||||
[v0.8.0]: https://github.com/faiface/pixel/releases/tag/v0.8.0
|
||||
|
|
|
@ -172,10 +172,6 @@ better result.
|
|||
|
||||
Take a look at [CONTRIBUTING.md](CONTRIBUTING.md) for further information.
|
||||
|
||||
For any kind of discussion, feel free to use our
|
||||
[Gitter](https://gitter.im/pixellib/Lobby)
|
||||
community.
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
|
|
@ -406,12 +406,12 @@ func (l Line) IntersectRect(r Rect) Vec {
|
|||
// - the point is contained by the rectangle
|
||||
// - the point is not the corner itself
|
||||
corners := r.Vertices()
|
||||
closest := ZV
|
||||
var closest *Vec
|
||||
closestCorner := corners[0]
|
||||
for _, c := range corners {
|
||||
cc := l.Closest(c)
|
||||
if closest == ZV || (closest.Len() > cc.Len() && r.Contains(cc)) {
|
||||
closest = cc
|
||||
if closest == nil || (closest.Len() > cc.Len() && r.Contains(cc)) {
|
||||
closest = &cc
|
||||
closestCorner = c
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1002,6 +1002,18 @@ func TestLine_Closest(t *testing.T) {
|
|||
args: args{v: pixel.V(20, 20)},
|
||||
want: pixel.V(10, 10),
|
||||
},
|
||||
{
|
||||
name: "Vertical line",
|
||||
fields: fields{A: pixel.V(0, -10), B: pixel.V(0, 10)},
|
||||
args: args{v: pixel.V(-1, 0)},
|
||||
want: pixel.V(0, 0),
|
||||
},
|
||||
{
|
||||
name: "Horizontal line",
|
||||
fields: fields{A: pixel.V(-10, 0), B: pixel.V(10, 0)},
|
||||
args: args{v: pixel.V(0, -1)},
|
||||
want: pixel.V(0, 0),
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
|
@ -1297,6 +1309,12 @@ func TestLine_IntersectRect(t *testing.T) {
|
|||
args: args{r: pixel.R(20, 20, 21, 21)},
|
||||
want: pixel.ZV,
|
||||
},
|
||||
{
|
||||
name: "Line intersects at 0,0",
|
||||
fields: fields{A: pixel.V(0, -10), B: pixel.V(0, 10)},
|
||||
args: args{r: pixel.R(-1, 0, 2, 2)},
|
||||
want: pixel.V(-1, 0),
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
|
|
|
@ -128,7 +128,9 @@ func (imd *IMDraw) Draw(t pixel.Target) {
|
|||
// Push adds some points to the IM queue. All Pushed points will have the same properties except for
|
||||
// the position.
|
||||
func (imd *IMDraw) Push(pts ...pixel.Vec) {
|
||||
//Assert that Color is of type pixel.RGBA,
|
||||
if _, ok := imd.Color.(pixel.RGBA); !ok {
|
||||
//otherwise cast it
|
||||
imd.Color = pixel.ToRGBA(imd.Color)
|
||||
}
|
||||
opts := point{
|
||||
|
|
|
@ -59,6 +59,12 @@ type WindowConfig struct {
|
|||
// implement proper full screen windows.
|
||||
AlwaysOnTop bool
|
||||
|
||||
// TransparentFramebuffer specifies whether the window framebuffer will be
|
||||
// transparent. If enabled and supported by the system, the window
|
||||
// framebuffer alpha channel will be used to combine the framebuffer with
|
||||
// the background. This does not affect window decorations.
|
||||
TransparentFramebuffer bool
|
||||
|
||||
// VSync (vertical synchronization) synchronizes Window's framerate with the framerate of
|
||||
// the monitor.
|
||||
VSync bool
|
||||
|
@ -115,6 +121,7 @@ func NewWindow(cfg WindowConfig) (*Window, error) {
|
|||
glfw.WindowHint(glfw.Decorated, bool2int[!cfg.Undecorated])
|
||||
glfw.WindowHint(glfw.Floating, bool2int[cfg.AlwaysOnTop])
|
||||
glfw.WindowHint(glfw.AutoIconify, bool2int[!cfg.NoIconify])
|
||||
glfw.WindowHint(glfw.TransparentFramebuffer, bool2int[cfg.TransparentFramebuffer])
|
||||
|
||||
if cfg.Position.X != 0 || cfg.Position.Y != 0 {
|
||||
glfw.WindowHint(glfw.Visible, glfw.False)
|
||||
|
|
Loading…
Reference in New Issue