From 3d5822db4820b8952f60c3cadd20a25812dc10dc Mon Sep 17 00:00:00 2001 From: Daniel Kuffner Date: Wed, 22 Jan 2020 09:39:30 +0100 Subject: [PATCH] Added Window, Clipboard and Mouse methods Added: - IsWindowResized - IsWindowHidden - UnhideWindow - HideWindow - GetClipboardText - SetClipboardText - SetMouseOffset --- raylib/core.go | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/raylib/core.go b/raylib/core.go index 783a45a..731f674 100644 --- a/raylib/core.go +++ b/raylib/core.go @@ -76,11 +76,34 @@ func IsWindowMinimized() bool { return v } +// IsWindowResized - Check if window has been resized +func IsWindowResized() bool { + ret := C.IsWindowResized() + v := bool(ret) + return v +} + +// IsWindowHidden - Check if window is currently hidden +func IsWindowHidden() bool { + ret := C.IsWindowHidden() + v := bool(ret) + return v +} // ToggleFullscreen - Fullscreen toggle (only PLATFORM_DESKTOP) func ToggleFullscreen() { C.ToggleFullscreen() } +// UnhideWindow - Show the window +func UnhideWindow() { + C.UnhideWindow() +} + +// HideWindow - Hide the window +func HideWindow() { + C.HideWindow() +} + // SetWindowIcon - Set icon for window (only PLATFORM_DESKTOP) func SetWindowIcon(image Image) { cimage := image.cptr() @@ -182,6 +205,20 @@ func GetMonitorName(monitor int) string { return v } +// GetClipboardText - Get clipboard text content +func GetClipboardText() string { + ret := C.GetClipboardText() + v := C.GoString(ret) + return v +} + +// SetClipboardText - Set clipboard text content +func SetClipboardText(data string) { + cdata := C.CString(data) + defer C.free(unsafe.Pointer(cdata)) + C.SetClipboardText(cdata) +} + // ClearBackground - Sets Background Color func ClearBackground(color Color) { ccolor := color.cptr() @@ -591,6 +628,13 @@ func SetMousePosition(x, y int) { C.SetMousePosition(cx, cy) } +// SetMouseOffset - Set mouse offset +func SetMouseOffset(offsetX, offsetY int) { + ox := (C.int)(offsetX) + oy := (C.int)(offsetY) + C.SetMouseOffset(ox, oy) +} + // SetMouseScale - Set mouse scaling func SetMouseScale(scaleX, scaleY float32) { cscaleX := (C.float)(scaleX)