2018-12-30 07:35:49 +01:00
|
|
|
// Copyright 2018 The Ebiten Authors
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
package glfw
|
|
|
|
|
|
|
|
import (
|
2022-05-18 15:27:18 +02:00
|
|
|
"errors"
|
2018-12-30 07:35:49 +01:00
|
|
|
"image"
|
2018-12-30 20:59:06 +01:00
|
|
|
"image/draw"
|
|
|
|
|
2023-01-21 14:09:12 +01:00
|
|
|
"github.com/hajimehoshi/ebiten/v2/internal/goglfw"
|
2018-12-30 07:35:49 +01:00
|
|
|
)
|
|
|
|
|
2023-01-21 14:09:12 +01:00
|
|
|
type Cursor goglfw.Cursor
|
2021-04-11 07:21:38 +02:00
|
|
|
|
|
|
|
func CreateStandardCursor(shape StandardCursor) *Cursor {
|
2023-01-21 14:09:12 +01:00
|
|
|
c, err := goglfw.CreateStandardCursor(goglfw.StandardCursor(shape))
|
2022-05-18 15:27:18 +02:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return (*Cursor)(c)
|
2021-04-11 07:21:38 +02:00
|
|
|
}
|
|
|
|
|
2023-01-21 14:09:12 +01:00
|
|
|
type Monitor goglfw.Monitor
|
2018-12-30 07:35:49 +01:00
|
|
|
|
2022-12-08 05:39:15 +01:00
|
|
|
func (m *Monitor) GetContentScale() (float32, float32, error) {
|
2023-01-21 14:09:12 +01:00
|
|
|
return (*goglfw.Monitor)(m).GetContentScale()
|
2021-09-14 05:35:02 +02:00
|
|
|
}
|
|
|
|
|
2019-02-24 15:10:14 +01:00
|
|
|
func (m *Monitor) GetPos() (int, int) {
|
2023-01-21 14:09:12 +01:00
|
|
|
x, y, err := (*goglfw.Monitor)(m).GetPos()
|
2022-05-18 15:27:18 +02:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return x, y
|
2018-12-30 07:35:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Monitor) GetVideoMode() *VidMode {
|
2023-01-21 14:09:12 +01:00
|
|
|
v, err := (*goglfw.Monitor)(m).GetVideoMode()
|
2022-05-18 15:27:18 +02:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
2018-12-30 07:35:49 +01:00
|
|
|
}
|
2022-05-18 15:27:18 +02:00
|
|
|
return (*VidMode)(v)
|
2018-12-30 07:35:49 +01:00
|
|
|
}
|
|
|
|
|
2023-01-21 14:09:12 +01:00
|
|
|
type Window goglfw.Window
|
2018-12-30 07:35:49 +01:00
|
|
|
|
|
|
|
func (w *Window) Destroy() {
|
2023-01-21 14:09:12 +01:00
|
|
|
if err := (*goglfw.Window)(w).Destroy(); err != nil {
|
2022-05-18 15:27:18 +02:00
|
|
|
panic(err)
|
|
|
|
}
|
2018-12-30 07:35:49 +01:00
|
|
|
}
|
|
|
|
|
2022-08-12 15:34:17 +02:00
|
|
|
func (w *Window) Focus() {
|
2023-01-21 14:09:12 +01:00
|
|
|
if err := (*goglfw.Window)(w).Focus(); err != nil {
|
2022-05-18 15:27:18 +02:00
|
|
|
panic(err)
|
|
|
|
}
|
2018-12-30 07:35:49 +01:00
|
|
|
}
|
|
|
|
|
2022-08-12 15:34:17 +02:00
|
|
|
func (w *Window) GetAttrib(attrib Hint) int {
|
2023-01-21 14:09:12 +01:00
|
|
|
r, err := (*goglfw.Window)(w).GetAttrib(goglfw.Hint(attrib))
|
2022-08-12 15:34:17 +02:00
|
|
|
if err != nil {
|
2022-05-18 15:27:18 +02:00
|
|
|
panic(err)
|
|
|
|
}
|
2022-08-12 15:34:17 +02:00
|
|
|
return r
|
2019-11-26 03:45:52 +01:00
|
|
|
}
|
|
|
|
|
2018-12-30 07:35:49 +01:00
|
|
|
func (w *Window) GetCursorPos() (x, y float64) {
|
2023-01-21 14:09:12 +01:00
|
|
|
x, y, err := (*goglfw.Window)(w).GetCursorPos()
|
2022-05-18 15:27:18 +02:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return x, y
|
2018-12-30 07:35:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (w *Window) GetInputMode(mode InputMode) int {
|
2023-01-21 14:09:12 +01:00
|
|
|
r, err := (*goglfw.Window)(w).GetInputMode(goglfw.InputMode(mode))
|
2022-05-18 15:27:18 +02:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return r
|
2018-12-30 07:35:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (w *Window) GetKey(key Key) Action {
|
2023-01-21 14:09:12 +01:00
|
|
|
r, err := (*goglfw.Window)(w).GetKey(goglfw.Key(key))
|
2022-05-18 15:27:18 +02:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2018-12-30 07:35:49 +01:00
|
|
|
return Action(r)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (w *Window) GetMonitor() *Monitor {
|
2023-01-21 14:09:12 +01:00
|
|
|
m, err := (*goglfw.Window)(w).GetMonitor()
|
2022-05-18 15:27:18 +02:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
2018-12-30 07:35:49 +01:00
|
|
|
}
|
2022-05-18 15:27:18 +02:00
|
|
|
return (*Monitor)(m)
|
2018-12-30 07:35:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (w *Window) GetMouseButton(button MouseButton) Action {
|
2023-01-21 14:09:12 +01:00
|
|
|
r, err := (*goglfw.Window)(w).GetMouseButton(goglfw.MouseButton(button))
|
2022-05-18 15:27:18 +02:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2018-12-30 07:35:49 +01:00
|
|
|
return Action(r)
|
|
|
|
}
|
|
|
|
|
2019-02-24 15:10:14 +01:00
|
|
|
func (w *Window) GetPos() (int, int) {
|
2023-01-21 14:09:12 +01:00
|
|
|
x, y, err := (*goglfw.Window)(w).GetPos()
|
2022-05-18 15:27:18 +02:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return x, y
|
2018-12-30 07:35:49 +01:00
|
|
|
}
|
|
|
|
|
2019-02-24 15:10:14 +01:00
|
|
|
func (w *Window) GetSize() (int, int) {
|
2023-01-21 14:09:12 +01:00
|
|
|
width, height, err := (*goglfw.Window)(w).GetSize()
|
2022-05-18 15:27:18 +02:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return width, height
|
2018-12-30 07:35:49 +01:00
|
|
|
}
|
|
|
|
|
2021-09-24 19:46:18 +02:00
|
|
|
func (w *Window) Hide() {
|
2023-01-21 14:09:12 +01:00
|
|
|
if err := (*goglfw.Window)(w).Hide(); err != nil {
|
2022-05-18 15:27:18 +02:00
|
|
|
panic(err)
|
|
|
|
}
|
2021-09-24 19:46:18 +02:00
|
|
|
}
|
|
|
|
|
2020-03-21 11:26:28 +01:00
|
|
|
func (w *Window) Iconify() {
|
2023-01-21 14:09:12 +01:00
|
|
|
if err := (*goglfw.Window)(w).Iconify(); err != nil {
|
2022-05-18 15:27:18 +02:00
|
|
|
panic(err)
|
|
|
|
}
|
2020-03-21 11:26:28 +01:00
|
|
|
}
|
|
|
|
|
2018-12-30 07:35:49 +01:00
|
|
|
func (w *Window) MakeContextCurrent() {
|
2023-01-21 14:09:12 +01:00
|
|
|
if err := (*goglfw.Window)(w).MakeContextCurrent(); err != nil {
|
2022-05-18 15:27:18 +02:00
|
|
|
panic(err)
|
|
|
|
}
|
2018-12-30 07:35:49 +01:00
|
|
|
}
|
|
|
|
|
2020-03-21 11:26:28 +01:00
|
|
|
func (w *Window) Maximize() {
|
2023-01-21 14:09:12 +01:00
|
|
|
if err := (*goglfw.Window)(w).Maximize(); err != nil {
|
2022-05-18 15:27:18 +02:00
|
|
|
panic(err)
|
|
|
|
}
|
2020-03-21 11:26:28 +01:00
|
|
|
}
|
|
|
|
|
2020-03-21 14:16:23 +01:00
|
|
|
func (w *Window) Restore() {
|
2023-01-21 14:09:12 +01:00
|
|
|
if err := (*goglfw.Window)(w).Restore(); err != nil {
|
2022-05-18 15:27:18 +02:00
|
|
|
panic(err)
|
|
|
|
}
|
2020-03-21 14:16:23 +01:00
|
|
|
}
|
|
|
|
|
2022-08-12 15:34:17 +02:00
|
|
|
func (w *Window) SetAttrib(attrib Hint, value int) {
|
2023-01-21 14:09:12 +01:00
|
|
|
if err := (*goglfw.Window)(w).SetAttrib(goglfw.Hint(attrib), value); err != nil {
|
2022-08-12 15:34:17 +02:00
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-30 07:35:49 +01:00
|
|
|
func (w *Window) SetCharModsCallback(cbfun CharModsCallback) (previous CharModsCallback) {
|
2023-01-21 14:09:12 +01:00
|
|
|
f, err := (*goglfw.Window)(w).SetCharModsCallback(cbfun)
|
2022-05-18 15:27:18 +02:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return f
|
2018-12-30 07:35:49 +01:00
|
|
|
}
|
|
|
|
|
2021-06-13 13:52:14 +02:00
|
|
|
func (w *Window) SetCloseCallback(cbfun CloseCallback) (previous CloseCallback) {
|
2023-01-21 14:09:12 +01:00
|
|
|
f, err := (*goglfw.Window)(w).SetCloseCallback(cbfun)
|
2022-05-18 15:27:18 +02:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return f
|
2021-06-13 13:52:14 +02:00
|
|
|
}
|
|
|
|
|
2023-01-21 15:34:20 +01:00
|
|
|
func (w *Window) SetDropCallback(cbfun DropCallback) (previous DropCallback) {
|
|
|
|
f, err := (*goglfw.Window)(w).SetDropCallback(cbfun)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return f
|
|
|
|
}
|
|
|
|
|
2021-04-11 07:21:38 +02:00
|
|
|
func (w *Window) SetCursor(cursor *Cursor) {
|
2023-01-21 14:09:12 +01:00
|
|
|
if err := (*goglfw.Window)(w).SetCursor((*goglfw.Cursor)(cursor)); err != nil {
|
2022-05-18 15:27:18 +02:00
|
|
|
panic(err)
|
2021-04-11 07:21:38 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-30 07:35:49 +01:00
|
|
|
func (w *Window) SetFramebufferSizeCallback(cbfun FramebufferSizeCallback) (previous FramebufferSizeCallback) {
|
2023-01-21 14:09:12 +01:00
|
|
|
f, err := (*goglfw.Window)(w).SetFramebufferSizeCallback(cbfun)
|
2022-05-18 15:27:18 +02:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return f
|
2018-12-30 07:35:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (w *Window) SetScrollCallback(cbfun ScrollCallback) (previous ScrollCallback) {
|
2023-01-21 14:09:12 +01:00
|
|
|
f, err := (*goglfw.Window)(w).SetScrollCallback(cbfun)
|
2022-05-18 15:27:18 +02:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return f
|
2018-12-30 07:35:49 +01:00
|
|
|
}
|
|
|
|
|
2021-06-13 13:52:14 +02:00
|
|
|
func (w *Window) SetShouldClose(value bool) {
|
2023-01-21 14:09:12 +01:00
|
|
|
if err := (*goglfw.Window)(w).SetShouldClose(value); err != nil {
|
2022-05-18 15:27:18 +02:00
|
|
|
panic(err)
|
2021-06-13 13:52:14 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-23 08:52:09 +01:00
|
|
|
func (w *Window) SetSizeCallback(cbfun SizeCallback) (previous SizeCallback) {
|
2023-01-21 14:09:12 +01:00
|
|
|
f, err := (*goglfw.Window)(w).SetSizeCallback(cbfun)
|
2022-05-18 15:27:18 +02:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return f
|
2019-01-09 02:34:54 +01:00
|
|
|
}
|
|
|
|
|
2021-04-16 21:24:13 +02:00
|
|
|
func (w *Window) SetSizeLimits(minw, minh, maxw, maxh int) {
|
2023-01-21 14:09:12 +01:00
|
|
|
if err := (*goglfw.Window)(w).SetSizeLimits(minw, minh, maxw, maxh); err != nil {
|
2022-05-18 15:27:18 +02:00
|
|
|
panic(err)
|
|
|
|
}
|
2021-04-16 21:24:13 +02:00
|
|
|
}
|
|
|
|
|
2022-02-09 11:36:42 +01:00
|
|
|
func (w *Window) SetAspectRatio(numer, denom int) {
|
2023-01-21 14:09:12 +01:00
|
|
|
if err := (*goglfw.Window)(w).SetAspectRatio(numer, denom); err != nil {
|
2022-05-18 15:27:18 +02:00
|
|
|
panic(err)
|
|
|
|
}
|
2022-02-09 11:11:25 +01:00
|
|
|
}
|
|
|
|
|
2018-12-30 07:35:49 +01:00
|
|
|
func (w *Window) SetIcon(images []image.Image) {
|
2023-01-21 14:09:12 +01:00
|
|
|
gimgs := make([]*goglfw.Image, len(images))
|
2018-12-30 20:59:06 +01:00
|
|
|
for i, img := range images {
|
|
|
|
b := img.Bounds()
|
|
|
|
m := image.NewNRGBA(image.Rect(0, 0, b.Dx(), b.Dy()))
|
|
|
|
draw.Draw(m, m.Bounds(), img, b.Min, draw.Src)
|
2023-01-21 14:09:12 +01:00
|
|
|
gimgs[i] = &goglfw.Image{
|
2022-05-18 15:27:18 +02:00
|
|
|
Width: b.Dx(),
|
|
|
|
Height: b.Dy(),
|
|
|
|
Pixels: m.Pix,
|
|
|
|
}
|
2018-12-30 20:59:06 +01:00
|
|
|
}
|
2018-12-30 07:35:49 +01:00
|
|
|
|
2023-01-21 14:09:12 +01:00
|
|
|
if err := (*goglfw.Window)(w).SetIcon(gimgs); err != nil {
|
2022-05-18 15:27:18 +02:00
|
|
|
panic(err)
|
|
|
|
}
|
2018-12-30 07:35:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (w *Window) SetInputMode(mode InputMode, value int) {
|
2023-01-21 14:09:12 +01:00
|
|
|
if err := (*goglfw.Window)(w).SetInputMode(goglfw.InputMode(mode), value); err != nil {
|
2022-05-18 15:27:18 +02:00
|
|
|
panic(err)
|
|
|
|
}
|
2018-12-30 07:35:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (w *Window) SetMonitor(monitor *Monitor, xpos, ypos, width, height, refreshRate int) {
|
2023-01-21 14:09:12 +01:00
|
|
|
if err := (*goglfw.Window)(w).SetMonitor((*goglfw.Monitor)(monitor), xpos, ypos, width, height, refreshRate); err != nil {
|
2022-05-18 15:27:18 +02:00
|
|
|
panic(err)
|
2018-12-30 07:35:49 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (w *Window) SetPos(xpos, ypos int) {
|
2023-01-21 14:09:12 +01:00
|
|
|
if err := (*goglfw.Window)(w).SetPos(xpos, ypos); err != nil {
|
2022-05-18 15:27:18 +02:00
|
|
|
panic(err)
|
|
|
|
}
|
2018-12-30 07:35:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (w *Window) SetSize(width, height int) {
|
2023-01-21 14:09:12 +01:00
|
|
|
if err := (*goglfw.Window)(w).SetSize(width, height); err != nil {
|
2022-05-18 15:27:18 +02:00
|
|
|
panic(err)
|
|
|
|
}
|
2018-12-30 07:35:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (w *Window) SetTitle(title string) {
|
2023-01-21 14:09:12 +01:00
|
|
|
if err := (*goglfw.Window)(w).SetTitle(title); err != nil {
|
2022-05-18 15:27:18 +02:00
|
|
|
panic(err)
|
|
|
|
}
|
2018-12-30 07:35:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (w *Window) ShouldClose() bool {
|
2023-01-21 14:09:12 +01:00
|
|
|
r, err := (*goglfw.Window)(w).ShouldClose()
|
2022-05-18 15:27:18 +02:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return r
|
2018-12-30 07:35:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (w *Window) Show() {
|
2023-01-21 14:09:12 +01:00
|
|
|
if err := (*goglfw.Window)(w).Show(); err != nil {
|
2022-05-18 15:27:18 +02:00
|
|
|
panic(err)
|
|
|
|
}
|
2018-12-30 07:35:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (w *Window) SwapBuffers() {
|
2023-01-21 14:09:12 +01:00
|
|
|
if err := (*goglfw.Window)(w).SwapBuffers(); err != nil {
|
2022-05-18 15:27:18 +02:00
|
|
|
panic(err)
|
|
|
|
}
|
2018-12-30 07:35:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func CreateWindow(width, height int, title string, monitor *Monitor, share *Window) (*Window, error) {
|
2023-01-21 14:09:12 +01:00
|
|
|
w, err := goglfw.CreateWindow(width, height, title, (*goglfw.Monitor)(monitor), (*goglfw.Window)(share))
|
2022-05-18 15:27:18 +02:00
|
|
|
// TODO: acceptError(APIUnavailable, VersionUnavailable)?
|
|
|
|
return (*Window)(w), err
|
2018-12-30 07:35:49 +01:00
|
|
|
}
|
|
|
|
|
2022-08-13 06:33:52 +02:00
|
|
|
func GetKeyName(key Key, scancode int) string {
|
2023-01-21 14:09:12 +01:00
|
|
|
name, err := goglfw.GetKeyName(goglfw.Key(key), scancode)
|
2022-08-13 06:33:52 +02:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return name
|
|
|
|
}
|
|
|
|
|
2018-12-30 07:35:49 +01:00
|
|
|
func GetMonitors() []*Monitor {
|
2023-01-21 14:09:12 +01:00
|
|
|
ms, err := goglfw.GetMonitors()
|
2022-05-18 15:27:18 +02:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
result := make([]*Monitor, 0, len(ms))
|
|
|
|
for _, m := range ms {
|
|
|
|
result = append(result, (*Monitor)(m))
|
2018-12-30 07:35:49 +01:00
|
|
|
}
|
2022-05-18 15:27:18 +02:00
|
|
|
return result
|
2018-12-30 07:35:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func GetPrimaryMonitor() *Monitor {
|
2023-01-21 14:09:12 +01:00
|
|
|
m, err := goglfw.GetPrimaryMonitor()
|
2022-05-18 15:27:18 +02:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
2018-12-30 07:35:49 +01:00
|
|
|
}
|
2022-05-18 15:27:18 +02:00
|
|
|
return (*Monitor)(m)
|
2018-12-30 07:35:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func Init() error {
|
2021-07-14 16:52:27 +02:00
|
|
|
// InvalidValue can happen when specific joysticks are used. This issue
|
2021-07-14 18:02:54 +02:00
|
|
|
// will be fixed in GLFW 3.3.5. As a temporary fix, ignore this error.
|
2021-07-14 16:52:27 +02:00
|
|
|
// See go-gl/glfw#292, go-gl/glfw#324, and glfw/glfw#1763
|
|
|
|
// (#1229).
|
2022-05-18 15:27:18 +02:00
|
|
|
// TODO: acceptError(APIUnavailable, InvalidValue)?
|
2023-01-21 14:09:12 +01:00
|
|
|
err := goglfw.Init()
|
|
|
|
if err != nil && !errors.Is(err, goglfw.InvalidValue) {
|
2022-05-18 15:27:18 +02:00
|
|
|
return err
|
2021-07-14 18:02:54 +02:00
|
|
|
}
|
2022-05-18 15:27:18 +02:00
|
|
|
return nil
|
2018-12-30 07:35:49 +01:00
|
|
|
}
|
|
|
|
|
2022-05-18 15:27:18 +02:00
|
|
|
func PollEvents() {
|
2023-01-21 14:09:12 +01:00
|
|
|
if err := goglfw.PollEvents(); err != nil && !errors.Is(err, goglfw.InvalidValue) {
|
2021-07-15 04:19:39 +02:00
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-22 18:07:28 +02:00
|
|
|
func PostEmptyEvent() {
|
2023-01-21 14:09:12 +01:00
|
|
|
if err := goglfw.PostEmptyEvent(); err != nil {
|
2022-05-18 15:27:18 +02:00
|
|
|
panic(err)
|
|
|
|
}
|
2021-07-22 18:07:28 +02:00
|
|
|
}
|
|
|
|
|
2022-05-18 18:49:21 +02:00
|
|
|
func SetMonitorCallback(cbfun MonitorCallback) MonitorCallback {
|
2023-01-21 14:09:12 +01:00
|
|
|
f, err := goglfw.SetMonitorCallback(cbfun)
|
2022-05-18 15:27:18 +02:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return f
|
2018-12-30 07:35:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func SwapInterval(interval int) {
|
2023-01-21 14:09:12 +01:00
|
|
|
if err := goglfw.SwapInterval(interval); err != nil {
|
2022-05-18 15:27:18 +02:00
|
|
|
panic(err)
|
|
|
|
}
|
2018-12-30 07:35:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func Terminate() {
|
2023-01-21 14:09:12 +01:00
|
|
|
if err := goglfw.Terminate(); err != nil {
|
2018-12-30 07:35:49 +01:00
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-22 18:07:28 +02:00
|
|
|
func WaitEvents() {
|
2023-01-21 14:09:12 +01:00
|
|
|
if err := goglfw.WaitEvents(); err != nil {
|
2022-05-18 15:27:18 +02:00
|
|
|
panic(err)
|
|
|
|
}
|
2021-07-22 18:07:28 +02:00
|
|
|
}
|
|
|
|
|
2018-12-30 07:35:49 +01:00
|
|
|
func WindowHint(target Hint, hint int) {
|
2023-01-21 14:09:12 +01:00
|
|
|
if err := goglfw.WindowHint(goglfw.Hint(target), hint); err != nil {
|
2022-05-18 15:27:18 +02:00
|
|
|
panic(err)
|
|
|
|
}
|
2018-12-30 07:35:49 +01:00
|
|
|
}
|