Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusion about imdraw documentation #54

Open
duysqubix opened this issue Oct 10, 2023 · 0 comments
Open

Confusion about imdraw documentation #54

duysqubix opened this issue Oct 10, 2023 · 0 comments

Comments

@duysqubix
Copy link
Contributor

edgeDebug := imdraw.New(nil)

for !win.Closed() {
    // .....
    
    edgeDebug.Clear()
    //edgeDebug.Reset()
    edgeDebug.Color = colornames.Red
    edgeDebug.Push(points...)
    edgeDebug.Line(2)
    
    // .....

    win.Draw(edgeDebug)
}

According to documentation below

// Clear removes all drawn shapes from the IM. This does not remove Pushed points.
func (imd *IMDraw) Clear()

// Reset restores all point properties to defaults and removes all Pushed points.
//
// This does not affect matrix and color mask set by SetMatrix and SetColorMask.
func (imd *IMDraw) Reset()

Pushing new points in the main loop is no good since Clear() doesn't empty already pushed points but for some reason it works just fine. Only the recently pushed points are drawn to the screen. Am I missing something?

Also, Reset() supposedly removes all the pushed points but in this case it doesn't work. All the points pushed up until that moment is drawn to the screen. That's probably because old points were already drawn to the framebuffer and reset doesn't clear the buffer but it's really confusing.

Another nitpick would be that even If I use both there is no way to completely reset an imdraw object since it doesn't affect matrix and color mask.

So what's the best way to have a dynamically changing imdraw setup?

Thanks

Original issue: faiface/pixel#216

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant