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

Add method Window.Hide #315

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions pixelgl/glshader.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ var defaultCanvasVertexFormat = glhf.AttrFormat{
canvasColor: glhf.Attr{Name: "aColor", Type: glhf.Vec4},
canvasTexCoords: glhf.Attr{Name: "aTexCoords", Type: glhf.Vec2},
canvasIntensity: glhf.Attr{Name: "aIntensity", Type: glhf.Float},
canvasClip: glhf.Attr{Name: "aClipRect", Type: glhf.Vec4},
canvasClip: glhf.Attr{Name: "aClipRect", Type: glhf.Vec4},
}

// Sets up a base shader with everything needed for a Pixel
// NewGLShader sets up a base shader with everything needed for a Pixel
// canvas to render correctly. The defaults can be overridden
// by simply using the SetUniform function.
func NewGLShader(fragmentShader string) *GLShader {
Expand Down Expand Up @@ -109,10 +109,10 @@ func (gs *GLShader) getUniform(Name string) int {
// SetUniform appends a custom uniform name and value to the shader.
// if the uniform already exists, it will simply be overwritten.
//
// example:
// Example:
//
// utime := float32(time.Since(starttime)).Seconds())
// mycanvas.shader.AddUniform("u_time", &utime)
// utime := float32(time.Since(starttime)).Seconds())
// mycanvas.shader.AddUniform("u_time", &utime)
func (gs *GLShader) SetUniform(name string, value interface{}) {
t, p := getAttrType(value)
if loc := gs.getUniform(name); loc > -1 {
Expand Down
12 changes: 10 additions & 2 deletions pixelgl/window.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func (w *Window) ClipboardText() string {
}

// SetClipboardText passes the given string to the underlying glfw window to set the
// systems clipboard.
// systems clipboard.
func (w *Window) SetClipboardText(text string) {
w.window.SetClipboardString(text)
}
Expand Down Expand Up @@ -527,6 +527,14 @@ func (w *Window) Show() {
})
}

// Hide hides the window, if it was previously visible. If the window is already
// hidden or is in full screen mode, this function does nothing.
func (w *Window) Hide() {
mainthread.Call(func() {
w.window.Hide()
})
}

// Clipboard returns the contents of the system clipboard.
func (w *Window) Clipboard() string {
var clipboard string
Expand All @@ -536,7 +544,7 @@ func (w *Window) Clipboard() string {
return clipboard
}

// SetClipboardString sets the system clipboard to the specified UTF-8 encoded string.
// SetClipboard sets the system clipboard to the specified UTF-8 encoded string.
func (w *Window) SetClipboard(str string) {
mainthread.Call(func() {
w.window.SetClipboardString(str)
Expand Down