ebiten/internal/goglfw/win32thread_windows.go
TotallyGamerJet b359985e97
internal/goglfw: separate windows specific struct from common structs (#2567)
Many of the structs found in internal.h (internal_windows.go) contain defines such as GLFW_WIN32_WINDOW_STATE
which gets replaced with a struct defined in win32platform_windows.go (win32_platform.h).

Originally, these structs where directly placed inside of internal_windows.go. However, to make it easier to add macOS
and Linux these cannot be in this file.

This commit separates the windows specific structs into the respective windows file and updates the field to be named
state.

Updates #2546
2023-02-08 03:05:46 +09:00

48 lines
954 B
Go

// SPDX-License-Identifier: Zlib
// SPDX-FileCopyrightText: 2002-2006 Marcus Geelnard
// SPDX-FileCopyrightText: 2006-2019 Camilla Löwy
// SPDX-FileCopyrightText: 2022 The Ebitengine Authors
package goglfw
func (t *tls) create() error {
if t.platform.allocated {
panic("goglfw: TLS must not be allocated")
}
i, err := _TlsAlloc()
if err != nil {
return err
}
t.platform.index = i
t.platform.allocated = true
return nil
}
func (t *tls) destroy() error {
if t.platform.allocated {
if err := _TlsFree(t.platform.index); err != nil {
return err
}
}
t.platform.allocated = false
t.platform.index = 0
return nil
}
func (t *tls) get() (uintptr, error) {
if !t.platform.allocated {
panic("goglfw: TLS must be allocated")
}
return _TlsGetValue(t.platform.index)
}
func (t *tls) set(value uintptr) error {
if !t.platform.allocated {
panic("goglfw: TLS must be allocated")
}
return _TlsSetValue(t.platform.index, value)
}